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
Léo-Paul Géneau
gitlab-ce
Commits
894bd04d
Commit
894bd04d
authored
Jul 26, 2016
by
Dan Rowden
Committed by
Alfredo Sumaran
Sep 07, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a small helper to reduce logic in the view
parent
db116fa0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
app/helpers/milestones_helper.rb
app/helpers/milestones_helper.rb
+11
-0
app/views/shared/_milestones_filter.html.haml
app/views/shared/_milestones_filter.html.haml
+3
-3
No files found.
app/helpers/milestones_helper.rb
View file @
894bd04d
...
...
@@ -47,6 +47,17 @@ module MilestonesHelper
}
end
# Show 'active' class if provided GET param matches check
# `or_blank` allows the function to return 'active' when given an empty param
# Could be refactored to be simpler but that may make it harder to read
def
milestone_class_for_state
(
param
,
check
,
match_blank_param
=
false
)
if
match_blank_param
'active'
if
param
.
blank?
||
param
==
check
else
'active'
if
param
==
check
end
end
def
milestone_progress_bar
(
milestone
)
options
=
{
class:
'progress-bar progress-bar-success'
,
...
...
app/views/shared/_milestones_filter.html.haml
View file @
894bd04d
...
...
@@ -2,17 +2,17 @@
-
counts
=
milestone_counts
(
@project
.
milestones
)
%ul
.nav-links
%li
{
class:
(
"active"
if
params
[
:state
].
blank?
||
params
[
:state
]
==
'opened'
)}
%li
{
class:
milestone_class_for_state
(
params
[
:state
],
'opened'
,
true
)}
=
link_to
milestones_filter_path
(
state:
'opened'
)
do
Open
-
if
@project
%span
.badge
#{
counts
[
:opened
]
}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'closed'
)}
%li
{
class:
milestone_class_for_state
(
params
[
:state
],
'closed'
)}
=
link_to
milestones_filter_path
(
state:
'closed'
)
do
Closed
-
if
@project
%span
.badge
#{
counts
[
:closed
]
}
%li
{
class:
(
"active"
if
params
[
:state
]
==
'all'
)}
%li
{
class:
milestone_class_for_state
(
params
[
:state
],
'all'
)}
=
link_to
milestones_filter_path
(
state:
'all'
)
do
All
-
if
@project
...
...
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