From b42f71a39af1b310cd256fafabae862159910448 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 18 Sep 2018 18:49:44 +0200 Subject: [PATCH] Moved handling of user sharing to a component --- src/components/lists/EditList.vue | 148 ++---------------------- src/components/sharing/user.vue | 184 ++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+), 140 deletions(-) create mode 100644 src/components/sharing/user.vue diff --git a/src/components/lists/EditList.vue b/src/components/lists/EditList.vue index 7ff6134e2..d6af8e99d 100644 --- a/src/components/lists/EditList.vue +++ b/src/components/lists/EditList.vue @@ -41,82 +41,7 @@ -
- -
-

- Users with access to this list -

-
-
-
-
-

- - - - -

-

- -

-
-
- - - - - - - - - -
{{u.username}} - - - - - - - - -
-
-
+
@@ -202,16 +127,6 @@
This includes all tasks and CANNOT BE UNDONE!

- - - Remove a user from the list -

Are you sure you want to remove this user from the list?
- This CANNOT BE UNDONE!

-
- { - response.data.push(this.list.owner) - this.$set(this, 'listUsers', response.data) - this.loading = false - }) - .catch(e => { - this.handleError(e) - }) - }, - deleteUser() { - HTTP.delete(`lists/` + this.$route.params.id + `/users/` + this.userToDelete, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}}) - .then(() => { - this.showUserDeleteModal = false; - this.handleSuccess({message: 'The user was successfully deleted from the list.'}) - this.loadUsers() - }) - .catch(e => { - this.handleError(e) - }) - }, - addUser(admin) { - if(admin === null) { - admin = false - } - this.newUser.right = 0 - if (admin) { - this.newUser.right = 2 - } - - HTTP.put(`lists/` + this.$route.params.id + `/users`, this.newUser, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}}) - .then(() => { - this.loadUsers() - this.handleSuccess({message: 'The user was successfully added.'}) - }) - .catch(e => { - this.handleError(e) - }) - }, - toggleUserType(userid, current) { - this.userToDelete = userid - this.newUser.user_id = userid - this.deleteUser() - this.addUser(!current) - }, loadTeams() { HTTP.get(`lists/` + this.$route.params.id + `/teams`, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}}) .then(response => { diff --git a/src/components/sharing/user.vue b/src/components/sharing/user.vue new file mode 100644 index 000000000..6f21f1a17 --- /dev/null +++ b/src/components/sharing/user.vue @@ -0,0 +1,184 @@ + + + + + \ No newline at end of file