replace selectboxes with filters

This commit is contained in:
Dmitriy Zaporozhets 2013-05-08 10:00:19 +03:00
parent a87f5c60a4
commit 1e78ceea49
3 changed files with 55 additions and 5 deletions

View file

@ -19,6 +19,7 @@
.append-right-20 { margin-right:20px }
.append-bottom-10 { margin-bottom:10px }
.append-bottom-20 { margin-bottom:20px }
.inline { display: inline-block }
.padded { padding:20px }
.ipadded { padding:20px!important }

View file

@ -1,6 +1,6 @@
module LabelsHelper
def issue_tags
@project.issues.tag_counts_on(:labels).map(&:name)
def issue_label_names
@project.issues_labels.map(&:name)
end
def labels_autocomplete_source

View file

@ -14,9 +14,58 @@
= button_tag "Save", class: "btn update_selected_issues btn-small btn-save"
.issues_filters
= form_tag project_issues_path(@project), method: :get, remote: true 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_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
= select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
%span Filter by
.dropdown.inline.prepend-left-10
%a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"}
%i.icon-tags
%span.light labels:
- if params[:label_name]
%strong= params[:label_name]
- else
Any
%b.caret
%ul.dropdown-menu
- issue_label_names.each do |label_name|
%li
= link_to '#' do
%span{class: "label #{label_css_class(label_name)}"}
%i.icon-tag
= label_name
.dropdown.inline.prepend-left-10
%a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"}
%i.icon-user
%span.light assignee:
- if params[:assignee_id].present?
%strong= User.find(params[:assignee_id]).name
- else
Any
%b.caret
%ul.dropdown-menu
- @project.users.sort_by(&:name).each do |user|
%li
= link_to '#' do
= image_tag gravatar_icon(user.email), class: "avatar s16"
= user.name
.dropdown.inline.prepend-left-10
%a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"}
%i.icon-time
%span.light milestone:
- if params[:milestone_id].present?
%strong= Milestone.find(params[:milestone_id]).title
- else
Any
%b.caret
%ul.dropdown-menu
- issues_active_milestones.each do |milestone|
%li
= link_to '#' do
%strong= milestone.title
%small.light= milestone.expires_at
-#= select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels")
-#= 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] + issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
= hidden_field_tag :status, params[:status]
= hidden_field_tag :issue_search, params[:status], id: 'filter_issue_search'