Skip to content

Commit

Permalink
fix request changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SocFoot committed Jan 3, 2024
1 parent bc49e22 commit a53d41b
Show file tree
Hide file tree
Showing 14 changed files with 166 additions and 176 deletions.
70 changes: 0 additions & 70 deletions app/assets/stylesheets/application.sass.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,73 +5,3 @@ $govuk-assets-path: "";
@import "govuk-frontend/dist/govuk/all";
@import "components/all";
@import "accessible-autocomplete/dist/accessible-autocomplete.min";


.app-primary-navigation {
background-color: govuk-colour("light-grey");
}

.app-primary-navigation--justify-between {
display: flex;
justify-content: space-between;
}

.app-primary-navigation__list {
@include govuk-clearfix;
list-style: none;
margin: 0;
padding: 0;
}

.app-primary-navigation__item {
@include govuk-font($size: 19);
float: left;
margin-right: govuk-spacing(3);
margin-top: 0;

&:last-child {
margin-right: 0;
}

@include govuk-media-query($from: tablet) {
margin-right: govuk-spacing(4);
}
}

.app-primary-navigation__item--align-right {
@include govuk-media-query($from: tablet) {
float: right;
}
}

.app-primary-navigation__link {
@include govuk-link-common;
@include govuk-link-style-no-visited-state;
display: block;
font-weight: bold;
padding-bottom: govuk-spacing(3);
padding-top: govuk-spacing(3);
text-decoration: none;

&:focus {
background-color: $govuk-focus-colour;
box-shadow: inset 0 -5px 0 0 $govuk-focus-text-colour;
color: $govuk-focus-text-colour;
outline: $govuk-focus-width solid transparent;
}

&[aria-current] {
box-shadow: inset 0 -5px 0 0 $govuk-link-colour;
color: $govuk-link-colour;

&:hover {
box-shadow: inset 0 -5px 0 0 $govuk-link-hover-colour;
color: $govuk-link-hover-colour;
}

&:focus {
box-shadow: inset 0 -7px 0 0 $govuk-focus-text-colour;
color: $govuk-focus-text-colour;
}
}
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/components/_all.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@import "header";
@import "page_banner";
@import "navigation_bar";
68 changes: 68 additions & 0 deletions app/assets/stylesheets/components/_app_primary_navigation.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.app-primary-navigation {
background-color: govuk-colour("light-grey");
}

.app-primary-navigation--justify-between {
display: flex;
justify-content: space-between;
}

.app-primary-navigation__list {
@include govuk-clearfix;
list-style: none;
margin: 0;
padding: 0;
}

.app-primary-navigation__item {
@include govuk-font($size: 19);
float: left;
margin-right: govuk-spacing(3);
margin-top: 0;

&:last-child {
margin-right: 0;
}

@include govuk-media-query($from: tablet) {
margin-right: govuk-spacing(4);
}
}

.app-primary-navigation__item--align-right {
@include govuk-media-query($from: tablet) {
float: right;
}
}

.app-primary-navigation__link {
@include govuk-link-common;
@include govuk-link-style-no-visited-state;
display: block;
font-weight: bold;
padding-bottom: govuk-spacing(3);
padding-top: govuk-spacing(3);
text-decoration: none;

&:focus {
background-color: $govuk-focus-colour;
box-shadow: inset 0 -5px 0 0 $govuk-focus-text-colour;
color: $govuk-focus-text-colour;
outline: $govuk-focus-width solid transparent;
}

&[aria-current] {
box-shadow: inset 0 -5px 0 0 $govuk-link-colour;
color: $govuk-link-colour;

&:hover {
box-shadow: inset 0 -5px 0 0 $govuk-link-hover-colour;
color: $govuk-link-hover-colour;
}

&:focus {
box-shadow: inset 0 -7px 0 0 $govuk-focus-text-colour;
color: $govuk-focus-text-colour;
}
}
}
2 changes: 0 additions & 2 deletions app/components/application_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# frozen_string_literal: true

class ApplicationComponent < GovukComponent::Base
def initialize(classes: [], html_attributes: {})
super(classes:, html_attributes:)
Expand Down
4 changes: 2 additions & 2 deletions app/components/navigation_bar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<% 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" } %>
<%= 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" %>
<%= govuk_link_to item[:name], item[:href], class: "app-primary-navigation__link" %>
<% end %>
</li>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/claims/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Claims::PagesController < ApplicationController
def index
@school = GiasSchool.first
@user = User.first
end
end
4 changes: 2 additions & 2 deletions app/helpers/navigation_bar_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ 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
active: request.path == root_path,
]
end
end
32 changes: 17 additions & 15 deletions app/views/claims/pages/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,49 +1,51 @@
<%= render(NavigationBar.new(
items: navigation_items(@provider),
current_path: request.path,
current_user: User.first
current_user:,
)) %>
<% if @user&.schools&.first&.gias_school %>
<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("organisation_name"))
row.with_value(text: @user&.schools&.first&.gias_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 %>
row.with_value(text: @user&.schools&.first&.gias_school&.ukprn)
end; summary_list.with_row do |row|
row.with_key(text: t("unique_reference_number"))
row.with_value(text: @user&.schools&.first&.gias_school&.urn)
end; end %>

<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>
<a href="[email protected]"><%= @user.email %></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_value(text: @user&.schools&.first&.gias_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>
<a href="<%= @user&.schools&.first&.gias_school&.website %>"><%= @user&.schools&.first&.gias_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>
<%= @user&.schools&.first&.gias_school&.address1 %><br>
<%= @user&.schools&.first&.gias_school&.address2 %><br>
<%= @user&.schools&.first&.gias_school&.address3 %><br>
</p>
<% end;row.with_action(text: t('change'), visually_hidden_text: t('email_address'), href: '/contact-details')
end;end %>
</div>
</div>
<% end %>
4 changes: 2 additions & 2 deletions spec/factories/gias_schools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#
FactoryBot.define do
factory :gias_school do
sequence(:urn) { _1 }
sequence(:urn) { |n| "fake_urn#{n}" }
name { "Hogwarts" }
sequence(:ukprn) {|n| "fake_uprn_#{n}" }
sequence(:ukprn) { |n| "fake_uprn_#{n}" }
telephone { "0123456789" }
website { "www.hogwarts.com" }
address1 { "Hogwarts Castle" }
Expand Down
20 changes: 6 additions & 14 deletions spec/features/personas/sign_in_as_a_claims_user_persona_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
end

scenario "I sign in as persona Anne" do
given_there_is_an_existing_claims_persona_for("Anne")
and_given_i_have_a_school
given_there_is_an_existing_claims_persona_with_a_school_for("Anne")
when_i_visit_the_claims_personas_page
then_i_see_the_claims_persona_for("Anne")
when_i_click_sign_in_as("Anne")
Expand All @@ -18,8 +17,7 @@
end

scenario "I sign in as persona Patricia" do
given_there_is_an_existing_claims_persona_for("Patricia")
and_given_i_have_a_school
given_there_is_an_existing_claims_persona_with_a_school_for("Patricia")
when_i_visit_the_claims_personas_page
then_i_see_the_claims_persona_for("Patricia")
when_i_click_sign_in_as("Patricia")
Expand All @@ -28,8 +26,7 @@
end

scenario "I sign in as persona Mary" do
given_there_is_an_existing_claims_persona_for("Mary")
and_given_i_have_a_school
given_there_is_an_existing_claims_persona_with_a_school_for("Mary")
when_i_visit_the_claims_personas_page
then_i_see_the_claims_persona_for("Mary")
when_i_click_sign_in_as("Mary")
Expand All @@ -38,8 +35,7 @@
end

scenario "I sign in as persona colin" do
given_there_is_an_existing_claims_persona_for("Colin")
and_given_i_have_a_school
given_there_is_an_existing_claims_persona_with_a_school_for("Colin")
when_i_visit_the_claims_personas_page
then_i_see_the_claims_persona_for("Colin")
when_i_click_sign_in_as("Colin")
Expand All @@ -50,12 +46,8 @@

private

def given_there_is_an_existing_claims_persona_for(persona_name)
create(:persona, persona_name.downcase.to_sym, service: "claims")
end

def and_given_i_have_a_school
create(:gias_school)
def given_there_is_an_existing_claims_persona_with_a_school_for(persona_name)
create(:membership, user: create(:persona, persona_name.downcase.to_sym, service: "claims"), organisation: create(:school))
end

def when_i_visit_the_claims_personas_page
Expand Down
19 changes: 11 additions & 8 deletions spec/system/claims/pages/home_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
after { Capybara.app_host = nil }

scenario "User visits the claims homepage" do
given_there_is_an_existing_persona_for("Mary")
persona = given_there_is_an_existing_persona_for("Mary")
given_i_am_on_the_claims_site

when_i_visit_home_page
when_i_click_sign_in(persona)
i_can_see_organisation_details
i_can_see_contact_details

end

private
Expand All @@ -20,13 +19,17 @@ def given_i_am_on_the_claims_site
end

def when_i_visit_home_page
visit "/"
visit("/")
end

def when_i_click_sign_in(persona)
click_on "Sign In as #{persona.first_name}"
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})
user = create(:persona, persona_name.downcase.to_sym, service: "claims")
create(:membership, user:, organisation: create(:school))
user
end

def i_can_see_organisation_details
Expand All @@ -36,7 +39,7 @@ def i_can_see_organisation_details
end

def i_can_see_contact_details
expect(page).to have_css(".govuk-summary-list__value", text: "contact@example.com")
expect(page).to have_css(".govuk-summary-list__value", text: "mary@example.com")
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")
Expand Down
Loading

0 comments on commit a53d41b

Please sign in to comment.