Files
grecia/app/components/moderation/shared/index_component.rb
Javi Martín d18c627392 Add and apply Layout/EmptyLinesAfterModuleInclusion rule
This rule was added in rubocop 1.79. We were inconsistent about it, so
we're adding it to get more consistency.
2025-11-05 14:27:12 +01:00

46 lines
790 B
Ruby

class Moderation::Shared::IndexComponent < ApplicationComponent
include Header
attr_reader :records
def initialize(records)
@records = records
end
private
def title
t("moderation.#{i18n_namespace}.index.title")
end
def i18n_namespace
table_name
end
def field_name
"#{records.model.model_name.singular}_ids[]"
end
def form_path
url_for(
request.query_parameters.merge(
controller: "moderation/#{section_name}",
action: "moderate",
only_path: true
)
)
end
def table_name
records.model.table_name
end
def section_name
if table_name == "budget_investments"
"budgets/investments"
else
table_name
end
end
end