From feee3838e14c90bc73b97cfa8be3760e52605531 Mon Sep 17 00:00:00 2001
From: Robert Speicher <rspeicher@gmail.com>
Date: Thu, 16 Aug 2012 18:13:22 -0400
Subject: [PATCH] Combine unassigned_issue and unassigned_milestone into
 unassigned_filter

---
 app/helpers/issues_helper.rb     | 13 +++++--------
 app/views/issues/index.html.haml |  4 ++--
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 452611fefbd..d4d6c2d4205 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -37,13 +37,10 @@ module IssuesHelper
     @project.issues.tag_counts_on(:labels).map(&:name)
   end
 
-  # Returns a fake Milestone-like object that can be used in a
-  # <tt>select_tag</tt> to allow filtering by issues with no assigned milestone
-  def unassigned_milestone
-    OpenStruct.new(id: 0, title: 'Unspecified')
-  end
-
-  def unassigned_issue
-    OpenStruct.new(id: 0, name: 'Unassigned')
+  # Returns an OpenStruct object suitable for use by <tt>options_from_collection_for_select</tt>
+  # to allow filtering issues by an unassigned User or Milestone
+  def unassigned_filter
+    # Milestone uses :title, Issue uses :name
+    OpenStruct.new(id: 0, title: 'Unspecified', name: 'Unassigned')
   end
 end
diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml
index fbc2fe7dc05..8876d24dee5 100644
--- a/app/views/issues/index.html.haml
+++ b/app/views/issues/index.html.haml
@@ -49,8 +49,8 @@
         .right
           = form_tag project_issues_path(@project), method: :get, class: :right  do
             = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels")
-            = select_tag(:assignee_id, options_from_collection_for_select([unassigned_issue] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
-            = select_tag(:milestone_id, options_from_collection_for_select([unassigned_milestone] + @project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone")
+            = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
+            = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + @project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone")
             = hidden_field_tag :f, params[:f]
         .clearfix
   
-- 
GitLab