BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
milestones_helper.rb
app/helpers/milestones_helper.rb
+11
-0
_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
...
@@ -47,6 +47,17 @@ module MilestonesHelper
}
}
end
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
)
def
milestone_progress_bar
(
milestone
)
options
=
{
options
=
{
class:
'progress-bar progress-bar-success'
,
class:
'progress-bar progress-bar-success'
,
...
...
app/views/shared/_milestones_filter.html.haml
View file @
894bd04d
...
@@ -2,17 +2,17 @@
...
@@ -2,17 +2,17 @@
-
counts
=
milestone_counts
(
@project
.
milestones
)
-
counts
=
milestone_counts
(
@project
.
milestones
)
%ul
.nav-links
%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
=
link_to
milestones_filter_path
(
state:
'opened'
)
do
Open
Open
-
if
@project
-
if
@project
%span
.badge
#{
counts
[
:opened
]
}
%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
=
link_to
milestones_filter_path
(
state:
'closed'
)
do
Closed
Closed
-
if
@project
-
if
@project
%span
.badge
#{
counts
[
:closed
]
}
%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
=
link_to
milestones_filter_path
(
state:
'all'
)
do
All
All
-
if
@project
-
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