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
26573605
Commit
26573605
authored
May 04, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GroupsService to fetch data from server
parent
d67ab685
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
app/assets/javascripts/groups/index.js
app/assets/javascripts/groups/index.js
+16
-1
app/assets/javascripts/groups/services/groups_service.js
app/assets/javascripts/groups/services/groups_service.js
+14
-0
app/views/dashboard/groups/_groups.html.haml
app/views/dashboard/groups/_groups.html.haml
+1
-1
No files found.
app/assets/javascripts/groups/index.js
View file @
26573605
/* eslint-disable no-unused-vars */
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
GroupsStore
from
'
./stores/groups_store
'
;
import
GroupsStore
from
'
./stores/groups_store
'
;
import
GroupsService
from
'
./services/groups_service
'
;
$
(()
=>
{
$
(()
=>
{
const
appEl
=
document
.
querySelector
(
'
.js-groups-list-holder
'
);
const
groupsStore
=
new
GroupsStore
();
const
groupsStore
=
new
GroupsStore
();
const
groupsService
=
new
GroupsService
(
appEl
.
dataset
.
endpoint
);
const
GroupsApp
=
new
Vue
({
const
GroupsApp
=
new
Vue
({
el
:
document
.
querySelector
(
'
.js-groups-list-holder
'
)
,
el
:
appEl
,
data
:
groupsStore
,
data
:
groupsStore
,
mounted
()
{
groupsService
.
getGroups
()
.
then
((
response
)
=>
{
this
.
groups
=
response
.
json
();
})
.
catch
(()
=>
{
// TODO: Handle error
});
},
});
});
});
});
app/assets/javascripts/groups/services/groups_service.js
0 → 100644
View file @
26573605
import
Vue
from
'
vue
'
;
import
VueResource
from
'
vue-resource
'
;
Vue
.
use
(
VueResource
);
export
default
class
GroupsService
{
constructor
(
endpoint
)
{
this
.
groups
=
Vue
.
resource
(
endpoint
);
}
getGroups
()
{
return
this
.
groups
.
get
();
}
}
app/views/dashboard/groups/_groups.html.haml
View file @
26573605
.js-groups-list-holder
.js-groups-list-holder
{
data:
{
endpoint:
dashboard_groups_path
(
format: :json
)
}
}
%ul
.content-list
%ul
.content-list
-
@groups
.
each
do
|
group
|
-
@groups
.
each
do
|
group
|
-
group_member
=
group
.
group_members
.
find_by
(
user_id:
current_user
)
-
group_member
=
group
.
group_members
.
find_by
(
user_id:
current_user
)
...
...
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