diff --git a/src/components/lists/EditList.vue b/src/components/lists/EditList.vue
index d6af8e99..72c08ae3 100644
--- a/src/components/lists/EditList.vue
+++ b/src/components/lists/EditList.vue
@@ -43,81 +43,8 @@
-
+
-
-
-
-
-
-
-
-
- {{t.name}}
-
- |
-
-
-
-
-
- Admin
-
-
-
-
-
- Write
-
-
-
-
-
- Read-only
-
- |
-
-
-
- |
-
-
-
-
-
Are you sure you want to delete this list and all of its contents?
This includes all tasks and CANNOT BE UNDONE!
-
-
-
- Remove a team from the list
- Are you sure you want to remove this team from the list?
- This CANNOT BE UNDONE!
-
@@ -145,6 +62,7 @@
import {HTTP} from '../../http-common'
import message from '../../message'
import manageusers from '../sharing/user'
+ import manageteams from '../sharing/team'
export default {
name: "EditList",
@@ -156,15 +74,11 @@
showDeleteModal: false,
user: auth.user,
userIsAdmin: false,
-
- listTeams: [],
- newTeam: {team_id: 0},
- showTeamDeleteModal: false,
- teamToDelete: 0,
}
},
components: {
- manageusers
+ manageusers,
+ manageteams,
},
beforeMount() {
// Check if the user is already logged in, if so, redirect him to the homepage
@@ -191,7 +105,6 @@
if (response.data.owner.id === this.user.infos.id) {
this.userIsAdmin = true
}
- this.loadTeams()
this.loading = false
})
.catch(e => {
@@ -228,51 +141,6 @@
this.handleError(e)
})
},
- loadTeams() {
- HTTP.get(`lists/` + this.$route.params.id + `/teams`, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}})
- .then(response => {
- this.$set(this, 'listTeams', response.data)
- this.loading = false
- })
- .catch(e => {
- this.handleError(e)
- })
- },
- deleteTeam() {
- HTTP.delete(`lists/` + this.$route.params.id + `/teams/` + this.teamToDelete, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}})
- .then(() => {
- this.showTeamDeleteModal = false;
- this.handleSuccess({message: 'The team was successfully deleted from the list.'})
- this.loadTeams()
- })
- .catch(e => {
- this.handleError(e)
- })
- },
- addTeam(admin) {
- if(admin === null) {
- admin = false
- }
- this.newTeam.right = 0
- if (admin) {
- this.newTeam.right = 2
- }
-
- HTTP.put(`lists/` + this.$route.params.id + `/teams`, this.newTeam, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}})
- .then(() => {
- this.loadTeams()
- this.handleSuccess({message: 'The team was successfully added.'})
- })
- .catch(e => {
- this.handleError(e)
- })
- },
- toggleTeamType(teamid, current) {
- this.teamToDelete = teamid
- this.newTeam.team_id = teamid
- this.deleteTeam()
- this.addTeam(!current)
- },
handleError(e) {
this.loading = false
message.error(e, this)
diff --git a/src/components/sharing/team.vue b/src/components/sharing/team.vue
new file mode 100644
index 00000000..3e3d7c0b
--- /dev/null
+++ b/src/components/sharing/team.vue
@@ -0,0 +1,208 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{t.name}}
+
+ |
+
+
+
+
+
+ Admin
+
+
+
+
+
+ Write
+
+
+
+
+
+ Read-only
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+ Remove a team from the {{typeString}}
+ Are you sure you want to remove this team from the {{typeString}}?
+ This CANNOT BE UNDONE!
+
+
+
+
+
+
+
\ No newline at end of file