Legislation Processes created through the admin form were getting the default color. However, Legislation processes created by other means (like the `db:dev_seed` rake task) were not getting these default values. This feature was originally implemented when we were using Rails 4. With Rails 5, we can provide default values to all new Legislation processes and simplify the code at the same time thanks to its `attribute` method. Related commit: https://github.com/consul/consul/pull/4080/commits/0b83be6
31 lines
964 B
Ruby
31 lines
964 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.background_color.present? && @process.font_color.present?
|
|
end
|
|
|
|
def css_for_process_header
|
|
if banner_color?
|
|
"background: #{@process.background_color};color: #{@process.font_color};"
|
|
end
|
|
end
|
|
end
|