Browse Source

Refactor filter_selected? to handle 'you' being selected correctly

pull/2666/head
Manny Dinssa 2 years ago
parent
commit
be71be01ed
  1. 14
      app/helpers/filters_helper.rb

14
app/helpers/filters_helper.rb

@ -154,11 +154,11 @@ module FiltersHelper
end end
def collection_year_radio_options def collection_year_radio_options
options = {} {
collection_year_options.map do |year, label| current_collection_start_year.to_s => { label: year_combo(current_collection_start_year) },
options[year] = { label: } previous_collection_start_year.to_s => { label: year_combo(previous_collection_start_year) },
end archived_collection_start_year.to_s => { label: year_combo(archived_collection_start_year) },
options }
end end
def filters_applied_text(filter_type) def filters_applied_text(filter_type)
@ -349,7 +349,7 @@ private
def assigned_to_filter_selected?(selected_filters, value) def assigned_to_filter_selected?(selected_filters, value)
return true if !selected_filters.key?("user") && value == :all return true if !selected_filters.key?("user") && value == :all
return true if selected_filters["assigned_to"] == "specific_user" && value == :specific_user return true if selected_filters["assigned_to"] == value.to_s
false false
end end
@ -370,7 +370,7 @@ private
def uploaded_by_filter_selected?(selected_filters, value) def uploaded_by_filter_selected?(selected_filters, value)
return true if !selected_filters.key?("user") && value == :all return true if !selected_filters.key?("user") && value == :all
return true if selected_filters["uploaded_by"] == "specific_user" && value == :specific_user return true if selected_filters["uploaded_by"] == value.to_s
false false
end end

Loading…
Cancel
Save