Files
nairobi/app/helpers/legislation_helper.rb
Javi Martín 53ff81dfdf Unify code applying the colors of a process
We had some duplication because the `css_for_process_header` was using
an instance variable, and so it couldn't be called from a partial where
this instance variable wasn't available.

Using a local variable and passing it as a parameter (as we should
always do) solves the issue and lets us simplify the code.
2025-03-06 18:25:45 +01:00

31 lines
957 B
Ruby

module LegislationHelper
def format_date(date)
l(date, format: "%d %b %Y") if date
end
def new_legislation_proposal_link_text(process)
t("proposals.index.start_proposal")
end
def legislation_process_tabs(process)
{
"info" => edit_admin_legislation_process_path(process),
"homepage" => edit_admin_legislation_process_homepage_path(process),
"questions" => admin_legislation_process_questions_path(process),
"proposals" => admin_legislation_process_proposals_path(process),
"draft_versions" => admin_legislation_process_draft_versions_path(process),
"milestones" => admin_legislation_process_milestones_path(process)
}
end
def banner_color?(process)
process.background_color.present? && process.font_color.present?
end
def css_for_process_header(process)
if banner_color?(process)
"background: #{process.background_color};color: #{process.font_color};"
end
end
end