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
4b488d72
Commit
4b488d72
authored
May 08, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare groups components for subgroups
parent
5e0e3971
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
15 deletions
+68
-15
app/assets/javascripts/groups/components/group_item.vue
app/assets/javascripts/groups/components/group_item.vue
+30
-9
app/assets/javascripts/groups/components/groups.vue
app/assets/javascripts/groups/components/groups.vue
+15
-3
app/assets/javascripts/groups/event_hub.js
app/assets/javascripts/groups/event_hub.js
+3
-0
app/assets/javascripts/groups/index.js
app/assets/javascripts/groups/index.js
+2
-2
app/assets/javascripts/groups/stores/groups_store.js
app/assets/javascripts/groups/stores/groups_store.js
+18
-1
No files found.
app/assets/javascripts/groups/components/group_item.vue
View file @
4b488d72
<
script
>
<
script
>
import
eventHub
from
'
../event_hub
'
;
export
default
{
export
default
{
props
:
{
props
:
{
group
:
{
group
:
{
type
:
Object
,
type
:
Object
,
required
:
true
,
required
:
true
,
}
},
}
},
methods
:
{
toggleSubGroups
()
{
eventHub
.
$emit
(
'
toggleSubGroups
'
,
this
.
group
);
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<tr>
<tr
@
click=
"toggleSubGroups"
>
<td>
<template
>
<div>
<td>
<a
:href=
"group.web_url"
>
{{
group
.
full_name
}}
</a>
<span>
</div>
<i
<div>
{{
group
.
description
}}
</div>
v-show=
"group.isOpen"
</td>
class=
"fa fa-caret-down"
aria-hidden=
"true"
/>
<i
v-show=
"!group.isOpen"
class=
"fa fa-caret-right"
aria-hidden=
"true"
/>
</span>
</td>
<td>
<div>
<a
:href=
"group.web_url"
>
{{
group
.
full_name
}}
</a>
</div>
<div>
{{
group
.
description
}}
</div>
</td>
</
template
>
</tr>
</tr>
</template>
</template>
app/assets/javascripts/groups/components/groups.vue
View file @
4b488d72
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
GroupsStore
from
'
../stores/groups_store
'
;
import
GroupsStore
from
'
../stores/groups_store
'
;
import
GroupsService
from
'
../services/groups_service
'
;
import
GroupsService
from
'
../services/groups_service
'
;
import
GroupItem
from
'
../components/group_item.vue
'
;
import
GroupItem
from
'
../components/group_item.vue
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -14,7 +15,7 @@ export default {
...
@@ -14,7 +15,7 @@ export default {
return
{
return
{
store
,
store
,
state
:
store
.
state
,
state
:
store
.
state
,
}
}
;
},
},
created
()
{
created
()
{
...
@@ -22,6 +23,8 @@ export default {
...
@@ -22,6 +23,8 @@ export default {
this
.
service
=
new
GroupsService
(
appEl
.
dataset
.
endpoint
);
this
.
service
=
new
GroupsService
(
appEl
.
dataset
.
endpoint
);
this
.
fetchGroups
();
this
.
fetchGroups
();
eventHub
.
$on
(
'
toggleSubGroups
'
,
this
.
toggleSubGroups
);
},
},
methods
:
{
methods
:
{
...
@@ -34,12 +37,21 @@ export default {
...
@@ -34,12 +37,21 @@ export default {
// TODO: Handler error
// TODO: Handler error
});
});
},
},
}
toggleSubGroups
(
group
)
{
GroupsStore
.
toggleSubGroups
(
group
);
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<table
class=
"table table-bordered"
>
<table
class=
"table table-bordered"
>
<group-item
:group=
"group"
v-for=
"group in state.groups"
/>
<template
v-for=
"group in state.groups"
>
<tr
is=
"group-item"
:group=
"group"
/>
<tr
v-if=
"group.isOpen"
>
<td>
sub groups for
{{
group
.
name
}}
</td>
<td></td>
</tr>
</
template
>
</table>
</table>
</template>
</template>
app/assets/javascripts/groups/event_hub.js
0 → 100644
View file @
4b488d72
import
Vue
from
'
vue
'
;
export
default
new
Vue
();
app/assets/javascripts/groups/index.js
View file @
4b488d72
/* eslint-disable no-unused-vars */
/* eslint-disable no-unused-vars */
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
GroupsComponent
from
'
./components/groups.vue
'
import
GroupsComponent
from
'
./components/groups.vue
'
;
$
(()
=>
{
$
(()
=>
{
const
appEl
=
document
.
querySelector
(
'
#dashboard-group-app
'
);
const
appEl
=
document
.
querySelector
(
'
#dashboard-group-app
'
);
...
@@ -9,7 +9,7 @@ $(() => {
...
@@ -9,7 +9,7 @@ $(() => {
const
GroupsApp
=
new
Vue
({
const
GroupsApp
=
new
Vue
({
el
:
appEl
,
el
:
appEl
,
components
:
{
components
:
{
'
groups-component
'
:
GroupsComponent
'
groups-component
'
:
GroupsComponent
,
},
},
render
:
createElement
=>
createElement
(
'
groups-component
'
),
render
:
createElement
=>
createElement
(
'
groups-component
'
),
});
});
...
...
app/assets/javascripts/groups/stores/groups_store.js
View file @
4b488d72
...
@@ -7,8 +7,25 @@ export default class GroupsStore {
...
@@ -7,8 +7,25 @@ export default class GroupsStore {
}
}
setGroups
(
groups
)
{
setGroups
(
groups
)
{
this
.
state
.
groups
=
groups
;
this
.
state
.
groups
=
this
.
decorateGroups
(
groups
)
;
return
groups
;
return
groups
;
}
}
decorateGroups
(
rawGroups
)
{
this
.
groups
=
rawGroups
.
map
(
GroupsStore
.
decorateGroup
);
return
this
.
groups
;
}
static
decorateGroup
(
rawGroup
)
{
const
group
=
rawGroup
;
group
.
isOpen
=
false
;
return
group
;
}
static
toggleSubGroups
(
toggleGroup
)
{
const
group
=
toggleGroup
;
group
.
isOpen
=
!
group
.
isOpen
;
return
group
;
}
}
}
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