Files
grecia/app/components/sdg_management/local_targets/index_component.rb
Javi Martín c66a5a30ef Allow using table actions in different namespaces
This way we can reuse it in sections like SDGManagement and URLs will be
automatically generated as expected.
2021-01-14 17:35:38 +01:00

28 lines
556 B
Ruby

class SDGManagement::LocalTargets::IndexComponent < ApplicationComponent
include Header
attr_reader :local_targets
def initialize(local_targets)
@local_targets = local_targets
end
private
def title
SDG::LocalTarget.model_name.human(count: 2).titleize
end
def attribute_name(attribute)
SDG::LocalTarget.human_attribute_name(attribute)
end
def header_id(object)
"#{dom_id(object)}_header"
end
def actions(local_target)
render Admin::TableActionsComponent.new(local_target)
end
end