Skip to content
Snippets Groups Projects
Commit 88b60cf6 authored by Alfredo Sumaran's avatar Alfredo Sumaran
Browse files

Handle leave group action

parent 184e67da
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -20,6 +20,16 @@ export default {
 
return eventHub.$emit('toggleSubGroups', this.group);
},
onLeaveGroup(e) {
e.preventDefault();
if (confirm(`Are you sure you want to leave the "${this.group.fullName}" group?`)) {
this.leaveGroup();
}
},
leaveGroup() {
eventHub.$emit('leaveGroup', this.group.leavePath);
}
},
computed: {
groupDomId() {
Loading
Loading
@@ -73,10 +83,13 @@ export default {
:class="rowClass"
>
<div class="controls">
<a class="edit-group btn" href="#edit">
<a class="edit-group btn" :href="group.editPath">
<i aria-hidden="true" class="fa fa-cogs"></i>
</a>
<a class="leave-group btn" title="Leave this group" href="#leave">
<a @click="onLeaveGroup"
:href="group.leavePath"
class="leave-group btn"
title="Leave this group">
<i aria-hidden="true" class="fa fa-sign-out"></i>
</a>
</div>
Loading
Loading
Loading
Loading
@@ -52,7 +52,7 @@ $(() => {
store.setGroups(response.json(), parentGroup);
})
.catch(() => {
// TODO: Handler error
// TODO: Handle error
});
 
return getGroups;
Loading
Loading
@@ -65,6 +65,15 @@ $(() => {
 
GroupsStore.toggleSubGroups(parentGroup);
},
leaveGroup(endpoint) {
service.leaveGroup(endpoint)
.then(() => {
// TODO: Refresh?
})
.catch(() => {
// TODO: Handle error
});
},
},
created() {
let groupFilterList = null;
Loading
Loading
@@ -81,6 +90,7 @@ $(() => {
});
 
eventHub.$on('toggleSubGroups', this.toggleSubGroups);
eventHub.$on('leaveGroup', this.leaveGroup);
},
});
});
Loading
Loading
@@ -6,6 +6,7 @@ Vue.use(VueResource);
export default class GroupsService {
constructor(endpoint) {
this.groups = Vue.resource(endpoint);
this.groups = Vue.resource(endpoint);
}
 
getGroups(parentId, page) {
Loading
Loading
@@ -20,4 +21,8 @@ export default class GroupsService {
 
return this.groups.get(data);
}
leaveGroup(endpoint) {
return Vue.http.delete(endpoint);
}
}
Loading
Loading
@@ -121,6 +121,8 @@ export default class GroupsStore {
webUrl: rawGroup.web_url,
parentId: rawGroup.parent_id,
visibility: rawGroup.visibility,
leavePath: rawGroup.leave_path,
editPath: rawGroup.edit_path,
isOpen: false,
isOrphan: false,
numberProjects: 10,
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment