Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
88b60cf6
Commit
88b60cf6
authored
May 30, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle leave group action
parent
184e67da
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
3 deletions
+33
-3
app/assets/javascripts/groups/components/group_item.vue
app/assets/javascripts/groups/components/group_item.vue
+15
-2
app/assets/javascripts/groups/index.js
app/assets/javascripts/groups/index.js
+11
-1
app/assets/javascripts/groups/services/groups_service.js
app/assets/javascripts/groups/services/groups_service.js
+5
-0
app/assets/javascripts/groups/stores/groups_store.js
app/assets/javascripts/groups/stores/groups_store.js
+2
-0
No files found.
app/assets/javascripts/groups/components/group_item.vue
View file @
88b60cf6
...
@@ -20,6 +20,16 @@ export default {
...
@@ -20,6 +20,16 @@ export default {
return
eventHub
.
$emit
(
'
toggleSubGroups
'
,
this
.
group
);
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
:
{
computed
:
{
groupDomId
()
{
groupDomId
()
{
...
@@ -73,10 +83,13 @@ export default {
...
@@ -73,10 +83,13 @@ export default {
:class=
"rowClass"
:class=
"rowClass"
>
>
<div
class=
"controls"
>
<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>
<i
aria-hidden=
"true"
class=
"fa fa-cogs"
></i>
</a>
</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>
<i
aria-hidden=
"true"
class=
"fa fa-sign-out"
></i>
</a>
</a>
</div>
</div>
...
...
app/assets/javascripts/groups/index.js
View file @
88b60cf6
...
@@ -52,7 +52,7 @@ $(() => {
...
@@ -52,7 +52,7 @@ $(() => {
store
.
setGroups
(
response
.
json
(),
parentGroup
);
store
.
setGroups
(
response
.
json
(),
parentGroup
);
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
// TODO: Handle
r
error
// TODO: Handle error
});
});
return
getGroups
;
return
getGroups
;
...
@@ -65,6 +65,15 @@ $(() => {
...
@@ -65,6 +65,15 @@ $(() => {
GroupsStore
.
toggleSubGroups
(
parentGroup
);
GroupsStore
.
toggleSubGroups
(
parentGroup
);
},
},
leaveGroup
(
endpoint
)
{
service
.
leaveGroup
(
endpoint
)
.
then
(()
=>
{
// TODO: Refresh?
})
.
catch
(()
=>
{
// TODO: Handle error
});
},
},
},
created
()
{
created
()
{
let
groupFilterList
=
null
;
let
groupFilterList
=
null
;
...
@@ -81,6 +90,7 @@ $(() => {
...
@@ -81,6 +90,7 @@ $(() => {
});
});
eventHub
.
$on
(
'
toggleSubGroups
'
,
this
.
toggleSubGroups
);
eventHub
.
$on
(
'
toggleSubGroups
'
,
this
.
toggleSubGroups
);
eventHub
.
$on
(
'
leaveGroup
'
,
this
.
leaveGroup
);
},
},
});
});
});
});
app/assets/javascripts/groups/services/groups_service.js
View file @
88b60cf6
...
@@ -6,6 +6,7 @@ Vue.use(VueResource);
...
@@ -6,6 +6,7 @@ Vue.use(VueResource);
export
default
class
GroupsService
{
export
default
class
GroupsService
{
constructor
(
endpoint
)
{
constructor
(
endpoint
)
{
this
.
groups
=
Vue
.
resource
(
endpoint
);
this
.
groups
=
Vue
.
resource
(
endpoint
);
this
.
groups
=
Vue
.
resource
(
endpoint
);
}
}
getGroups
(
parentId
,
page
)
{
getGroups
(
parentId
,
page
)
{
...
@@ -20,4 +21,8 @@ export default class GroupsService {
...
@@ -20,4 +21,8 @@ export default class GroupsService {
return
this
.
groups
.
get
(
data
);
return
this
.
groups
.
get
(
data
);
}
}
leaveGroup
(
endpoint
)
{
return
Vue
.
http
.
delete
(
endpoint
);
}
}
}
app/assets/javascripts/groups/stores/groups_store.js
View file @
88b60cf6
...
@@ -121,6 +121,8 @@ export default class GroupsStore {
...
@@ -121,6 +121,8 @@ export default class GroupsStore {
webUrl
:
rawGroup
.
web_url
,
webUrl
:
rawGroup
.
web_url
,
parentId
:
rawGroup
.
parent_id
,
parentId
:
rawGroup
.
parent_id
,
visibility
:
rawGroup
.
visibility
,
visibility
:
rawGroup
.
visibility
,
leavePath
:
rawGroup
.
leave_path
,
editPath
:
rawGroup
.
edit_path
,
isOpen
:
false
,
isOpen
:
false
,
isOrphan
:
false
,
isOrphan
:
false
,
numberProjects
:
10
,
numberProjects
:
10
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment