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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
caad256c
Commit
caad256c
authored
Jul 04, 2018
by
Jarka Kadlecová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move group_dropdown_label to ce helper
parent
70ff7613
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
13 deletions
+34
-13
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+13
-0
ee/app/helpers/ee/issuables_helper.rb
ee/app/helpers/ee/issuables_helper.rb
+0
-13
spec/helpers/issuables_helper_spec.rb
spec/helpers/issuables_helper_spec.rb
+21
-0
No files found.
app/helpers/issuables_helper.rb
View file @
caad256c
...
...
@@ -133,6 +133,19 @@ module IssuablesHelper
end
end
def
group_dropdown_label
(
group_id
,
default_label
)
return
default_label
if
group_id
.
nil?
return
"Any group"
if
group_id
==
"0"
group
=
::
Group
.
find_by
(
id:
group_id
)
if
group
group
.
full_name
else
default_label
end
end
def
milestone_dropdown_label
(
milestone_title
,
default_label
=
"Milestone"
)
title
=
case
milestone_title
...
...
ee/app/helpers/ee/issuables_helper.rb
View file @
caad256c
...
...
@@ -9,18 +9,5 @@ module EE
weightNoneValue:
::
Issue
::
WEIGHT_NONE
)
end
def
group_dropdown_label
(
group_id
,
default_label
)
return
default_label
if
group_id
.
nil?
return
"Any group"
if
group_id
==
"0"
group
=
::
Group
.
find_by
(
id:
group_id
)
if
group
group
.
full_name
else
default_label
end
end
end
end
spec/helpers/issuables_helper_spec.rb
View file @
caad256c
...
...
@@ -21,6 +21,27 @@ describe IssuablesHelper do
end
end
describe
'#group_dropdown_label'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:default
)
{
'default label'
}
it
'returns default group label when group_id is nil'
do
expect
(
group_dropdown_label
(
nil
,
default
)).
to
eq
(
'default label'
)
end
it
'returns "any group" when group_id is 0'
do
expect
(
group_dropdown_label
(
'0'
,
default
)).
to
eq
(
'Any group'
)
end
it
'returns group full path when a group was found for the provided id'
do
expect
(
group_dropdown_label
(
group
.
id
,
default
)).
to
eq
(
group
.
full_name
)
end
it
'returns default label when a group was not found for the provided id'
do
expect
(
group_dropdown_label
(
9999
,
default
)).
to
eq
(
'default label'
)
end
end
describe
'#issuable_labels_tooltip'
do
it
'returns label text with no labels'
do
expect
(
issuable_labels_tooltip
([])).
to
eq
(
"Labels"
)
...
...
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