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
733ae587
Commit
733ae587
authored
Mar 18, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dedupe labels in labels selector in Dashboard pages
Also moved useless helper methods and directly to the DashboardController.
parent
c7901078
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
23 deletions
+9
-23
dashboard_controller.rb
app/controllers/dashboard_controller.rb
+9
-2
labels_helper.rb
app/helpers/labels_helper.rb
+0
-8
milestones_helper.rb
app/helpers/milestones_helper.rb
+0
-13
No files found.
app/controllers/dashboard_controller.rb
View file @
733ae587
...
...
@@ -21,17 +21,24 @@ class DashboardController < Dashboard::ApplicationController
end
def
labels
labels
=
Label
.
where
(
project_id:
@projects
).
select
(
:title
,
:color
).
uniq
(
:title
)
respond_to
do
|
format
|
format
.
json
do
render
json:
view_context
.
projects_labels_option
s
render
json:
label
s
end
end
end
def
milestones
milestones
=
Milestone
.
where
(
project_id:
@projects
).
active
epoch
=
DateTime
.
parse
(
'1970-01-01'
)
grouped_milestones
=
GlobalMilestone
.
build_collection
(
milestones
)
grouped_milestones
=
grouped_milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
respond_to
do
|
format
|
format
.
json
do
render
json:
view_context
.
projects_milestones_option
s
render
json:
grouped_milestone
s
end
end
end
...
...
app/helpers/labels_helper.rb
View file @
733ae587
...
...
@@ -109,14 +109,6 @@ module LabelsHelper
end
end
def
projects_labels_options
if
@project
@project
.
labels
else
Label
.
where
(
project_id:
@projects
)
end
end
def
labels_filter_path
if
@project
namespace_project_labels_path
(
@project
.
namespace
,
@project
,
:json
)
...
...
app/helpers/milestones_helper.rb
View file @
733ae587
...
...
@@ -46,19 +46,6 @@ module MilestonesHelper
end
end
def
projects_milestones_options
milestones
=
if
@project
@project
.
milestones
else
Milestone
.
where
(
project_id:
@projects
)
end
.
active
epoch
=
DateTime
.
parse
(
'1970-01-01'
)
grouped_milestones
=
GlobalMilestone
.
build_collection
(
milestones
)
grouped_milestones
.
sort_by
{
|
x
|
x
.
due_date
.
nil?
?
epoch
:
x
.
due_date
}
end
def
milestones_filter_dropdown_path
if
@project
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
)
...
...
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