Skip to content

Commit

Permalink
Spike of rendering guides as single pages
Browse files Browse the repository at this point in the history
The heading hierarchy is a bit broken on guides at the moment.
  • Loading branch information
sihugh committed Sep 12, 2019
1 parent 9e0357d commit 949491f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/views/_guide.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@
@include bold-24;
}
}

h2 {
margin-top: 45px;
}
}
4 changes: 2 additions & 2 deletions app/presenters/content_item/parts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ def previous_and_next_navigation
def part_link_elements
parts.map do |part|
if part['slug'] != current_part['slug']
{ href: part['full_path'], text: part['title'] }
{ href: "##{part['slug']}", text: part['title'] }
else
{ href: part['full_path'], text: part['title'], active: true }
{ href: "##{part['slug']}", text: part['title'], active: true }
end
end
end
Expand Down
16 changes: 11 additions & 5 deletions app/views/content_items/guide.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,24 @@

<div class="govuk-grid-column-two-thirds">
<% if @content_item.has_parts? %>

<% @content_item.parts.each do |part| %>
<% if @content_item.show_guide_navigation? %>
<h1 class="part-title">
<%= @content_item.current_part_title %>
</h1>
<%= render "govuk_publishing_components/components/heading",
text: part["title"],
id: part["slug"],
padding: true,
border_top: 2,
margin_bottom: 5 %>
<% end %>

<%= render 'govuk_publishing_components/components/govspeak',
content: @content_item.current_part_body.html_safe,
content: part["body"].html_safe,
direction: page_text_direction,
disable_youtube_expansions: true %>

<% if @content_item.show_guide_navigation? %>
<% end %>
<% if false # @content_item.show_guide_navigation? %>
<%= render 'govuk_publishing_components/components/previous_and_next_navigation', @content_item.previous_and_next_navigation %>
<%= render 'components/print-link', href: @content_item.print_link, link_text: t("multi_page.print_entire_guide") %>
<% end %>
Expand Down

0 comments on commit 949491f

Please sign in to comment.