Skip to content

Commit

Permalink
Merge pull request #166 from Christine-horrocks/Update_treaties_prefi…
Browse files Browse the repository at this point in the history
…x_number

Update treaties to add prefix and number
  • Loading branch information
katylouise authored Feb 13, 2019
2 parents 20aae0b + ecde5c3 commit d957d52
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 d957d52

Please sign in to comment.