From 9489fece131039707c774b2b46615e8a9fa1c671 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABlle=20Morin?= <morin.gaelle@gmail.com>
Date: Thu, 24 Oct 2019 18:23:46 +0200
Subject: [PATCH 1/4] route for circle admin ok

---
 src/index.pug             | 3 +++
 src/menu-left.pug         | 1 +
 src/page-circle-admin.pug | 1 +
 src/page-user-panel.pug   | 4 ++--
 4 files changed, 7 insertions(+), 2 deletions(-)
 create mode 100644 src/page-circle-admin.pug

diff --git a/src/index.pug b/src/index.pug
index cf0f8d03..302da84c 100644
--- a/src/index.pug
+++ b/src/index.pug
@@ -35,6 +35,9 @@ html(lang="en")
         #circle(hidden).with-sidebar
           include page-circle.pug
 
+        #circle-admin(hidden).no-sidebar
+          include page-circle-admin.pug
+
         #messages(hidden).with-sidebar
           include page-messages.pug
         
diff --git a/src/menu-left.pug b/src/menu-left.pug
index 12134733..b40adb44 100644
--- a/src/menu-left.pug
+++ b/src/menu-left.pug
@@ -82,6 +82,7 @@ nav#main__menu
           next='messages'
         )
 
+    sib-route(hidden, name='circle-admin', use-id='')
     //- div.divider
     //- sib-route.menu(hidden, name='my-profile', rdf-type='foaf:user', use-id='')
 
diff --git a/src/page-circle-admin.pug b/src/page-circle-admin.pug
new file mode 100644
index 00000000..507ce0ba
--- /dev/null
+++ b/src/page-circle-admin.pug
@@ -0,0 +1 @@
+h1 Hello!
\ No newline at end of file
diff --git a/src/page-user-panel.pug b/src/page-user-panel.pug
index d3491ace..76e1a32c 100644
--- a/src/page-user-panel.pug
+++ b/src/page-user-panel.pug
@@ -4,6 +4,6 @@ nav(role="user's functionalities menu")
     //-   sib-link(next='my-profile') My profile
     //-li
       sib-link(next='user-settings') Settings
-    //-li
-      sib-link(name='user-admin') Admin
+    li
+      sib-link(next='circle-admin') Admin
   button(role='log out' onclick="document.querySelector('sib-auth').logout();") Log out
-- 
GitLab


From af0db1462e65d6077d8e2db58445fb5dace750e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABlle=20Morin?= <morin.gaelle@gmail.com>
Date: Thu, 24 Oct 2019 19:07:56 +0200
Subject: [PATCH 2/4] name + owner displayed

---
 src/page-circle-admin.pug | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/page-circle-admin.pug b/src/page-circle-admin.pug
index 507ce0ba..f13b5b21 100644
--- a/src/page-circle-admin.pug
+++ b/src/page-circle-admin.pug
@@ -1 +1,9 @@
-h1 Hello!
\ No newline at end of file
+h1 Circles
+
+div
+  //- Search a circle
+
+sib-display(
+  data-src=`${endpoints.circles}`
+  fields='name, owner.username'
+)
\ No newline at end of file
-- 
GitLab


From fc7732b1b98711c06f9f45f0cc46eb5acfa62a63 Mon Sep 17 00:00:00 2001
From: Christophe Henry <contact@c-henry.fr>
Date: Fri, 25 Oct 2019 15:38:35 +0200
Subject: [PATCH 3/4] feat: add circles display

---
 src/page-circle-admin.pug | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/page-circle-admin.pug b/src/page-circle-admin.pug
index f13b5b21..43ae78d9 100644
--- a/src/page-circle-admin.pug
+++ b/src/page-circle-admin.pug
@@ -1,9 +1,32 @@
 h1 Circles
 
+sib-widget(name='template-admin-circle')
+    template
+      sib-display(
+        fields='name'
+        bind-resources
+      )
+      sib-display(
+        data-src='${await value.owner}'
+        fields='account.picture, sup(name)'
+        widget-account.picture='hd-user-avatar'
+      )
+      sib-display(
+        fields='team'
+        bind-resources
+      )
+
 div
   //- Search a circle
 
-sib-display(
+div.table-header
+  div.cell Name
+  div.cell Admins
+  div.cell Join
+
+sib-display.table-body(
   data-src=`${endpoints.circles}`
-  fields='name, owner.username'
+  fields='circles(name, team, owner)'
+  multiple-circles
+  widget-circles='template-admin-circle'
 )
\ No newline at end of file
-- 
GitLab


From 5eb9b6aad8a24a0a98eea7edbdd3dbd4117cc342 Mon Sep 17 00:00:00 2001
From: Christophe Henry <contact@c-henry.fr>
Date: Mon, 28 Oct 2019 12:08:22 +0100
Subject: [PATCH 4/4] feat: add template for circle admin page

---
 src/page-circle-admin.pug                     | 50 ++++++++++++-------
 src/styles/base/main.scss                     |  3 +-
 src/styles/base/user-avatar.scss              | 29 +++++++++++
 src/styles/layout/circle/_index.scss          |  3 +-
 src/styles/layout/circle/circle-admin.scss    |  3 ++
 src/styles/layout/circle/circle-edit.scss     | 15 +++++-
 .../project-profile/project-profile.scss      | 33 ------------
 7 files changed, 80 insertions(+), 56 deletions(-)
 create mode 100644 src/styles/base/user-avatar.scss
 create mode 100644 src/styles/layout/circle/circle-admin.scss

diff --git a/src/page-circle-admin.pug b/src/page-circle-admin.pug
index 43ae78d9..2731be53 100644
--- a/src/page-circle-admin.pug
+++ b/src/page-circle-admin.pug
@@ -1,21 +1,29 @@
-h1 Circles
-
-sib-widget(name='template-admin-circle')
-    template
-      sib-display(
-        fields='name'
-        bind-resources
-      )
-      sib-display(
-        data-src='${await value.owner}'
-        fields='account.picture, sup(name)'
-        widget-account.picture='hd-user-avatar'
-      )
-      sib-display(
-        fields='team'
-        bind-resources
+sib-widget(name='circle-admin-leave-button-template')
+  template
+    sib-ac-checker(
+      permission="acl:Delete"
+      data-src="${await value['@id']}"
+    )
+      sib-delete(
+        data-src="${await value['@id']}"
+        data-label='Leave the circle'
       )
 
+sib-widget(name='circle-admin-join-button-template')
+  template
+    sib-form.circle-admin-join-button(
+      data-src='${src}'
+      nested-field='members'
+      fields='user'
+      widget-user='sib-form-dropdown'
+      label-user=''
+      range-user=`${endpoints.users}`
+      submit-button='Join'
+      set-user-id-select="user"
+    )
+
+h1 Circles
+
 div
   //- Search a circle
 
@@ -26,7 +34,11 @@ div.table-header
 
 sib-display.table-body(
   data-src=`${endpoints.circles}`
-  fields='circles(name, team, owner)'
-  multiple-circles
-  widget-circles='template-admin-circle'
+  fields="name,own(owner.name,owner.account['@id']),members,button"
+
+  widget-members='circle-admin-leave-button-template'
+  multiple-members
+
+  widget-button='circle-admin-join-button-template'
+  action-button='button'
 )
\ No newline at end of file
diff --git a/src/styles/base/main.scss b/src/styles/base/main.scss
index 4a127933..b4e3ce19 100644
--- a/src/styles/base/main.scss
+++ b/src/styles/base/main.scss
@@ -260,4 +260,5 @@ sib-delete {
 // Other base components
 @import 'form';
 @import 'header';
-@import 'menu-left';
\ No newline at end of file
+@import 'menu-left';
+@import 'user-avatar';
\ No newline at end of file
diff --git a/src/styles/base/user-avatar.scss b/src/styles/base/user-avatar.scss
new file mode 100644
index 00000000..0c930937
--- /dev/null
+++ b/src/styles/base/user-avatar.scss
@@ -0,0 +1,29 @@
+.project-profile-user-avatar {
+  align-self: center;
+  grid-column: 1 / span 1;
+  grid-row: 1 / span 2;
+  display: inline;
+
+  * {
+    height: 100%;
+    width: 100%;
+  }
+
+  div {
+    background-color: $color-0-0-100;
+    border-radius: 50%;
+    height: 7vh;
+    overflow: hidden;
+    position: relative;
+    width: 7vh;
+
+    img {
+      height: 100%;
+      left: 0;
+      object-fit: cover;
+      position: absolute;
+      top: 0;
+      width: 100%;
+    }
+  }
+}
\ No newline at end of file
diff --git a/src/styles/layout/circle/_index.scss b/src/styles/layout/circle/_index.scss
index 6efac3d0..350cfc1f 100644
--- a/src/styles/layout/circle/_index.scss
+++ b/src/styles/layout/circle/_index.scss
@@ -1,2 +1,3 @@
 @import 'circle-profile';
-@import 'circle-edit';
\ No newline at end of file
+@import 'circle-edit';
+@import 'circle-admin';
\ No newline at end of file
diff --git a/src/styles/layout/circle/circle-admin.scss b/src/styles/layout/circle/circle-admin.scss
new file mode 100644
index 00000000..04813c0c
--- /dev/null
+++ b/src/styles/layout/circle/circle-admin.scss
@@ -0,0 +1,3 @@
+.circle-admin-join-button select[name='user'] {
+  display: none;
+}
\ No newline at end of file
diff --git a/src/styles/layout/circle/circle-edit.scss b/src/styles/layout/circle/circle-edit.scss
index 547e3991..f5812cf2 100644
--- a/src/styles/layout/circle/circle-edit.scss
+++ b/src/styles/layout/circle/circle-edit.scss
@@ -13,11 +13,22 @@ h2 {
   justify-content: space-around;
   text-align: center;
 
-  >*{
-    border-right: 1px solid $color-228-25-79;
+  .cell {
+    border-bottom: none;
+    border-top: none;
     flex: 1;
     padding: 1rem;
     width: 50%;
+
+    &:not(:last-child) {
+      border-left: none;
+      border-right: 1px solid white;
+    }
+
+    &:not(:last-child) {
+      border-left: 1px solid white;
+      border-right: none;
+    }
   }
 
   >*:last-of-type {
diff --git a/src/styles/layout/project-profile/project-profile.scss b/src/styles/layout/project-profile/project-profile.scss
index 1a8b0f25..ae54b38a 100644
--- a/src/styles/layout/project-profile/project-profile.scss
+++ b/src/styles/layout/project-profile/project-profile.scss
@@ -169,30 +169,6 @@
       display: none;
     }
 
-    sib-display.project-profile-user-avatar {
-      align-self: center;
-      grid-column: 1 / span 1;
-      grid-row: 1 / span 2;
-
-      div {
-        background-color: $color-0-0-100;
-        border-radius: 50%;
-        height: 7vh;
-        overflow: hidden;
-        position: relative;
-        width: 7vh;
-
-        img {
-          height: 100%;
-          left: 0;
-          object-fit: cover;
-          position: absolute;
-          top: 0;
-          width: 100%;
-        }
-      }
-    }
-
     team-template[name='members'], captain-template[name='captain'] {
       display: grid;
       grid-column-gap: 1.6rem;
@@ -231,13 +207,4 @@
       }
     }
   }
-
-  .project-profile-user-avatar {
-    display: inline;
-
-    * {
-      height: 100%;
-      width: 100%;
-    }
-  }
 }
\ No newline at end of file
-- 
GitLab