From dc09d00875d8e3ac0831207d63ece2f11d41caa5 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sat, 12 May 2018 16:13:04 -0400 Subject: [PATCH] feat: admin group edit / assign / unassign --- client/components/admin/admin-general.vue | 13 +- client/components/admin/admin-groups-edit.vue | 108 ++++- client/components/admin/admin-groups.vue | 1 + client/components/admin/admin-locale.vue | 13 +- client/components/admin/admin-theme.vue | 11 +- client/components/common/user-search.vue | 102 +++-- client/graph/admin-groups-mutation-assign.gql | 12 + .../graph/admin-groups-mutation-unassign.gql | 12 + client/graph/admin-groups-mutation-update.gql | 12 + client/graph/common-users-query-search.gql | 1 + package.json | 48 +- server/graph/resolvers/group.js | 57 +-- server/graph/resolvers/user.js | 43 +- server/graph/schemas/common.graphql | 51 --- server/graph/schemas/group.graphql | 2 +- server/graph/schemas/user.graphql | 101 +++++ yarn.lock | 410 ++++++++++++------ 17 files changed, 697 insertions(+), 300 deletions(-) create mode 100644 client/graph/admin-groups-mutation-assign.gql create mode 100644 client/graph/admin-groups-mutation-unassign.gql create mode 100644 client/graph/admin-groups-mutation-update.gql create mode 100644 server/graph/schemas/user.graphql diff --git a/client/components/admin/admin-general.vue b/client/components/admin/admin-general.vue index edce16df..50a35f36 100644 --- a/client/components/admin/admin-general.vue +++ b/client/components/admin/admin-general.vue @@ -21,15 +21,20 @@ v-text-field(label='Site Description', :counter='255', prepend-icon='public') v-text-field(label='Site Keywords', :counter='255', prepend-icon='public') v-select(label='Meta Robots', chips, tags, :items='metaRobots', v-model='metaRobotsSelection', prepend-icon='public') - v-divider - .px-3.pb-3 - v-btn(color='primary') Save + v-divider.my-0 + v-card-actions.grey.lighten-4 + v-spacer + v-btn(color='primary') + v-icon(left) chevron_right + span Save v-flex(lg6 xs12) v-card v-toolbar(color='primary', dark, dense, flat) v-toolbar-title .subheading Site Branding - v-card-text --- + v-card-text + v-text-field(label='Logo', prepend-icon='image') + v-divider diff --git a/client/components/admin/admin-groups-edit.vue b/client/components/admin/admin-groups-edit.vue index 83ed5f9c..13f4eefb 100644 --- a/client/components/admin/admin-groups-edit.vue +++ b/client/components/admin/admin-groups-edit.vue @@ -2,7 +2,7 @@ v-card v-card(flat, color='grey lighten-5').pa-3.pt-4 .headline.blue--text.text--darken-2 Edit Group - .subheading.grey--text {{group.name}} + .subheading.grey--text {{name}} v-btn(color='primary', fab, absolute, bottom, right, small, to='/groups'): v-icon arrow_upward v-tabs(v-model='tab', color='grey lighten-4', fixed-tabs, slider-color='primary', show-arrows) v-tab(key='properties') Properties @@ -12,9 +12,9 @@ v-tab-item(key='properties', :transition='false', :reverse-transition='false') v-card v-card-text - v-text-field(v-model='group.name', label='Group Name', counter='255', prepend-icon='people') + v-text-field(v-model='name', label='Group Name', counter='255', prepend-icon='people') v-card-actions.pa-3 - v-btn(color='primary', @click='') + v-btn(color='primary', @click='updateGroup') v-icon(left) check | Save Changes .caption.ml-4.grey--text ID: {{group.id}} @@ -25,7 +25,7 @@ | Delete Group v-card .dialog-header.is-red Delete Group? - v-card-text Are you sure you want to delete group #[strong {{ group.name }}]? All users will be unassigned from this group. + v-card-text Are you sure you want to delete group #[strong {{ name }}]? All users will be unassigned from this group. v-card-actions v-spacer v-btn(flat, @click='deleteGroupDialog = false') Cancel @@ -78,7 +78,7 @@ v-tab-item(key='users', :transition='false', :reverse-transition='false') v-card v-card-title.pb-0 - v-btn(color='primary', @click='assignUser') + v-btn(color='primary', @click='searchUserDialog = true') v-icon(left) assignment_ind | Assign User v-data-table( @@ -98,7 +98,7 @@ v-menu(bottom, right, min-width='200') v-btn(icon, slot='activator'): v-icon.grey--text.text--darken-1 more_horiz v-list - v-list-tile(@click='deleteGroupConfirm(props.item)') + v-list-tile(@click='unassignUser(props.item.id)') v-list-tile-action: v-icon(color='orange') highlight_off v-list-tile-content v-list-tile-title Unassign @@ -107,7 +107,7 @@ .text-xs-center.py-2(v-if='users.length > 15') v-pagination(v-model='pagination.page', :length='pages') - user-search(v-model='searchUserDialog') + user-search(v-model='searchUserDialog', @select='assignUser') - - diff --git a/client/components/admin/admin-theme.vue b/client/components/admin/admin-theme.vue index d5609397..3bfaaa69 100644 --- a/client/components/admin/admin-theme.vue +++ b/client/components/admin/admin-theme.vue @@ -8,7 +8,7 @@ v-layout(row wrap) v-flex(lg6 xs12) v-card - v-toolbar(color='grey darken-3', dark, dense, flat) + v-toolbar(color='primary', dark, dense, flat) v-toolbar-title .subheading Theme v-card-text @@ -21,9 +21,12 @@ v-list-tile-sub-title(v-html='data.item.author') v-divider v-switch(v-model='darkMode', label='Dark Mode', color='primary', persistent-hint, hint='Not recommended for accessibility.') - v-divider - .px-3.pb-3 - v-btn(color='primary') Save + v-divider.my-0 + v-card-actions.grey.lighten-4 + v-spacer + v-btn(color='primary', :loading='loading', @click='save') + v-icon(left) chevron_right + span Save v-flex(lg6 xs12) v-card v-toolbar(color='teal', dark, dense, flat) diff --git a/client/components/common/user-search.vue b/client/components/common/user-search.vue index f2d61d5e..1a952208 100644 --- a/client/components/common/user-search.vue +++ b/client/components/common/user-search.vue @@ -1,38 +1,66 @@