Combine unassigned_issue and unassigned_milestone into unassigned_filter

This commit is contained in:
Robert Speicher 2012-08-16 18:13:22 -04:00
parent 5a90d044f7
commit feee3838e1
2 changed files with 7 additions and 10 deletions

View file

@ -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

View file

@ -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