Skip to content

Commit

Permalink
Update treaties to add prefix and number
Browse files Browse the repository at this point in the history
  • Loading branch information
Christine-horrocks committed Feb 13, 2019
1 parent 20aae0b commit ecde5c3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 27 deletions.
12 changes: 12 additions & 0 deletions app/serializers/page_serializer/treaties_show_page_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,22 @@ def heading1_component
ComponentSerializer::Heading1ComponentSerializer.new(heading_content).to_h
end

def title_context
prefix = @treaty.try(:treatyPrefix)
number = @treaty.try(:treatyNumber)

ctx_info = ''
ctx_info << prefix.to_s if prefix
ctx_info << " #{number}" if number

ctx_info unless ctx_info.empty?
end

def heading_content
{}.tap do |hash|
hash[:subheading] = ContentDataHelper.content_data(content: 'treaties.show.subheading', link: treaties_path)
hash[:heading] = title || t('no_name')
hash[:context] = title_context
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ main-components:
link: "/treaties"
heading:
content: laidThingName - 1
context:
content: treatyPrefix - 1 488
- name: section__section
data:
components:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ main-components:
link: "/treaties"
heading:
content: "[Name unavailable]"
context:
content: treatyPrefix - 1 488
- name: section__section
data:
components:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ecde5c3

Please sign in to comment.