-
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.
model and template template model and spec rubocop fix test
- Loading branch information
Showing
13 changed files
with
273 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
class ApplicationComponent < GovukComponent::Base | ||
def initialize(classes: [], html_attributes: {}) | ||
super(classes:, html_attributes:) | ||
end | ||
|
||
private | ||
|
||
def default_attributes | ||
{} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<div class="app-primary-navigation"> | ||
<div class="app-primary-navigation govuk-!-display-none-print"> | ||
<div class="govuk-width-container app-primary-navigation--justify-between"> | ||
<nav class="app-primary-navigation__nav" aria-label="main menu"> | ||
<ul class="app-primary-navigation__list"> | ||
<li class="app-primary-navigation__item"> | ||
<a class="app-primary-navigation__link" href="#"><%= t("navigation_bar.claims") %></a> | ||
</li> | ||
<% items.each do |item| %> | ||
<li class="app-primary-navigation__item"> | ||
<% if item[:active] %> | ||
<%= govuk_link_to item[:name], item[:href], class:"app-primary-navigation__link", aria: { current: "page" } %> | ||
<% else %> | ||
<%= govuk_link_to item[:name], item[:href], class:"app-primary-navigation__link" %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
</nav> | ||
</div> | ||
</div> | ||
</div> |
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,18 @@ | ||
# frozen_string_literal: true | ||
|
||
class NavigationBar < ApplicationComponent | ||
attr_reader :items, :current_path | ||
|
||
def initialize( | ||
items:, | ||
current_path:, | ||
current_user: {}, | ||
classes: [], | ||
html_attributes: {} | ||
) | ||
super(classes:, html_attributes:) | ||
@items = items | ||
@current_path = current_path | ||
@current_user = current_user | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
class Claims::PagesController < ApplicationController | ||
def index | ||
@school = GiasSchool.first | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module NavigationBarHelper | ||
def navigation_items(_provider) | ||
[ | ||
{ | ||
name: t("navigation_bar.users"), | ||
url: "#", | ||
additional_url: | ||
"request_access_publish_provider_path(provider.provider_code)" | ||
}, | ||
name: t("navigation_bar.organisation_details"), | ||
url: root_path, | ||
active: request.path == root_path | ||
] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,49 @@ | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<h1 class="govuk-heading-xl">It works! 🎉</h1> | ||
<%= render(NavigationBar.new( | ||
items: navigation_items(@provider), | ||
current_path: request.path, | ||
current_user: User.first | ||
)) %> | ||
<div class="govuk-grid-row"> | ||
<br><br> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<h1 class="govuk-heading-l"><%= t("organisation_details") %></h1> | ||
<%= govuk_summary_list do |summary_list| | ||
summary_list.with_row do |row| | ||
row.with_key(text: t("organisation_name")) | ||
row.with_value(text: @school.name) | ||
end;summary_list.with_row do |row| | ||
row.with_key(text: t("uk_provider_reference_number")) | ||
row.with_value(text: @school.ukprn) | ||
end;summary_list.with_row do |row| | ||
row.with_key(text: t("unique_reference_number")) | ||
row.with_value(text: @school.urn) | ||
end;end %> | ||
|
||
<p class="govuk-body"> | ||
Your application is ready - so long as this page rendered without any errors you're good to go. | ||
</p> | ||
|
||
<%= govuk_summary_list( | ||
rows: [ | ||
{ key: { text: "Service" }, value: { text: "Claims" } }, | ||
{ key: { text: "Rails version" }, value: { text: Rails.version } }, | ||
{ key: { text: "Ruby version" }, value: { text: RUBY_VERSION } }, | ||
{ | ||
key: { | ||
text: "GOV.UK Frontend", | ||
}, | ||
value: { | ||
text: JSON | ||
.parse(File.read(Rails.root.join("package.json"))) | ||
.dig("dependencies", "govuk-frontend") | ||
.tr("^", ""), | ||
}, | ||
}, | ||
], | ||
) %> | ||
</div> | ||
</div> | ||
<h2 class="govuk-heading-m govuk-!-margin-top-9">Contact details</h2> | ||
<%= govuk_summary_list do |summary_list| | ||
summary_list.with_row do |row| | ||
row.with_key(text: t("email_address")) | ||
row.with_value do %> | ||
<a href="[email protected]">[email protected]</a> | ||
<% end;row.with_action(text: t('change'), visually_hidden_text: t("email_address"), href: '/contact-details') | ||
end;summary_list.with_row do |row| | ||
row.with_key(text: 'Telephone number') | ||
row.with_value(text: @school.telephone) | ||
row.with_action(text: t('change'), visually_hidden_text: t("email_address"), href: '/contact-details') | ||
end;summary_list.with_row do |row| | ||
row.with_key(text: 'Website') | ||
row.with_value do %> | ||
<a href="<%= @school.website %>"><%= @school.website %></a> | ||
<% end;row.with_action(text: t('change'), visually_hidden_text: t('email_address'), href: '/contact-details') | ||
end;summary_list.with_row do |row| | ||
row.with_key(text: t('address')) | ||
row.with_value do %> | ||
<p class="govuk-body"> | ||
<%= @school.address1 %><br> | ||
<%= @school.address2 %><br> | ||
<%= @school.address3 %><br> | ||
</p> | ||
<% end;row.with_action(text: t('change'), visually_hidden_text: t('email_address'), href: '/contact-details') | ||
end;end %> | ||
</div> | ||
</div> |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require "rails_helper" | ||
|
||
RSpec.feature "Home Page" do | ||
after { Capybara.app_host = nil } | ||
|
||
scenario "User visits the claims homepage" do | ||
given_there_is_an_existing_persona_for("Mary") | ||
given_i_am_on_the_claims_site | ||
|
||
when_i_visit_home_page | ||
i_can_see_organisation_details | ||
i_can_see_contact_details | ||
|
||
end | ||
|
||
private | ||
|
||
def given_i_am_on_the_claims_site | ||
Capybara.app_host = "http://#{ENV["CLAIMS_HOST"]}" | ||
end | ||
|
||
def when_i_visit_home_page | ||
visit "/" | ||
end | ||
|
||
def given_there_is_an_existing_persona_for(persona_name) | ||
user = create(:persona, persona_name.downcase.to_sym,service:"claims") | ||
create(:gias_school) | ||
DfESignInUser.load_from_session({"dfe_sign_in_user"=>{"email"=>user.email},"service" =>:claims}) | ||
end | ||
|
||
def i_can_see_organisation_details | ||
expect(page).to have_css(".govuk-summary-list__value", text: "Hogwarts") | ||
expect(page).to have_css(".govuk-summary-list__value", text: "fake_uprn") | ||
expect(page).to have_css(".govuk-summary-list__value", text: 1) | ||
end | ||
|
||
def i_can_see_contact_details | ||
expect(page).to have_css(".govuk-summary-list__value", text: "[email protected]") | ||
expect(page).to have_css(".govuk-summary-list__value", text: "0123456789") | ||
expect(page).to have_css(".govuk-summary-list__value", text: "www.hogwarts.com") | ||
expect(page).to have_css(".govuk-summary-list__value", text: "Hogwarts Castle") | ||
expect(page).to have_css(".govuk-summary-list__value", text: "Scotland") | ||
expect(page).to have_css(".govuk-summary-list__value", text: "United Kingdom") | ||
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