Files
nairobi/app/components/sdg_management/relations/search_component.rb
Javi Martín 5f3279b9db Extract search form component in SDG Management
We're going to add some JavaScript which affect this component, and IMHO
it will be easier to know the JavaScript affects this form if both have
their own separate file.
2021-01-28 13:41:23 +01:00

36 lines
779 B
Ruby

class SDGManagement::Relations::SearchComponent < ApplicationComponent
include SDG::OptionsForSelect
attr_reader :label, :current_filter
def initialize(label:, current_filter: nil)
@label = label
@current_filter = current_filter
end
private
def goal_label
t("admin.shared.search.advanced_filters.sdg_goals.label")
end
def goal_blank_option
t("admin.shared.search.advanced_filters.sdg_goals.all")
end
def target_label
t("admin.shared.search.advanced_filters.sdg_targets.label")
end
def target_blank_option
t("admin.shared.search.advanced_filters.sdg_targets.all")
end
def goal_options
super(params[:goal_code])
end
def target_options
super(params[:target_code])
end
end