Files
grecia/app/components/shared/advanced_search_component.rb
Javi Martín 9f1f912d84 Remove official level filter from advanced search
User testing has shown this filter isn't really useful and sometimes
makes users wonder what it's about. This is particularly true in CONSUL
installations which don't change the default values (most of them),
since users will see a filter with options like "Official position 1".
2021-09-11 17:28:38 +02:00

40 lines
917 B
Ruby

class Shared::AdvancedSearchComponent < ApplicationComponent
include SDG::OptionsForSelect
private
def advanced_search
params[:advanced_search] || {}
end
def date_range_options
options_for_select([
[t("shared.advanced_search.date_1"), 1],
[t("shared.advanced_search.date_2"), 2],
[t("shared.advanced_search.date_3"), 3],
[t("shared.advanced_search.date_4"), 4],
[t("shared.advanced_search.date_5"), "custom"]],
selected_date_range)
end
def selected_date_range
custom_date_range? ? "custom" : advanced_search[:date_min]
end
def custom_date_range?
advanced_search[:date_max].present?
end
def goal_options
super(advanced_search[:goal])
end
def target_options
super(advanced_search[:target])
end
def sdg?
SDG::ProcessEnabled.new(controller_path).enabled?
end
end