From 1e78ceea496a8e031d82e9531d2122287602dcb3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 8 May 2013 10:00:19 +0300 Subject: replace selectboxes with filters --- .../stylesheets/gitlab_bootstrap/common.scss | 1 + app/helpers/labels_helper.rb | 4 +- app/views/issues/_issues.html.haml | 55 ++++++++++++++++++++-- 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/gitlab_bootstrap/common.scss b/app/assets/stylesheets/gitlab_bootstrap/common.scss index 4c78cd1eeac..d2460c5f022 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/common.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/common.scss @@ -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 } diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb index 950db0377eb..9a6aea85ee9 100644 --- a/app/helpers/labels_helper.rb +++ b/app/helpers/labels_helper.rb @@ -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 diff --git a/app/views/issues/_issues.html.haml b/app/views/issues/_issues.html.haml index 93fa9da2767..1438803efb2 100644 --- a/app/views/issues/_issues.html.haml +++ b/app/views/issues/_issues.html.haml @@ -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' -- cgit v1.2.1