Commit feee3838e14c90bc73b97cfa8be3760e52605531
1 parent
5a90d044
Exists in
master
and in
4 other branches
Combine unassigned_issue and unassigned_milestone into unassigned_filter
Showing
2 changed files
with
7 additions
and
10 deletions
Show diff stats
app/helpers/issues_helper.rb
| ... | ... | @@ -37,13 +37,10 @@ module IssuesHelper |
| 37 | 37 | @project.issues.tag_counts_on(:labels).map(&:name) |
| 38 | 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 | 45 | end |
| 49 | 46 | end | ... | ... |
app/views/issues/index.html.haml
| ... | ... | @@ -49,8 +49,8 @@ |
| 49 | 49 | .right |
| 50 | 50 | = form_tag project_issues_path(@project), method: :get, class: :right do |
| 51 | 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 | 54 | = hidden_field_tag :f, params[:f] |
| 55 | 55 | .clearfix |
| 56 | 56 | ... | ... |