Files
grecia/app/components/sdg_management/relations/index_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

34 lines
658 B
Ruby

class SDGManagement::Relations::IndexComponent < ApplicationComponent
include Header
delegate :valid_filters, :current_filter, to: :helpers
attr_reader :records
def initialize(records)
@records = records
end
private
def title
t("sdg_management.menu.#{model_class.table_name}")
end
def model_class
records.model
end
def edit_path_for(record)
{
controller: "sdg_management/relations",
action: :edit,
relatable_type: record.class.name.tableize,
id: record
}
end
def search_label
t("admin.shared.search.label.#{model_class.table_name}")
end
end