From e8942437c018e2b0db14776fdfeab576faf723b8 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 10 Jun 2018 15:32:27 +0100 Subject: [PATCH] Use select_tag for issue filter fields instead of abusing select --- app/controllers/issues_controller.rb | 8 ++++---- app/views/issues/index.html.erb | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 6f4667a30..deec96b7a 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -26,12 +26,12 @@ class IssuesController < ApplicationController end end - @issues = @issues.where(:status => params[:status][0]) if params[:status] && params[:status][0].present? + @issues = @issues.where(:status => params[:status]) if params[:status] && params[:status].present? - @issues = @issues.where(:reportable_type => params[:issue_type][0]) if params[:issue_type] && params[:issue_type][0].present? + @issues = @issues.where(:reportable_type => params[:issue_type]) if params[:issue_type] && params[:issue_type].present? - if params[:last_updated_by] && params[:last_updated_by][0].present? - last_updated_by = params[:last_updated_by][0].to_s == "nil" ? nil : params[:last_updated_by][0].to_i + if params[:last_updated_by] && params[:last_updated_by].present? + last_updated_by = params[:last_updated_by].to_s == "nil" ? nil : params[:last_updated_by].to_i @issues = @issues.where(:updated_by => last_updated_by) end diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index a734b15e6..510cb4e0d 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -4,10 +4,10 @@ <%= form_tag(issues_path, :method => :get) do %>

<%= t ".search_guidance" %>

-<%= select :status, nil, options_for_select(Issue.aasm.states.map(&:name).map{|state| [t("issues.states.#{state}"), state]}, params[:status]), { :include_blank => t(".select_status")}, data: { behavior: 'category_dropdown' } %> -<%= select :issue_type, nil, options_for_select(@issue_types, params[:issue_type]), { :include_blank => t(".select_type")}, data: { behavior: 'category_dropdown' } %> +<%= select_tag :status, options_for_select(Issue.aasm.states.map(&:name).map{|state| [t("issues.states.#{state}"), state]}, params[:status]), :include_blank => t(".select_status"), :data => { :behavior => 'category_dropdown' } %> +<%= select_tag :issue_type, options_for_select(@issue_types, params[:issue_type]), :include_blank => t(".select_type"), :data => { :behavior => 'category_dropdown' } %> <%= text_field_tag :search_by_user, params[:search_by_user], placeholder: t(".reported_user") %> -<%= select :last_updated_by, nil, options_for_select(@users.all.collect{|f| [f.display_name, f.id]} << [ t(".not_updated"), "nil"], params[:last_updated_by]), { :include_blank => t(".select_last_updated_by")}, data: { behavior: 'category_dropdown' } %> +<%= select_tag :last_updated_by, options_for_select(@users.all.collect{|f| [f.display_name, f.id]} << [ t(".not_updated"), "nil"], params[:last_updated_by]), :include_blank => t(".select_last_updated_by"), :data => { :behavior => 'category_dropdown' } %> <%= submit_tag t(".search"), :name => nil %> <% end %>
-- 2.39.5