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
Jérome Perrin
gitlab-ce
Commits
eeb957ec
Commit
eeb957ec
authored
Mar 08, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `isProject` and computed props to for contextual info for dropdown
parent
a831267c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
+50
-0
app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue
...ipts/vue_shared/components/sidebar/labels_select/base.vue
+24
-0
spec/javascripts/vue_shared/components/sidebar/labels_select/base_spec.js
.../vue_shared/components/sidebar/labels_select/base_spec.js
+26
-0
No files found.
app/assets/javascripts/vue_shared/components/sidebar/labels_select/base.vue
View file @
eeb957ec
<
script
>
import
{
__
}
from
'
~/locale
'
;
import
LabelsSelect
from
'
~/labels_select
'
;
import
LoadingIcon
from
'
../../loading_icon.vue
'
;
...
...
@@ -31,6 +32,11 @@ export default {
required
:
false
,
default
:
false
,
},
isProject
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
abilityName
:
{
type
:
String
,
required
:
true
,
...
...
@@ -73,6 +79,20 @@ export default {
hiddenInputName
()
{
return
this
.
showCreate
?
`
${
this
.
abilityName
}
[label_names][]`
:
'
label_id[]
'
;
},
createLabelTitle
()
{
if
(
this
.
isProject
)
{
return
__
(
'
Create project label
'
);
}
return
__
(
'
Create group label
'
);
},
manageLabelsTitle
()
{
if
(
this
.
isProject
)
{
return
__
(
'
Manage project labels
'
);
}
return
__
(
'
Manage group labels
'
);
},
},
mounted
()
{
this
.
labelsDropdown
=
new
LabelsSelect
(
this
.
$refs
.
dropdownButton
,
{
...
...
@@ -137,10 +157,14 @@ dropdown-menu-labels dropdown-menu-selectable"
<dropdown-footer
v-if=
"showCreate"
:labels-web-url=
"labelsWebUrl"
:create-label-title=
"createLabelTitle"
:manage-labels-title=
"manageLabelsTitle"
/>
</div>
<dropdown-create-label
v-if=
"showCreate"
:is-project=
"isProject"
:header-title=
"createLabelTitle"
/>
</div>
</div>
...
...
spec/javascripts/vue_shared/components/sidebar/labels_select/base_spec.js
View file @
eeb957ec
...
...
@@ -37,6 +37,32 @@ describe('BaseComponent', () => {
vmNonEditable
.
$destroy
();
});
});
describe
(
'
createLabelTitle
'
,
()
=>
{
it
(
'
returns `Create project label` when `isProject` prop is true
'
,
()
=>
{
expect
(
vm
.
createLabelTitle
).
toBe
(
'
Create project label
'
);
});
it
(
'
return `Create group label` when `isProject` prop is false
'
,
()
=>
{
const
mockConfigGroup
=
Object
.
assign
({},
mockConfig
,
{
isProject
:
false
});
const
vmGroup
=
createComponent
(
mockConfigGroup
);
expect
(
vmGroup
.
createLabelTitle
).
toBe
(
'
Create group label
'
);
vmGroup
.
$destroy
();
});
});
describe
(
'
manageLabelsTitle
'
,
()
=>
{
it
(
'
returns `Manage project labels` when `isProject` prop is true
'
,
()
=>
{
expect
(
vm
.
manageLabelsTitle
).
toBe
(
'
Manage project labels
'
);
});
it
(
'
return `Manage group labels` when `isProject` prop is false
'
,
()
=>
{
const
mockConfigGroup
=
Object
.
assign
({},
mockConfig
,
{
isProject
:
false
});
const
vmGroup
=
createComponent
(
mockConfigGroup
);
expect
(
vmGroup
.
manageLabelsTitle
).
toBe
(
'
Manage group labels
'
);
vmGroup
.
$destroy
();
});
});
});
describe
(
'
methods
'
,
()
=>
{
...
...
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