summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDominik Sander <git@dsander.de>2015-04-30 23:29:00 +0200
committerDominik Sander <git@dsander.de>2015-05-01 01:12:58 +0200
commite6ee8d0ebebc217e247558507eac619931a47121 (patch)
tree5b313baddb457928d5fdc23136b86761c87fea34 /app
parent8d17e79d1dfc8fb415b3fe4dbabd11659fa6c42e (diff)
downloadgitlab-ce-e6ee8d0ebebc217e247558507eac619931a47121.tar.gz
Group milestones by title in the dashboard and all other issue views
This groups milestones by title for issue views like it has been done for the milestone dashboard/project overview. Before milestones with the same title would show up multiple times in the filter dropdown and one could only filter per project and milestone. Now the milestone filter is based on the title of the milestone, i.e. all issues marked with the same milestone title are shown.
Diffstat (limited to 'app')
-rw-r--r--app/finders/issuable_finder.rb5
-rw-r--r--app/helpers/milestones_helper.rb3
-rw-r--r--app/views/shared/_issuable_filter.html.haml4
3 files changed, 7 insertions, 5 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index 2c0702073d4..b8f367c6339 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -113,8 +113,9 @@ class IssuableFinder
end
def by_milestone(items)
- if params[:milestone_id].present?
- items = items.where(milestone_id: (params[:milestone_id] == NONE ? nil : params[:milestone_id]))
+ if params[:milestone_title].present?
+ milestone_ids = (params[:milestone_title] == NONE ? nil : Milestone.where(title: params[:milestone_title]).pluck(:id))
+ items = items.where(milestone_id: milestone_ids)
end
items
diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb
index 282bdf744d2..93e33ebefd8 100644
--- a/app/helpers/milestones_helper.rb
+++ b/app/helpers/milestones_helper.rb
@@ -28,6 +28,7 @@ module MilestonesHelper
Milestone.where(project_id: @projects)
end.active
- options_from_collection_for_select(milestones, 'id', 'title', params[:milestone_id])
+ grouped_milestones = Milestones::GroupService.new(milestones).execute
+ options_from_collection_for_select(grouped_milestones, 'title', 'title', params[:milestone_title])
end
end
diff --git a/app/views/shared/_issuable_filter.html.haml b/app/views/shared/_issuable_filter.html.haml
index f9eb2dcfa28..fa8b4eae314 100644
--- a/app/views/shared/_issuable_filter.html.haml
+++ b/app/views/shared/_issuable_filter.html.haml
@@ -15,7 +15,7 @@
#{state_filters_text_for(:all, @project)}
.issues-details-filters
- = form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_id, :label_name]), method: :get, class: 'filter-form' do
+ = form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_title, :label_name]), method: :get, class: 'filter-form' do
- if controller.controller_name == 'issues'
.check-all-holder
= check_box_tag "check_all_issues", nil, false,
@@ -31,7 +31,7 @@
placeholder: 'Author', class: 'trigger-submit', any_user: true, first_user: true)
.filter-item.inline.milestone-filter
- = select_tag('milestone_id', projects_milestones_options, class: "select2 trigger-submit", prompt: 'Milestone')
+ = select_tag('milestone_title', projects_milestones_options, class: "select2 trigger-submit", prompt: 'Milestone')
- if @project
.filter-item.inline.labels-filter