Commit feee3838e14c90bc73b97cfa8be3760e52605531

Authored by Robert Speicher
1 parent 5a90d044

Combine unassigned_issue and unassigned_milestone into unassigned_filter

app/helpers/issues_helper.rb
@@ -37,13 +37,10 @@ module IssuesHelper @@ -37,13 +37,10 @@ module IssuesHelper
37 @project.issues.tag_counts_on(:labels).map(&:name) 37 @project.issues.tag_counts_on(:labels).map(&:name)
38 end 38 end
39 39
40 - # Returns a fake Milestone-like object that can be used in a  
41 - # <tt>select_tag</tt> to allow filtering by issues with no assigned milestone  
42 - def unassigned_milestone  
43 - OpenStruct.new(id: 0, title: 'Unspecified')  
44 - end  
45 -  
46 - def unassigned_issue  
47 - OpenStruct.new(id: 0, name: 'Unassigned') 40 + # Returns an OpenStruct object suitable for use by <tt>options_from_collection_for_select</tt>
  41 + # to allow filtering issues by an unassigned User or Milestone
  42 + def unassigned_filter
  43 + # Milestone uses :title, Issue uses :name
  44 + OpenStruct.new(id: 0, title: 'Unspecified', name: 'Unassigned')
48 end 45 end
49 end 46 end
app/views/issues/index.html.haml
@@ -49,8 +49,8 @@ @@ -49,8 +49,8 @@
49 .right 49 .right
50 = form_tag project_issues_path(@project), method: :get, class: :right do 50 = form_tag project_issues_path(@project), method: :get, class: :right do
51 = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels") 51 = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels")
52 - = select_tag(:assignee_id, options_from_collection_for_select([unassigned_issue] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")  
53 - = select_tag(:milestone_id, options_from_collection_for_select([unassigned_milestone] + @project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone") 52 + = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
  53 + = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + @project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone")
54 = hidden_field_tag :f, params[:f] 54 = hidden_field_tag :f, params[:f]
55 .clearfix 55 .clearfix
56 56