-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upload script and additional changes
- Loading branch information
Showing
28 changed files
with
300 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
class HomeController < ApplicationController | ||
before_action :authenticate_user!, if: proc { !ENV["AUTH_ON_EVERYTHING"].nil? } | ||
|
||
helper_method :section | ||
|
||
def index | ||
@page = Web::Page.home | ||
@pages = Web::Page.search(placement: 'home').load | ||
end | ||
|
||
private | ||
|
||
def section | ||
'home' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,39 @@ | ||
module Web | ||
class PagesController < ApplicationController | ||
before_action { load_page } | ||
before_action { page } | ||
|
||
helper_method :breadcrumbs | ||
helper_method :page, :slug, :section, :breadcrumbs | ||
|
||
def index; end | ||
|
||
def show | ||
if @page.children? | ||
if @page.cards? | ||
render 'show_cards' | ||
else | ||
render 'show_navigation' | ||
end | ||
elsif @page.navigation? | ||
render 'show_navigation' | ||
end | ||
render page.page_style | ||
end | ||
|
||
private | ||
|
||
def menu_item | ||
cms_path_array.first | ||
def breadcrumbs | ||
[] | ||
end | ||
|
||
def page_params | ||
params.permit(:cms_path, :slug) | ||
params.permit(:section, :overview, :slug) | ||
end | ||
|
||
def page(page_name) | ||
content.send(page_name) | ||
end | ||
|
||
def breadcrumbs | ||
if cms_path == "/" | ||
{} | ||
else | ||
cms_path_array.each_with_object({ "Home" => "/" }) do |obj, memo| | ||
page = load_page(lookup_page: obj.to_sym) | ||
memo[page.menu_title] = page.full_path | ||
end | ||
end | ||
def slug | ||
page_params[:slug] | ||
end | ||
|
||
def cms_path | ||
page_params[:cms_path] || "/" | ||
def section | ||
page_params[:section] | ||
end | ||
|
||
def cms_path_array | ||
cms_path&.split("/") | ||
def lookup_slug | ||
slug.presence || section | ||
end | ||
|
||
def load_page | ||
@page = Web::Page.by_slug(page_params[:slug]) | ||
def page | ||
@page ||= Web::Page.by_slug(lookup_slug) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
.govuk-grid-column-one-third | ||
.hf-card | ||
a href=card.slug | ||
a href=card.path | ||
.hf-card-container | ||
= image_tag(card.thumbnail.url, class: 'full-width-image', alt: card.thumbnail.description, title: card.thumbnail.title) | ||
.hf-card-details | ||
h3.govuk-heading-m=card&.hero&.title | ||
p.govuk-body=card&.hero&.body | ||
h3.govuk-heading-m=card&.title | ||
p.govuk-body=card&.meta_description || card&.hero_description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
- content_for(:page_title) do | ||
= @page.title | ||
|
||
- content_for(:hero) do | ||
= render partial: 'hero', locals: { hero: @page.hero } | ||
|
||
- if @page.children? | ||
.govuk-grid-row class='govuk-!-margin-top-4 govuk-!-margin-bottom-5' | ||
= render partial: 'shared/card', collection: @page.pages | ||
|
||
= render 'shared/ctas' |
Oops, something went wrong.