diff --git a/.cfignore b/.cfignore deleted file mode 100644 index 94236649..00000000 --- a/.cfignore +++ /dev/null @@ -1,9 +0,0 @@ -.bundle -.byebug_history -.env -.nvmrc -.rvmrc - -log -tmp -storage diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index ce84b5e9..00000000 --- a/.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -# https://gds-way.cloudapps.digital/manuals/programming-languages/editorconfig -root = true - -[*.{css,erb,js,json,rb,scss,sh,yml}] -indent_size = 2 -indent_style = space -charset = utf-8 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true diff --git a/.github/workflows/azure-deploy-prod.yml b/.github/workflows/azure-deploy-prod.yml index 6f00479a..86b4f056 100644 --- a/.github/workflows/azure-deploy-prod.yml +++ b/.github/workflows/azure-deploy-prod.yml @@ -11,9 +11,6 @@ on: description: 'Release candidate to deploy ("rcx.x.x")' type: string required: true - push: - tags: - - v* # Permissions for OIDC authentication permissions: @@ -97,4 +94,4 @@ jobs: with: app-name: ${{ vars.WEBAPP_NAME }} images: ${{ env.DOCKER_IMAGE }}:${{ inputs.version || github.ref_name }} - slot-name: ${{ vars.WEBAPP_DEPLOY_SLOT }} \ No newline at end of file + slot-name: ${{ vars.WEBAPP_DEPLOY_SLOT }} diff --git a/.rubocop.yml b/.rubocop.yml index ef5a2441..96e32f92 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -15,14 +15,6 @@ require: rubocop-performance AllCops: TargetRubyVersion: 3.2.2 - Exclude: - - "**/*.erb" - - 'bin/*' - - 'db/schema.rb' - - 'node_modules/**/*' - - 'config/application.rb' - - 'config/puma.rb' - - 'vendor/**/*' Style/StringLiterals: EnforcedStyle: single_quotes diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4f34d5a6..e3a8a68d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,219 +1,25 @@ # This configuration was generated by -# `rubocop --auto-gen-config` -# on 2024-01-16 15:44:08 UTC using RuboCop version 1.59.0. +# `rubocop --auto-gen-config --no-auto-gen-timestamp` +# using RuboCop version 1.59.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 5 -# This cop supports safe autocorrection (--autocorrect). -Capybara/CurrentPathExpectation: - Exclude: - - 'spec/features/admin/user_admin_page_spec.rb' - - 'spec/features/admin_content_pages_spec.rb' - -# Offense count: 3 -Capybara/VisibilityMatcher: - Exclude: - - 'spec/features/admin/user_admin_page_spec.rb' - - 'spec/features/admin_content_pages_spec.rb' - -# Offense count: 2 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: Include, EnforcedStyle, ExplicitOnly. -# Include: **/*_spec.rb, **/spec/**/*, **/test/**/*, **/features/support/factories/**/*.rb -# SupportedStyles: create_list, n_times -FactoryBot/CreateList: - Exclude: - - 'spec/views/admin/content_pages/index.html.erb_spec.rb' - - 'spec/views/content/index.html.erb_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. -Layout/ExtraSpacing: - Exclude: - - 'config/initializers/time_formats.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Performance/RedundantMatch: - Exclude: - - 'e2etests/features/support/common.rb' - # Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: MaxKeyValuePairs. -Performance/RedundantMerge: - Exclude: - - 'db/seeds.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Performance/RegexpMatch: - Exclude: - - 'e2etests/features/support/common.rb' - -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -Performance/StringReplacement: - Exclude: - - 'app/models/content_page.rb' - - 'e2etests/features/support/common.rb' - -# Offense count: 1 -RSpec/BeforeAfterAll: - Exclude: - - 'spec/requests/content_request_spec.rb' - -# Offense count: 14 # Configuration parameters: Prefixes, AllowedPatterns. # Prefixes: when, with, without RSpec/ContextWording: Exclude: - - 'spec/models/content_page_spec.rb' - 'spec/models/user_spec.rb' - - 'spec/requests/admin/user_request_spec.rb' - - 'spec/requests/content_request_spec.rb' - -# Offense count: 13 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: SkipBlocks, EnforcedStyle. -# SupportedStyles: described_class, explicit -RSpec/DescribedClass: - Exclude: - - 'spec/models/content_page_spec.rb' - - 'spec/models/user_spec.rb' - -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -RSpec/EmptyExampleGroup: - Exclude: - - 'spec/features/user_admin_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowConsecutiveOneLiners. -RSpec/EmptyLineAfterExample: - Exclude: - - 'spec/features/admin_content_pages_spec.rb' - -# Offense count: 15 -# This cop supports safe autocorrection (--autocorrect). -RSpec/EmptyLineAfterFinalLet: - Exclude: - - 'spec/features/admin/user_admin_page_spec.rb' - - 'spec/requests/admin/content_blocks_spec.rb' - - 'spec/requests/admin/content_page_versions_spec.rb' - - 'spec/requests/admin/content_pages_spec.rb' - - 'spec/requests/admin/user_request_spec.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowConsecutiveOneLiners. -RSpec/EmptyLineAfterHook: - Exclude: - - 'spec/requests/admin/content_pages_spec.rb' - - 'spec/requests/feedbacks_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -RSpec/EmptyLineAfterSubject: - Exclude: - - 'spec/requests/admin/content_pages_spec.rb' - -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples. -# DisallowedExamples: works -RSpec/ExampleWording: - Exclude: - - 'spec/features/content_pages_spec.rb' - - 'spec/features/drafting_and_publishing_spec.rb' - - 'spec/models/content_page_spec.rb' - - 'spec/views/content/index.html.erb_spec.rb' # Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: method_call, block -RSpec/ExpectChange: - Exclude: - - 'spec/requests/admin/content_pages_spec.rb' - -# Offense count: 5 # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. # Include: **/*_spec*rb*, **/spec/**/* RSpec/FilePath: Exclude: - - 'spec/requests/admin/content_blocks_spec.rb' - - 'spec/requests/admin/content_page_versions_spec.rb' - - 'spec/requests/admin/content_pages_spec.rb' - - 'spec/requests/admin/user_request_spec.rb' - 'spec/requests/application_spec.rb' -# Offense count: 7 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: implicit, each, example -RSpec/HookArgument: - Exclude: - - 'spec/models/content_page_spec.rb' - - 'spec/requests/admin/content_pages_spec.rb' - - 'spec/views/admin/content_pages/edit.html.erb_spec.rb' - - 'spec/views/admin/content_pages/index.html.erb_spec.rb' - - 'spec/views/admin/content_pages/new.html.erb_spec.rb' - - 'spec/views/admin/content_pages/show.html.erb_spec.rb' - - 'spec/views/content/index.html.erb_spec.rb' - -# Offense count: 34 -# Configuration parameters: AssignmentOnly. -RSpec/InstanceVariable: - Exclude: - - 'spec/models/content_page_spec.rb' - - 'spec/views/admin/content_pages/edit.html.erb_spec.rb' - - 'spec/views/admin/content_pages/index.html.erb_spec.rb' - - 'spec/views/admin/content_pages/show.html.erb_spec.rb' - - 'spec/views/content/index.html.erb_spec.rb' - -# Offense count: 11 -# This cop supports safe autocorrection (--autocorrect). -RSpec/LeadingSubject: - Exclude: - - 'spec/requests/admin/content_blocks_spec.rb' - - 'spec/requests/admin/content_page_versions_spec.rb' - - 'spec/requests/admin/content_pages_spec.rb' - - 'spec/requests/admin/user_request_spec.rb' - - 'spec/requests/feedbacks_spec.rb' - -# Offense count: 74 -# Configuration parameters: EnforcedStyle, IgnoreSharedExamples. -# SupportedStyles: always, named_only -RSpec/NamedSubject: - Exclude: - - 'spec/requests/admin/content_blocks_spec.rb' - - 'spec/requests/admin/content_page_versions_spec.rb' - - 'spec/requests/admin/content_pages_spec.rb' - - 'spec/requests/admin/user_request_spec.rb' - - 'spec/requests/feedbacks_spec.rb' - -# Offense count: 5 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: not_to, to_not -RSpec/NotToNot: - Exclude: - - 'spec/models/content_page_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: numeric, symbolic, be_status -RSpec/Rails/HttpStatus: - Exclude: - - 'spec/requests/errors_page_request_spec.rb' - # Offense count: 1 RSpec/StubbedMock: Exclude: @@ -224,24 +30,3 @@ RSpec/StubbedMock: RSpec/VerifiedDoubles: Exclude: - 'spec/lib/rack/reject_trace_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: slashes, arguments -Rails/FilePath: - Exclude: - - 'spec/rails_helper.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Style/RedundantFreeze: - Exclude: - - 'app/models/content_page.rb' - -# Offense count: 998 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. -# SupportedStyles: single_quotes, double_quotes -Style/StringLiterals: - Enabled: false diff --git a/Gemfile b/Gemfile index eb717bbb..3b018670 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source "https://rubygems.org" +source 'https://rubygems.org' ruby '3.2.2' @@ -8,7 +8,7 @@ gem 'audited', '~> 5.4' gem 'bcrypt', '~> 3.1.16' gem 'bootsnap', '>= 1.17.1', require: false gem 'canonical-rails', '~> 0.2' -gem "contentful_rails", "~> 0.5.0" +gem 'contentful_rails', '~> 0.5.0' gem 'cssbundling-rails' gem 'devise', '>= 4.9.3' gem 'devise-security', '~> 0.18.0' @@ -18,21 +18,18 @@ gem 'dry-initializer' gem 'dry-struct' gem 'dry-types' gem 'friendly_id', '~> 5.5' -gem 'govspeak', '~> 8.3' gem 'govuk-components' gem 'govuk_design_system_formbuilder' -gem 'govuk_markdown', '~> 2.0' -gem 'haml', '~> 5.2' +gem 'govuk_markdown' gem 'htmlentities', '4.3.4' gem 'jsbundling-rails' gem 'pg', '~> 1.1' gem 'puma', '~> 5.6' -gem 'pundit', '~> 2.1' gem 'rails', '~> 7.0.8' gem 'sentry-rails' gem 'sentry-ruby' -gem 'slim-rails', '~> 3.6' -gem "sprockets-rails", "~> 3.4" +gem 'slim-rails' +gem 'sprockets-rails', '~> 3.4' gem 'turbo-rails' gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] @@ -52,9 +49,14 @@ group :development, :test do end group :development do + gem 'better_errors' + gem 'binding_of_caller' + gem 'brakeman' gem 'listen', '>= 3.0.5', '< 3.8' + gem 'pry-doc' gem 'rladr' - gem 'web-console', '>= 3.3.0' + gem 'web-console' + gem 'yard-junk' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 5571a866..493e29b2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,11 +97,20 @@ GEM descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) + backports (3.25.0) bcrypt (3.1.20) + better_errors (2.10.1) + erubi (>= 1.0.0) + rack (>= 0.9.0) + rouge (>= 1.0.0) bigdecimal (3.1.6) bindex (0.8.1) + binding_of_caller (1.0.1) + debug_inspector (>= 1.2.0) bootsnap (1.17.1) msgpack (~> 1.2) + brakeman (6.1.2) + racc builder (3.2.4) byebug (11.1.3) canonical-rails (0.2.15) @@ -115,6 +124,7 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) + choice (0.2.0) coderay (1.1.3) coercible (1.0.0) descendants_tracker (~> 0.0.1) @@ -171,6 +181,7 @@ GEM cucumber-cucumber-expressions (~> 12.1, >= 12.1.1) cucumber-messages (~> 15.0, >= 15.0.0) date (3.3.4) + debug_inspector (1.2.0) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) devise (4.9.3) @@ -228,39 +239,10 @@ GEM activerecord (>= 4.0.0) globalid (1.2.1) activesupport (>= 6.1) - google-protobuf (3.25.2) - google-protobuf (3.25.2-aarch64-linux) - google-protobuf (3.25.2-arm64-darwin) - google-protobuf (3.25.2-x86_64-darwin) - google-protobuf (3.25.2-x86_64-linux) - googleapis-common-protos-types (1.11.0) - google-protobuf (~> 3.18) - govspeak (8.3.2) - actionview (>= 6) - addressable (>= 2.3.8, < 3) - govuk_publishing_components (>= 35.1) - htmlentities (~> 4) - i18n (>= 0.7) - kramdown (>= 2.3.1) - nokogiri (~> 1.12) - rinku (~> 2.0) - sanitize (~> 6) govuk-components (4.1.2) html-attributes-utils (~> 1.0.0, >= 1.0.0) pagy (~> 6.0) view_component (>= 3.3, < 3.7) - govuk_app_config (9.8.1) - logstasher (~> 2.1) - opentelemetry-exporter-otlp (>= 0.25, < 0.27) - opentelemetry-instrumentation-all (>= 0.39.1, < 0.55.0) - opentelemetry-sdk (~> 1.2) - plek (>= 4, < 6) - prometheus_exporter (~> 2.0) - puma (>= 5.6, < 7.0) - rack-proxy (~> 0.7) - sentry-rails (~> 5.3) - sentry-ruby (~> 5.3) - statsd-ruby (~> 1.5) govuk_design_system_formbuilder (4.1.1) actionview (>= 6.1) activemodel (>= 6.1) @@ -269,21 +251,6 @@ GEM govuk_markdown (2.0.1) activesupport redcarpet - govuk_personalisation (0.15.0) - plek (>= 1.9.0) - rails (>= 6, < 8) - govuk_publishing_components (37.2.2) - govuk_app_config - govuk_personalisation (>= 0.7.0) - kramdown - plek - rails (>= 6) - rouge - sprockets (>= 3) - sprockets-rails - haml (5.2.2) - temple (>= 0.8.0) - tilt html-attributes-utils (1.0.2) activesupport (>= 6.1.4.4) htmlentities (4.3.4) @@ -303,17 +270,12 @@ GEM jsbundling-rails (1.2.2) railties (>= 6.0.0) json (2.7.1) - kramdown (2.4.0) - rexml language_server-protocol (3.17.0.3) launchy (2.5.0) addressable (~> 2.7) listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logstasher (2.1.5) - activesupport (>= 5.2) - request_store loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -356,200 +318,6 @@ GEM racc (~> 1.4) nokogiri (1.16.0-x86_64-linux) racc (~> 1.4) - opentelemetry-api (1.2.3) - opentelemetry-common (0.20.0) - opentelemetry-api (~> 1.0) - opentelemetry-exporter-otlp (0.26.1) - google-protobuf (~> 3.14) - googleapis-common-protos-types (~> 1.3) - opentelemetry-api (~> 1.1) - opentelemetry-common (~> 0.20) - opentelemetry-sdk (~> 1.2) - opentelemetry-semantic_conventions - opentelemetry-instrumentation-action_pack (0.8.0) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-rack (~> 0.21) - opentelemetry-instrumentation-action_view (0.7.0) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-active_support (~> 0.1) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-active_job (0.7.1) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-active_model_serializers (0.20.1) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-active_record (0.7.0) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - ruby2_keywords - opentelemetry-instrumentation-active_support (0.5.1) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-all (0.54.0) - opentelemetry-instrumentation-active_model_serializers (~> 0.20.1) - opentelemetry-instrumentation-aws_sdk (~> 0.5.0) - opentelemetry-instrumentation-bunny (~> 0.21.0) - opentelemetry-instrumentation-concurrent_ruby (~> 0.21.1) - opentelemetry-instrumentation-dalli (~> 0.25.0) - opentelemetry-instrumentation-delayed_job (~> 0.22.0) - opentelemetry-instrumentation-ethon (~> 0.21.1) - opentelemetry-instrumentation-excon (~> 0.22.0) - opentelemetry-instrumentation-faraday (~> 0.23.1) - opentelemetry-instrumentation-grape (~> 0.1.3) - opentelemetry-instrumentation-graphql (~> 0.27.0) - opentelemetry-instrumentation-gruf (~> 0.1.0) - opentelemetry-instrumentation-http (~> 0.23.1) - opentelemetry-instrumentation-http_client (~> 0.22.1) - opentelemetry-instrumentation-koala (~> 0.20.1) - opentelemetry-instrumentation-lmdb (~> 0.22.1) - opentelemetry-instrumentation-mongo (~> 0.22.1) - opentelemetry-instrumentation-mysql2 (~> 0.25.0) - opentelemetry-instrumentation-net_http (~> 0.22.1) - opentelemetry-instrumentation-pg (~> 0.26.0) - opentelemetry-instrumentation-que (~> 0.7.0) - opentelemetry-instrumentation-racecar (~> 0.3.0) - opentelemetry-instrumentation-rack (~> 0.23.1) - opentelemetry-instrumentation-rails (~> 0.29.0) - opentelemetry-instrumentation-rake (~> 0.2.1) - opentelemetry-instrumentation-rdkafka (~> 0.4.0) - opentelemetry-instrumentation-redis (~> 0.25.1) - opentelemetry-instrumentation-resque (~> 0.5.0) - opentelemetry-instrumentation-restclient (~> 0.22.1) - opentelemetry-instrumentation-ruby_kafka (~> 0.21.0) - opentelemetry-instrumentation-sidekiq (~> 0.25.0) - opentelemetry-instrumentation-sinatra (~> 0.23.1) - opentelemetry-instrumentation-trilogy (~> 0.57.0) - opentelemetry-instrumentation-aws_sdk (0.5.0) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-base (0.22.3) - opentelemetry-api (~> 1.0) - opentelemetry-registry (~> 0.1) - opentelemetry-instrumentation-bunny (0.21.1) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-concurrent_ruby (0.21.2) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-dalli (0.25.0) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-delayed_job (0.22.1) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-ethon (0.21.3) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-excon (0.22.0) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-faraday (0.23.4) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-grape (0.1.6) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-rack (~> 0.21) - opentelemetry-instrumentation-graphql (0.27.0) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-gruf (0.1.1) - opentelemetry-api (>= 1.0.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-http (0.23.2) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-http_client (0.22.3) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-koala (0.20.2) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-lmdb (0.22.1) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-mongo (0.22.2) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-mysql2 (0.25.0) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-net_http (0.22.4) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-pg (0.26.1) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-que (0.7.1) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-racecar (0.3.0) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-rack (0.23.5) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-rails (0.29.1) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-action_pack (~> 0.8.0) - opentelemetry-instrumentation-action_view (~> 0.7.0) - opentelemetry-instrumentation-active_job (~> 0.7.0) - opentelemetry-instrumentation-active_record (~> 0.7.0) - opentelemetry-instrumentation-active_support (~> 0.5.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-rake (0.2.1) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-rdkafka (0.4.2) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-redis (0.25.3) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-resque (0.5.0) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-restclient (0.22.3) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-ruby_kafka (0.21.0) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-sidekiq (0.25.0) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-sinatra (0.23.2) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.20.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-instrumentation-rack (~> 0.21) - opentelemetry-instrumentation-trilogy (0.57.0) - opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.22.1) - opentelemetry-semantic_conventions (>= 1.8.0) - opentelemetry-registry (0.3.0) - opentelemetry-api (~> 1.1) - opentelemetry-sdk (1.3.1) - opentelemetry-api (~> 1.1) - opentelemetry-common (~> 0.20) - opentelemetry-registry (~> 0.2) - opentelemetry-semantic_conventions - opentelemetry-semantic_conventions (1.10.0) - opentelemetry-api (~> 1.0) orm_adapter (0.5.0) pagy (6.2.0) parallel (1.24.0) @@ -557,9 +325,6 @@ GEM ast (~> 2.4.1) racc pg (1.5.4) - plek (5.0.0) - prometheus_exporter (2.1.0) - webrick protobuf-cucumber (3.10.8) activesupport (>= 3.2) middleware @@ -571,15 +336,14 @@ GEM pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) + pry-doc (1.5.0) + pry (~> 0.11) + yard (~> 0.9.11) public_suffix (5.0.4) puma (5.6.8) nio4r (~> 2.0) - pundit (2.3.1) - activesupport (>= 3.0.0) racc (1.7.3) rack (2.2.8) - rack-proxy (0.7.7) - rack rack-test (2.1.0) rack (>= 1.3) rails (7.0.8) @@ -600,6 +364,11 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) + rails-erd (1.7.2) + activerecord (>= 4.2) + activesupport (>= 4.2) + choice (~> 0.2.0) + ruby-graphviz (~> 1.2) rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) @@ -623,7 +392,6 @@ GEM actionpack (>= 5.2) railties (>= 5.2) rexml (3.2.6) - rinku (2.0.6) rladr (1.2.0) rouge (4.2.0) rspec (3.10.0) @@ -684,12 +452,10 @@ GEM rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) + ruby-graphviz (1.2.5) + rexml ruby-progressbar (1.13.0) - ruby2_keywords (0.0.5) rubyzip (2.3.2) - sanitize (6.1.0) - crass (~> 1.0.2) - nokogiri (>= 1.12.0) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) @@ -728,7 +494,6 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - statsd-ruby (1.5.0) sys-uname (1.2.2) ffi (~> 1.1) temple (0.8.2) @@ -763,13 +528,17 @@ GEM nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0, < 4.11) - webrick (1.8.1) websocket (1.2.9) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) + yard (0.9.36) + yard-junk (0.0.9) + backports (>= 3.18) + rainbow + yard zeitwerk (2.6.12) PLATFORMS @@ -789,7 +558,10 @@ DEPENDENCIES axe-core-selenium axe-matchers (~> 2.6) bcrypt (~> 3.1.16) + better_errors + binding_of_caller bootsnap (>= 1.17.1) + brakeman byebug canonical-rails (~> 0.2) capybara (~> 3.36) @@ -807,20 +579,20 @@ DEPENDENCIES factory_bot_rails (~> 6.2) faker (~> 2.18) friendly_id (~> 5.5) - govspeak (~> 8.3) govuk-components govuk_design_system_formbuilder - govuk_markdown (~> 2.0) - haml (~> 5.2) + govuk_markdown htmlentities (= 4.3.4) jsbundling-rails launchy listen (>= 3.0.5, < 3.8) pg (~> 1.1) pry-byebug (~> 3.9) + pry-doc puma (~> 5.6) - pundit (~> 2.1) rails (~> 7.0.8) + rails-erd + redcarpet rladr rspec (~> 3.10) rspec-expectations (~> 3.10) @@ -832,12 +604,13 @@ DEPENDENCIES sentry-rails sentry-ruby simplecov (~> 0.21) - slim-rails (~> 3.6) + slim-rails sprockets-rails (~> 3.4) turbo-rails tzinfo-data - web-console (>= 3.3.0) + web-console webdrivers + yard-junk RUBY VERSION ruby 3.2.2p53 diff --git a/Rakefile b/Rakefile index 575a8650..c26d1aa2 100644 --- a/Rakefile +++ b/Rakefile @@ -1,8 +1,8 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require_relative "config/application" +require_relative 'config/application' Rails.application.load_tasks -task default: ["spec", "lint:ruby", "lint:scss"] +task default: ['spec', 'lint:ruby', 'lint:scss'] diff --git a/app/assets/stylesheets/SCSS_README.md b/app/assets/stylesheets/SCSS_README.md deleted file mode 100644 index b5605b04..00000000 --- a/app/assets/stylesheets/SCSS_README.md +++ /dev/null @@ -1,59 +0,0 @@ -# How the markdown is styled - -There are two kinds of html in this CMS, the first is static and we style that in -the normal way. - -The second is dynamically generated html, produced from markdown. It is this second -case that is the problem. - -## The problem - -The GovSpeak gem produces bare HTML, with no class attributes. - -But the [Gov Front End package](https://github.com/alphagov/govuk-frontend) assumes -all elements will be decorated with classes. - -So if we do nothing, the Editor's markdown will not look like a government web site. - -## The answer - -We added a parent class called gem-c-govspeak to an element that contains all of the HTML that is produced from -the markdown, - -``` - <main id="main-content" class="app-content gem-c-govspeak" role="main"> - <%= yield %> - </main> -``` - -The SCSS then includes selectors based on .gem-c-govspeak to apply copies of the normal Gov Front End styles -This is done using @mixin to. For example see how govspeak/_typography.scss mixes in -govspeak/helpers/_markdown-typography.scss. - -``` -@import "./helpers/markdown-typography"; - -// ... edited - -.gem-c-govspeak { - @include markdown-typography; - -``` - -As well as doing this in the pages seen by the public, we also do the same thing in the -form used by editors, see how the class gem-c-govspeak is applied in -app/views/content_pages/_form.html.erb - -``` - <div class="govuk-grid-column-one-half"> - <h3 class="govuk-heading-m">Live Preview</h3> - <div id='markdown-render' class='gem-c-govspeak'> - <%= sanitize @md %> - </div> - </div> -``` - -## Updating the styles -Because the markdown styling is copied, it will need to be kept in step with the Gov Front End, but -its not likely to change often. - diff --git a/app/assets/stylesheets/_cards.scss b/app/assets/stylesheets/_cards.scss deleted file mode 100644 index 2d44370d..00000000 --- a/app/assets/stylesheets/_cards.scss +++ /dev/null @@ -1,256 +0,0 @@ -//styles for the NHScard component - -$card-border-width: 1px; -$card-border-bottom-width: 3px; -$card-border-color: #1d70b8; -$card-border-hover-color: #003078; - -.eyfs-card { - @include govuk-responsive-margin(5, 'bottom'); - - background: govuk-colour("white"); - border-bottom: $card-border-width solid $card-border-color; - position: relative; - width: 100%; -} - -.eyfs-card__content { - // @include top-and-bottom(); - @include govuk-responsive-padding(5); - position: relative; - display: flex; - align-items: center; - justify-content: space-between; -} - -.eyfs-card__heading, -.eyfs-card__metadata, -.eyfs-card__description { - margin-bottom: govuk-spacing(3); -} - -/* Clickable card - ========================================================================== */ - -.eyfs-card--clickable { - border-bottom-width: $card-border-bottom-width; - - &:hover, - &:active { - cursor: pointer; - - .eyfs-card__heading a, - .eyfs-card__link { - color: $govuk-link-hover-colour; - text-decoration: none; - - &:focus { - color: $govuk-focus-colour; - } - } - - } - - &:hover { - border-color: $card-border-hover-color; - } - - &:active { - border-color: $card-border-hover-color; - border-bottom-width: 0; - bottom: - $card-border-width; - } -} - -.eyfs-card-group { - display: flex; - flex-wrap: wrap; - - margin-bottom: govuk-spacing(2); - padding: 0; - - @include mq($until: desktop) { - margin-bottom: govuk-spacing(6); - } -} - -.eyfs-card-group__item { - display: flex; - - list-style-type: none; - margin-bottom: 0; - - .eyfs-card { - margin-bottom: govuk-spacing(5); - } - - @include mq($until: desktop) { - - .eyfs-card { - margin-bottom: govuk-spacing(3); - } - } - - .eyfs-card--feature { - margin-top: 0; - } -} - -.eyfs-card-group--list { - .eyfs-card-group__item { - &:not(:last-child) { - .eyfs-card { - border-bottom-width: 0; - margin-bottom: 0; - } - } - } -} - -.eyfs-card--icon { - background-position: right 8px top 50%; - background-repeat: no-repeat; - min-width: 30px; - max-width: 30px; - - @include mq($until: desktop) { - background-position: right 4px top 50%; - } -} - -/* With icon - ========================================================================== */ - -.eyfs-card--link { - a { - text-decoration: none; - } - - &.eyfs-card--clickable { - &:hover, - &:active { - a { - text-decoration: underline; - - &:hover { - text-decoration: underline; - } - - &:focus { - text-decoration: none; - } - } - } - } -} - - -/* Articles cards - ========================================================================== */ - - .article-card-group { - display: grid; - grid-template-columns: repeat(auto-fill, calc(13rem + 10px)); - justify-content: space-around; - margin-bottom: govuk-spacing(2); - padding: 0; - - @include mq($until: desktop) { - margin-bottom: govuk-spacing(6); - } - } - - .article-card { - @include govuk-responsive-margin(5, 'bottom'); - background: govuk-colour("white"); - position: relative; - width: 13rem; - box-shadow: 0px 4px 3px 0px rgba(0,0,0,0.2); - } - - .article-card-img-container { - max-height: 11rem; - max-width: 13rem; - } - - .article-card-img { - object-fit: cover; - height: 11rem; - width: 13rem; - } - - .article-card-text { - padding: 4px 16px 4px 16px; - height: 6.5rem; - } - - @media (max-width: 40.0525em){ - .article-card-text { - padding: 4px 16px 4px 16px; - height: 5rem; - } - } - - .article-card-group__item { - display: flex; - - list-style-type: none; - margin-bottom: 0; - - .article-card { - margin-bottom: govuk-spacing(5); - } - - @include mq($until: desktop) { - - .article-card { - margin-bottom: govuk-spacing(3); - } - } - - .article-card--feature { - margin-top: 0; - } - } - - .article-card--clickable { - &:hover, - &:active { - cursor: pointer; - - .article-card__heading a, - .article-card__link { - color: $govuk-link-hover-colour; - text-decoration: none; - - &:focus { - color: $govuk-focus-colour; - } - } - - } - } - - .article-card--link { - a { - text-decoration: none; - color: $govuk-text-colour !important; - } - - &.article-card--clickable { - &:hover, - &:active { - a { - text-decoration: underline; - - &:hover { - text-decoration: underline; - } - - &:focus { - text-decoration: none; - } - } - } - } - } \ No newline at end of file diff --git a/app/assets/stylesheets/_cms.scss b/app/assets/stylesheets/_cms.scss deleted file mode 100644 index f16e6af5..00000000 --- a/app/assets/stylesheets/_cms.scss +++ /dev/null @@ -1,47 +0,0 @@ -#content-asset-wrapper { - padding-top: govuk-spacing(6); -} - -.image-wrapper { - padding-top: govuk-spacing(6); -} - -.align-right { - text-align:right; -} - -.nesting_level_1 { - margin-left: 0em; -} - -.nesting_level_2 { - margin-left: 2em; -} - -.nesting_level_3 { - margin-left: 4em; -} - -#markdown-editor, #article-markdown-field { - height: 350px; -} - -#intro-editor, #content-list-editor { - height: 150px; -} - -.copy-to-clipboard { - margin-bottom: 20px; - background: #f3f2f1; - padding: 10px; -} - -.summary { - border-left: 3px solid #ccc; - padding-left: 1em; -} - -.links { - margin-left: 3em; - font-size: 0.5em; -} diff --git a/app/assets/stylesheets/_eyfs-header.scss b/app/assets/stylesheets/_eyfs-header.scss index ed3065cb..bca2c40f 100644 --- a/app/assets/stylesheets/_eyfs-header.scss +++ b/app/assets/stylesheets/_eyfs-header.scss @@ -1,63 +1,62 @@ @include govuk-exports("app-header") { - // Move the blue border from the container to the header so that it spans - // the full width of the page - .app-header { - border-bottom: 10px solid $govuk-brand-colour; - } - - .app-header__container { - margin-bottom: 0; - border-bottom: 0; + // Move the blue border from the container to the header so that it spans + // the full width of the page + .app-header { + border-bottom: 10px solid $govuk-brand-colour; + } + + .app-header__container { + margin-bottom: 0; + border-bottom: 0; + } + + // Override the default 33% width on the logo in GOV.UK Frontend (prevents + // unnecessary wrapping of "GOV.UK Design System" on smaller tablet / desktop + // viewports) + .app-header__logo { + width: auto; + display: inline-block; + } + + .app-header-mobile-nav-toggler-wrapper { + display: block; + float: right; + } + + + + .app-header-mobile-nav-toggler { + display: none; + min-height: 40px; // match the height of the search box + + margin-bottom: govuk-spacing(2); + padding-right: govuk-spacing(1); + padding-left: govuk-spacing(1); + border: 1px solid transparent; // Override the button default border, keep this around for when users change their colours + box-shadow: none; // Override the button default box shadow + + &, + &:hover { + background-color: transparent; // Override the button default green } - - // Override the default 33% width on the logo in GOV.UK Frontend (prevents - // unnecessary wrapping of "GOV.UK Design System" on smaller tablet / desktop - // viewports) - .app-header__logo { - width: auto; - display: inline-block; + + &::after { + @include govuk-shape-arrow($direction: down, $base: 10px, $display: inline-block); + content: ""; + margin-left: govuk-spacing(1); + border-top-color: currentColor; } - - .app-header-mobile-nav-toggler-wrapper { - display: block; - float: right; + + &--active::after { + @include govuk-shape-arrow($direction: up, $base: 10px, $display: inline-block); + border-bottom-color: currentColor; } - - - - .app-header-mobile-nav-toggler { - display: none; - min-height: 40px; // match the height of the search box - - margin-bottom: govuk-spacing(2); - padding-right: govuk-spacing(1); - padding-left: govuk-spacing(1); - border: 1px solid transparent; // Override the button default border, keep this around for when users change their colours - box-shadow: none; // Override the button default box shadow - - &, - &:hover { - background-color: transparent; // Override the button default green - } - - &::after { - @include govuk-shape-arrow($direction: down, $base: 10px, $display: inline-block); - content: ""; - margin-left: govuk-spacing(1); - border-top-color: currentColor; - } - - &--active::after { - @include govuk-shape-arrow($direction: up, $base: 10px, $display: inline-block); - border-bottom-color: currentColor; - } - - .js-enabled & { - @include govuk-media-query($until: tablet) { - display: inline; - } + + .js-enabled & { + @include govuk-media-query($until: tablet) { + display: inline; } } } - \ No newline at end of file +} diff --git a/app/assets/stylesheets/_eyfs-resource-template.scss b/app/assets/stylesheets/_eyfs-resource-template.scss deleted file mode 100644 index 3013b971..00000000 --- a/app/assets/stylesheets/_eyfs-resource-template.scss +++ /dev/null @@ -1,305 +0,0 @@ -.govspeak-embed-container { - position: relative; - overflow: hidden; - width: 100%; - padding-top: 66.6%; - - .govspeak-embed-video { - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - width: 100%; - height: 100%; - } -} - -.eyfs-helpful-tools { - border-top: 2px solid govuk-colour("blue"); - @include govuk-responsive-padding(6, "top"); -} - -.app-back-to-top__icon { - display: inline-block; - width: .8em; - height: 1em; - margin-top: -5px; - margin-right: 10px; - vertical-align: middle; -} - -.gem-c-print-link { - display: none -} - -.gem-c-print-link.gem-c-print-link--show-without-js { - display: block -} - -.js-enabled .gem-c-print-link { - display: block -} - -.gem-c-print-link__link, -.gem-c-print-link__button { - background: url('icon-print@1x.png') no-repeat 10px 50%; - background-size: 16px 18px; - padding: 10px 10px 10px 36px -} - -@media only screen and (-webkit-min-device-pixel-ratio: 2), -only screen and (min-resolution: 192dpi), -only screen and (min-resolution: 2dppx) { - - .gem-c-print-link__link, - .gem-c-print-link__button { - background-image: url('icon-print@1x.png') - } -} - -.gem-c-print-link__link:hover, -.gem-c-print-link__button:hover { - background-color: #f3f2f1 -} - -.gem-c-print-link__link { - box-shadow: inset 0 0 0 1px #b1b4b6; - text-decoration: none -} - -.gem-c-print-link__link:focus { - border: 0; - box-shadow: 0 3px #0b0c0c -} - -.gem-c-print-link__button { - border: 1px solid #b1b4b6; - color: #1d70b8; - cursor: pointer; - margin: 0; - font-family: "GDS Transport", arial, sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - font-weight: 400; - font-size: 14px; - font-size: .875rem; - line-height: 1.1428571429; - margin-top: 0; - margin-bottom: 15px -} - -.gem-c-print-link__button:focus { - outline: 3px solid transparent; - color: #0b0c0c; - background-color: #fd0; - box-shadow: 0 -2px #fd0, 0 4px #0b0c0c; - text-decoration: none; - background-color: #fd0; - border-color: transparent -} - - -.gem-c-print-link__button:focus { - outline: 3px solid transparent; - color: #0b0c0c; - background-color: #fd0; - box-shadow: 0 -2px #fd0, 0 4px #0b0c0c; - text-decoration: none; - background-color: #fd0; - border-color: transparent -} - -.gem-c-govspeak .mc-toggle-button, -.govuk-body-s { - color: #0b0c0c; - font-family: "GDS Transport", arial, sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - font-weight: 400; - font-size: 14px; - font-size: .875rem; - line-height: 1.1428571429; - margin-top: 0; - margin-bottom: 15px -} - - -@media print { - - .gem-c-print-link__button, - .gem-c-govspeak .mc-toggle-button, - .govuk-body-s { - color: #000 - } -} - -@media print { - - .gem-c-print-link__button, - .gem-c-govspeak .mc-toggle-button, - .govuk-body-s { - font-family: sans-serif - } -} - -@media (min-width: 40.0625em) { - - .gem-c-print-link__button, - .gem-c-govspeak .mc-toggle-button, - .govuk-body-s { - font-size: 16px; - font-size: 1rem; - line-height: 1.25 - } -} - -@media print { - - .gem-c-print-link__button, - .gem-c-govspeak .mc-toggle-button, - .govuk-body-s { - font-size: 14pt; - line-height: 1.2 - } -} - -@media (min-width: 40.0625em) { - - .gem-c-print-link__button, - .gem-c-govspeak .mc-toggle-button, - .govuk-body-s { - margin-bottom: 20px - } -} - -.call-to-action { - margin: 2em 0; - background-color: #f3f2f1; - padding: 2em -} - -.call-to-action:first-child { - margin-top: 0 -} - -.call-to-action p:last-child, -.call-to-action ul:last-child, -.call-to-action ol:last-child { - margin-bottom: 0 -} - -.eyfs-youtube-video { - position: relative; - height: 0; - overflow: hidden; - margin-top: 10px; - margin-bottom: 10px; - padding-top: 0; - padding-left: 0; - padding-right: 0; - padding-bottom: 56.25%; -} - -.eyfs-youtube-video>iframe { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - border: 0; -} - -.eyfs-topic-images { - display: inline-block; - max-width: 100%; - margin-left: 0; - margin-right: 0; - overflow: hidden; - @include govuk-responsive-margin(1, "bottom"); -} - -// styles for showing ordered steps in govspeak style -.steps { - padding-left: 0; - margin-left: 0; - overflow: hidden -} - -.steps>li { - background-position: 0 .87em; - background-repeat: no-repeat; - list-style-type: decimal; - margin-left: 0; - padding: .75em 0 .75em 2.5em -} - -.steps>li:nth-child(1) { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Ccircle cx='125' cy='125' r='100' fill='black' /%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' alignment-baseline='middle' font-family='sans-serif' font-size='100px' fill='white'%3E1%3C/text%3E%3C/svg%3E"); - background-repeat: no-repeat; - background-position: left 10px; - background-size: 35px 35px -} - -.steps>li:nth-child(2) { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Ccircle cx='125' cy='125' r='100' fill='black' /%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' alignment-baseline='middle' font-family='sans-serif' font-size='100px' fill='white'%3E2%3C/text%3E%3C/svg%3E"); - background-repeat: no-repeat; - background-position: left 10px; - background-size: 35px 35px -} - -.steps>li:nth-child(3) { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Ccircle cx='125' cy='125' r='100' fill='black' /%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' alignment-baseline='middle' font-family='sans-serif' font-size='100px' fill='white'%3E3%3C/text%3E%3C/svg%3E"); - background-repeat: no-repeat; - background-position: left 10px; - background-size: 35px 35px -} - -.steps>li:nth-child(4) { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Ccircle cx='125' cy='125' r='100' fill='black' /%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' alignment-baseline='middle' font-family='sans-serif' font-size='100px' fill='white'%3E4%3C/text%3E%3C/svg%3E"); - background-repeat: no-repeat; - background-position: left 10px; - background-size: 35px 35px -} - -.steps>li:nth-child(5) { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Ccircle cx='125' cy='125' r='100' fill='black' /%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' alignment-baseline='middle' font-family='sans-serif' font-size='100px' fill='white'%3E5%3C/text%3E%3C/svg%3E"); - background-repeat: no-repeat; - background-position: left 10px; - background-size: 35px 35px -} - -.steps>li:nth-child(6) { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Ccircle cx='125' cy='125' r='100' fill='black' /%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' alignment-baseline='middle' font-family='sans-serif' font-size='100px' fill='white'%3E6%3C/text%3E%3C/svg%3E"); - background-repeat: no-repeat; - background-position: left 10px; - background-size: 35px 35px -} - -.steps>li:nth-child(7) { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Ccircle cx='125' cy='125' r='100' fill='black' /%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' alignment-baseline='middle' font-family='sans-serif' font-size='100px' fill='white'%3E7%3C/text%3E%3C/svg%3E"); - background-repeat: no-repeat; - background-position: left 10px; - background-size: 35px 35px -} - -.steps>li:nth-child(8) { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Ccircle cx='125' cy='125' r='100' fill='black' /%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' alignment-baseline='middle' font-family='sans-serif' font-size='100px' fill='white'%3E8%3C/text%3E%3C/svg%3E"); - background-repeat: no-repeat; - background-position: left 10px; - background-size: 35px 35px -} - -.steps>li:nth-child(9) { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Ccircle cx='125' cy='125' r='100' fill='black' /%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' alignment-baseline='middle' font-family='sans-serif' font-size='100px' fill='white'%3E9%3C/text%3E%3C/svg%3E"); - background-repeat: no-repeat; - background-position: left 10px; - background-size: 35px 35px -} - -.steps>li:nth-child(10) { - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Ccircle cx='125' cy='125' r='100' fill='black' /%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' alignment-baseline='middle' font-family='sans-serif' font-size='100px' fill='white'%3E10%3C/text%3E%3C/svg%3E"); - background-repeat: no-repeat; - background-position: left 10px; - background-size: 35px 35px -} \ No newline at end of file diff --git a/app/assets/stylesheets/_links.scss b/app/assets/stylesheets/_links.scss index 14532040..d3ad2a33 100644 --- a/app/assets/stylesheets/_links.scss +++ b/app/assets/stylesheets/_links.scss @@ -1,17 +1,3 @@ -.gem-c-share-links__link-icon { - position: absolute; - top: 0; - left: 0; - width: 32px; - height: 32px; - line-height: 32px; -} - -.gem-c-share-links__link { - text-decoration: none; - font-weight: 700; -} - .govuk-link, a, .app-step-nav-header__title, .app-step-nav-related__link { font-family: "GDS Transport", arial, sans-serif; -webkit-font-smoothing: antialiased; diff --git a/app/assets/stylesheets/_next-prev.scss b/app/assets/stylesheets/_next-prev.scss deleted file mode 100644 index e5048e7d..00000000 --- a/app/assets/stylesheets/_next-prev.scss +++ /dev/null @@ -1,158 +0,0 @@ -.gem-c-pagination { - display:block; - margin:50px 0 - } - .gem-c-pagination__list { - margin:0; - padding:0 - } - .gem-c-pagination__item { - font-family:"GDS Transport",arial,sans-serif; - -webkit-font-smoothing:antialiased; - -moz-osx-font-smoothing:grayscale; - font-weight:400; - font-size:14px; - font-size:.875rem; - line-height:1.25; - list-style:none - } - .gem-c-govspeak ul.gem-c-pagination__list { - margin-left: 0; - } - @media print { - .gem-c-pagination__item { - font-family:sans-serif - } - } - @media (min-width: 40.0625em) { - .gem-c-pagination__item { - font-size:16px; - font-size:1rem; - line-height:1.25 - } - } - @media print { - .gem-c-pagination__item { - font-size:14pt; - line-height:1.25 - } - } - .gem-c-pagination__item:first-child { - margin-bottom:20px - } - .gem-c-pagination__link { - display:block; - text-decoration:none; - padding-bottom:20px - } - .gem-c-pagination__link:hover, - .gem-c-pagination__link:active, - .gem-c-pagination__link:visited { - color:#1d70b8 - } - .gem-c-pagination__link:hover, - .gem-c-pagination__link:active { - background-color:#f3f2f1 - } - .gem-c-pagination__link:focus { - outline:3px solid transparent; - color:#0b0c0c; - background-color:#fd0; - box-shadow:0 -2px #fd0,0 4px #0b0c0c; - text-decoration:none - } - .gem-c-pagination__link:focus .gem-c-pagination__link-title { - border-top-color:transparent - } - .gem-c-pagination__link:focus .gem-c-pagination__link-icon { - fill:#0b0c0c - } - .gem-c-pagination__link-title { - display:block; - border-top:1px solid #b1b4b6; - padding-top:15px - } - .gem-c-pagination__link-divider { - position:absolute !important; - width:1px !important; - height:1px !important; - margin:0 !important; - padding:0 !important; - overflow:hidden !important; - clip:rect(0 0 0 0) !important; - -webkit-clip-path:inset(50%) !important; - clip-path:inset(50%) !important; - border:0 !important; - white-space:nowrap !important - } - .gem-c-pagination__link-text { - font-family:"GDS Transport",arial,sans-serif; - -webkit-font-smoothing:antialiased; - -moz-osx-font-smoothing:grayscale; - font-weight:700; - font-size:16px; - font-size:1rem; - line-height:1.25; - margin-left:10px - } - @media print { - .gem-c-pagination__link-text { - font-family:sans-serif - } - } - @media (min-width: 40.0625em) { - .gem-c-pagination__link-text { - font-size:19px; - font-size:1.1875rem; - line-height:1.3157894737 - } - } - @media print { - .gem-c-pagination__link-text { - font-size:14pt; - line-height:1.15 - } - } - .gem-c-pagination__link-icon { - font-family:"GDS Transport",arial,sans-serif; - -webkit-font-smoothing:antialiased; - -moz-osx-font-smoothing:grayscale; - font-weight:400; - font-size:18px; - font-size:1.125rem; - line-height:1.25; - display:inline-block; - margin-bottom:1px; - height:.482em; - width:.63em; - fill:#505a5f - } - @media print { - .gem-c-pagination__link-icon { - font-family:sans-serif - } - } - @media (min-width: 40.0625em) { - .gem-c-pagination__link-icon { - font-size:24px; - font-size:1.5rem; - line-height:1.25 - } - } - @media print { - .gem-c-pagination__link-icon { - font-size:18pt; - line-height:1.25 - } - } - .gem-c-pagination__link-label { - display:inline-block; - margin-top:.1em; - text-decoration:underline; - margin-left:25px - } - @media (min-width: 40.0625em) { - .gem-c-pagination__link-label { - margin-left:30px - } - } diff --git a/app/assets/stylesheets/application.sass.scss b/app/assets/stylesheets/application.sass.scss deleted file mode 100644 index 755661dc..00000000 --- a/app/assets/stylesheets/application.sass.scss +++ /dev/null @@ -1,197 +0,0 @@ -$govuk-global-styles: true; -$govuk-new-link-styles: true; -$govuk-assets-path: "/"; - -@function frontend-font-url($filename){ -@return url($filename); -} - -@function frontend-image-url($filename){ -@return url($filename); -} - -$govuk-font-url-function: frontend-font-url; -$govuk-image-url-function: frontend-image-url; - -@import "govuk-frontend/govuk/all"; -@import "govspeak"; - -// See SCSS_README.md for an explanation - -@import "_subnav.scss"; -@import "_eyfs-header.scss"; -@import "_eyfs-mobile-navigation.scss"; -@import "_eyfs-resource-template.scss"; -@import "_cookie-banner.scss"; -@import "_next-prev.scss"; -@import "_cards"; -@import "layout-eyfs/landing-page.scss"; -@import "_cms.scss"; -@import "_links.scss"; -@import "_flash.scss"; - -.email { - word-wrap: break-word; -} - -/* Tooltip container */ -.tooltip { - position: relative; - display: inline-block; -} - -/* Tooltip text */ -.tooltip .tooltiptext { - visibility: hidden; - width: 480px; - background-color: #555; - color: #fff; - padding: 5px 0; - border-radius: 6px; - - /* Position the tooltip text */ - position: absolute; - z-index: 1; - bottom: 125%; - left: 50%; - - /* Fade in tooltip */ - opacity: 0; - transition: opacity 0.3s; -} - -/* Tooltip arrow */ -.tooltip .tooltiptext::after { - content: ""; - position: absolute; - top: 100%; - left: 50%; - margin-left: -5px; - border-width: 5px; - border-style: solid; - border-color: #555 transparent transparent transparent; -} - -/* Show the tooltip text when you mouse over the tooltip container */ -.tooltip:hover .tooltiptext { - visibility: visible; - opacity: 1; -} - -#password-tooltip { - color: white; - margin: 5px; -} - -#add-user, -#add-article, -.govuk-tag { - float: right; -} - -.fixed-footer { - background: #FFFFFF; - position: fixed; - bottom: 0; - left: 0; - width: 100%; - padding-top: 1em; - padding-left: 1em; - border-top: 1px solid #eee; -} - -.published-status { - text-align: right; - background-color: #1d70b8 !important; -} - -.draft { - text-align: right; -} - -.light-grey-box { - padding: govuk-spacing(5); - margin-bottom: govuk-spacing(5); - background: govuk-colour("light-grey"); - - .govuk-button { - margin: 0; - } -} - -.gem-c-emergency-banner { - @include govuk-font(19); - background-color: govuk-colour("black"); - color: govuk-colour("white"); - margin-top: 2px; - padding: govuk-spacing(3) 0; - - @include govuk-media-query($from: tablet) { - padding: govuk-spacing(6) 0; - } -} - -.gem-c-emergency-banner--homepage { - border-bottom: govuk-spacing(1) solid govuk-colour("white"); - border-top: govuk-spacing(1) solid govuk-colour("white"); - margin-bottom: govuk-spacing(-2); - margin-top: 0; - position: relative; - z-index: 10; -} - -.gem-c-emergency-banner__heading { - @include govuk-font(24, $weight: bold); - margin: 0; -} - -.gem-c-emergency-banner__heading--homepage { - @include govuk-font(48, $weight: bold); - - @include govuk-media-query($from: tablet) { - margin-bottom: govuk-spacing(4); - } -} - -.gem-c-emergency-banner__description { - @include govuk-font(19); - color: govuk-colour("white"); - margin-top: 0; - margin-bottom: govuk-spacing(4); - - &:last-child { - margin-bottom: 0; - } -} - -.gem-c-emergency-banner__description--homepage { - margin: govuk-spacing(4) 0; -} - -.gem-c-emergency-banner__link { - @include govuk-font(19); -} - -.gem-c-emergency-banner__link:link, -.gem-c-emergency-banner__link:visited { - color: govuk-colour("white"); -} - -.gem-c-emergency-banner__link:focus { - @include govuk-focused-text; -} - -.gem-c-emergency-banner--notable-death { - background-color: govuk-colour("black"); -} - -.gem-c-emergency-banner--national-emergency { - // Not using govuk-colour("red") aka #d4351c as that's a slightly different red. - background-color: #b10e1e; -} - -.gem-c-emergency-banner--local-emergency { - // Not using govuk-colour("turquoise") for background colour as - // the contrast was too low with white text - background-color: #00847d; -} diff --git a/app/assets/stylesheets/main.sass.scss b/app/assets/stylesheets/application.scss similarity index 90% rename from app/assets/stylesheets/main.sass.scss rename to app/assets/stylesheets/application.scss index 07182819..0db132a8 100644 --- a/app/assets/stylesheets/main.sass.scss +++ b/app/assets/stylesheets/application.scss @@ -26,11 +26,20 @@ $light-blue: tint($department-for-education-websafe, 90%); @import 'dfe-header'; @import 'hfeyp-v2'; + @import 'dfe/print'; @import 'dfe/about'; @import 'dfe/card'; @import 'dfe/side-nav'; +@import '_subnav'; +@import '_eyfs-header'; +@import '_eyfs-mobile-navigation'; +@import '_cookie-banner'; +@import '_links'; +@import '_flash'; + + * { font-family: BlinkMacSystemFont, @@ -83,27 +92,6 @@ Hero layout } -/* -Internal ------------------------------------------------ -*/ -pre.code-tip { - padding: 0 5px; - color: govuk-colour('red'); - background-color: govuk-colour('light-grey'); -} - -.debug_dump { - background: beige; - - &, - * { - font-family: monospace !important; - } -} - -// -------------------------------------------- - .app-sidebar { padding: govuk-spacing(5) govuk-spacing(3); background-color: govuk-colour('light-grey'); diff --git a/app/assets/stylesheets/dfe/card.scss b/app/assets/stylesheets/dfe/card.scss index e7b1cd3c..6c81136c 100644 --- a/app/assets/stylesheets/dfe/card.scss +++ b/app/assets/stylesheets/dfe/card.scss @@ -1,32 +1,3 @@ -/* -Progress bar -================================================================================ -*/ - -.bar-bg { - height: 8px; - border-radius: 4px; -} - -.bar-progress { - height: 8px; - top: 10px; - border-radius: 4px; -} - -.bar-ball { - width: 17px; - height: 17px; - border-radius: 9px; - top: -4px; - right: 0; -} - - -/* -================================================================================ -*/ - .grid-container { display: flex; flex-direction: column; diff --git a/app/assets/stylesheets/govspeak.scss b/app/assets/stylesheets/govspeak.scss deleted file mode 100644 index 031395c4..00000000 --- a/app/assets/stylesheets/govspeak.scss +++ /dev/null @@ -1,36 +0,0 @@ -@import "../vendor_styles/govspeak/_advisory"; -@import "../vendor_styles/govspeak/attachment"; -@import "../vendor_styles/govspeak/button"; -@import "../vendor_styles/govspeak/call-to-action"; -@import "../vendor_styles/govspeak/charts"; -@import "../vendor_styles/govspeak/contact"; -@import "../vendor_styles/govspeak/example"; -@import "../vendor_styles/govspeak/footnotes"; -@import "../vendor_styles/govspeak/form-download"; -@import "../vendor_styles/govspeak/fraction"; -@import "../vendor_styles/govspeak/highlight-answer"; -@import "../vendor_styles/govspeak/images"; -@import "../vendor_styles/govspeak/information-callout"; -@import "../vendor_styles/govspeak/legislative-list"; -@import "../vendor_styles/govspeak/media-player"; -@import "../vendor_styles/govspeak/place"; -@import "../vendor_styles/govspeak/stat-headline"; -@import "../vendor_styles/govspeak/steps"; -@import "../vendor_styles/govspeak/summary"; -@import "../vendor_styles/govspeak/tables"; -@import "../vendor_styles/govspeak/typography"; -@import "../vendor_styles/govspeak/warning-callout"; - -@import "./govspeak/accordion"; -@import "./govspeak/call-to-action"; -@import "./govspeak/contents-list"; -@import "./govspeak/highlights"; -@import "./govspeak/quote"; -@import "./govspeak/tables"; - -.gem-c-govspeak { - &.direction-rtl { - direction: rtl; - text-align: start; - } -} diff --git a/app/assets/stylesheets/govspeak/_accordion.scss b/app/assets/stylesheets/govspeak/_accordion.scss deleted file mode 100644 index 75615487..00000000 --- a/app/assets/stylesheets/govspeak/_accordion.scss +++ /dev/null @@ -1,7 +0,0 @@ -.gem-c-govspeak { - div.govuk-accordion__section-content { - a { - display: block; - } - } -} diff --git a/app/assets/stylesheets/govspeak/_call-to-action.scss b/app/assets/stylesheets/govspeak/_call-to-action.scss deleted file mode 100644 index c78a477c..00000000 --- a/app/assets/stylesheets/govspeak/_call-to-action.scss +++ /dev/null @@ -1,25 +0,0 @@ -// Govspeak call to action -// https://components.publishing.service.gov.uk/component-guide/govspeak/call_to_action -// -// Support: -// -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -.gem-c-govspeak { - .call-to-action { - margin: 2em 0; - background-color: govuk-colour("light-grey", $legacy: "grey-3"); - padding: 2em; - - &:first-child { - margin-top: 0; - } - - p:last-child, - ul:last-child, - ol:last-child { - margin-bottom: 0; - } - } -} diff --git a/app/assets/stylesheets/govspeak/_contents-list.scss b/app/assets/stylesheets/govspeak/_contents-list.scss deleted file mode 100644 index e8079dd0..00000000 --- a/app/assets/stylesheets/govspeak/_contents-list.scss +++ /dev/null @@ -1,105 +0,0 @@ -.gem-c-govspeak { - - .contents-list__list-item--numbered { - .contents-list__link { - display: table; - } - } - - .contents-list__number, - .contents-list__numbered-text { - display: table-cell; - } - - .contents-list__number { - min-width: 1.5em; - } - - .contents-list__numbered-text { - $contents-text-padding: .3em; - padding-left: $contents-text-padding; - - .direction-rtl & { - padding-left: 0; - padding-right: $contents-text-padding; - } - } - - .contents-list { - // Always render the contents list above a - // back to contents link - position: relative; - margin: 0 0 0 0; - z-index: 1; - background: govuk-colour("white"); - box-shadow: 0 20px 15px -10px govuk-colour("white"); - } - - .contents-list__title { - @include govuk-text-colour; - @include govuk-font($size: 16, $weight: regular, $line-height: 1.5); - margin: 0; - } - - .contents-list__list, - .contents-list__nested-list { - ul, - ol { - margin: 0 - }; - @include govuk-text-colour; - @include govuk-font($size: 16); - margin: 0; - padding: 0; - list-style-type: none; - } - - .contents-list__link { - .contents-list__list-item--parent > & { - font-weight: bold; - } - - } - - .contents-list__list-item { - padding-top: govuk-spacing(2); - line-height: 1.3; - list-style-type: none; - - @include govuk-media-query($from: tablet) { - padding-top: govuk-spacing(6) * 0.25; - } - } - - .contents-list__list-item--dashed { - $contents-spacing: govuk-spacing(5); - position: relative; - padding-left: $contents-spacing; - padding-right: $contents-spacing; - - &:before { - content: "—"; - position: absolute; - left: 0; - width: govuk-spacing(4); - overflow: hidden; - - .direction-rtl & { - left: auto; - right: 0; - } - } - - // Focus styles on IE8 and older include the - // left margin, creating an odd white box with - // orange border around the em dash. - // Use inline-block and vertical alignment to - // fix focus styles - // - // https://github.com/alphagov/government-frontend/pull/420#issuecomment-320632386 - .lte-ie8 & .contents-list__link { - display: inline-block; - vertical-align: top; - } - } -} \ No newline at end of file diff --git a/app/assets/stylesheets/govspeak/_highlights.scss b/app/assets/stylesheets/govspeak/_highlights.scss deleted file mode 100644 index d910e33f..00000000 --- a/app/assets/stylesheets/govspeak/_highlights.scss +++ /dev/null @@ -1,8 +0,0 @@ -.gem-c-govspeak { - .information { - border-style: solid; - border-radius: 9px; - padding: 40px; - margin: 50px; - } -} diff --git a/app/assets/stylesheets/govspeak/_quote.scss b/app/assets/stylesheets/govspeak/_quote.scss deleted file mode 100644 index 0e78e065..00000000 --- a/app/assets/stylesheets/govspeak/_quote.scss +++ /dev/null @@ -1,16 +0,0 @@ -.gem-c-govspeak blockquote { - p:before { - margin-left: 0; - } - p:after { - content: ""; - } - p:last-child:after { - content: ""; - } - p { - border-left: 10px solid #b1b4b6; - padding: 15px; - clear: both; - } -} diff --git a/app/assets/stylesheets/govspeak/_tables.scss b/app/assets/stylesheets/govspeak/_tables.scss deleted file mode 100644 index 2e80c04d..00000000 --- a/app/assets/stylesheets/govspeak/_tables.scss +++ /dev/null @@ -1,40 +0,0 @@ -// Govspeak tables -// https://components.publishing.service.gov.uk/component-guide/govspeak/tables -// -// Support: -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -.gem-c-govspeak { - table { - border-collapse: collapse; - border-spacing: 0; - display: block; - margin: govuk-spacing(6) 0; - overflow-x: auto; - width: 100%; - @include govuk-font($size: 14); - - caption { - text-align: left; - margin-bottom: .5em; - } - - th, - td { - vertical-align: top; - padding: govuk-spacing(2) govuk-spacing(2) govuk-spacing(2) 0; - border-bottom: solid 1px govuk-colour("mid-grey", $legacy: "grey-2"); - } - - th { - @include govuk-font($size: 14, $weight: bold); - text-align: left; - color: $govuk-text-colour; - } - - td small { - font-size: 1em; - } - } -} diff --git a/app/assets/stylesheets/layout-eyfs/landing-page.scss b/app/assets/stylesheets/layout-eyfs/landing-page.scss deleted file mode 100644 index 46da8dac..00000000 --- a/app/assets/stylesheets/layout-eyfs/landing-page.scss +++ /dev/null @@ -1,406 +0,0 @@ -.eyfs-wrapper { - - width: 100%; - -} - -.landing-page_header-text-container { - - @include govuk-responsive-padding(9, "bottom"); - @include govuk-responsive-margin(4, "bottom"); - -} - -.landing-page__section--grey { - - background-color: govuk-colour("light-grey"); - @include govuk-responsive-padding(8, "top"); - @include govuk-responsive-padding(8, "bottom"); - -} - -//page styles - -.articles-landing-page__section--grey { - - background-color: govuk-colour("light-grey"); - box-shadow: 0 -1px 0px 0 rgba(0,0,0,0.2); -} - -.page-responsive-img{ - width: 100%; -} - -//styles for the card component - -.govuk-card__flex-container { - display: flex; - flex-wrap: wrap; -} - -.govuk-card__flex-item { - display: flex; - overflow: hidden; - @include govuk-responsive-margin(1, "bottom"); -} - -.govuk-card__flex-item:last-child { - @include govuk-responsive-margin(0, "bottom"); -} - -.govuk-card { - @include govuk-responsive-margin(6, "bottom"); - @include govuk-responsive-padding(6, "bottom"); - border-bottom: 3px solid govuk-colour("blue"); - box-sizing: border-box; -} - -.eyfs-card-link { - text-decoration: none; -} - -.eyfs-card-link:hover { - text-decoration: underline; -} - -.govuk-card--contained { - background-color: govuk-colour("mid-grey"); -} - -.govuk-card--contained--on-background { - background-color: govuk-colour("white"); -} - -.govuk-card--borderless { - border: 0; - padding-bottom: 0; -} - -.govuk-card--selectable { - position: relative; -} - -.govuk-card--selectable h3 { - color: govuk-colour("blue"); -} - -.govuk-card--selectable a { - position: relative; - z-index: 1; -} - -.govuk-card--selectable:hover { - background-color: govuk-colour("blue"); -} - -.govuk-card--selectable:hover > .govuk-card__content > h3, -.govuk-card--selectable:hover > .govuk-card__content > p, -.govuk-card--selectable:hover > .govuk-card__content > h3 > a, -.govuk-card--selectable:hover > .govuk-card__actions > ul > li > a { - color: govuk-colour("white") !important; -} - -.govuk-card--selectable:hover > .govuk-card__content > h3 > a:hover, -.govuk-card--selectable:hover > .govuk-card__actions > ul > li > a:hover { - color: lighten(govuk-colour("light-blue"), 30%) !important; -} - -.govuk-card--selectable > a { - position: absolute; - top: 0; - left: 0; - height: 100%; - width: 100%; - z-index: 0; -} - -.govuk-card--selectable > a:focus { - background-color: initial !important; -} - - -.govuk-card__hero { - line-height: 0; -} - -.govuk-card__hero img { - max-width: 100%; -} - -.govuk-card__content { - @include govuk-responsive-padding(4, "top"); - padding-bottom: 0; -} - -.govuk-card__content p { - margin-bottom: 0; -} - -.govuk-card__content p + p { - @include govuk-responsive-margin(4, "top"); -} - -.govuk-card--contained .govuk-card__content { - @include govuk-responsive-padding(4, "left"); - @include govuk-responsive-padding(4, "right"); -} - -.govuk-card__actions { - @include govuk-responsive-padding(4, "top"); - padding-bottom: 0; -} - -.govuk-card--contained .govuk-card__actions { - @include govuk-responsive-padding(4, "left"); - @include govuk-responsive-padding(4, "right"); -} - -.govuk-card__actions > .govuk-c-button { - margin-bottom: 0; -} - - -//styles for signup alert -.eyfs-signup-link--with-background-and-border { - - padding: 15px; - background-color: #f3f2f1; - border: 1px solid #b1b4b6; - display: flex; - flex-wrap: wrap; - align-items: center; - -} - -.eyfs-signup-link__inner { - - position: relative; - display: flex; - flex-wrap: wrap; - -} - -.eyfs-signup-link__icon { - - position: relative; - display: inline-block; - margin-right: 5px; - padding-bottom: 2px; - background-size: 100% 100%; - background-repeat: no-repeat; - background-position: center; - height: 18px; - width: 18px; - -} - -.eyfs-signup-link__title { - - margin-bottom: 0px; -} - -.eyfs-signup-link__link { - - font-size: 19px; - line-height: 1.3157894737; - -} - -//styles for top navigation menu -.eyfs-top-nav--with-background-and-border { - - position: -webkit-sticky; - position: sticky; - top: 0; - z-index:1; - background-color: #f3f2f1; - border-top: 1px solid #b1b4b6; - border-bottom: 1px solid #b1b4b6; - max-height: 43px; - -} - -.eyfs-top-nav-inner-div { - - display: flex; - margin-right: auto; - flex-wrap: wrap; - align-items: center; - max-height: 43px; - -} - -.eyfs-top-nav-group { - display:flex; - flex-direction:row; - list-style-type: none; - padding-left:0px; - align-items: center; - margin: 10px 0px 10px 0px; - max-height: 23px; - -} - -.eyfs-top-nav__link { - - font-size: 18px; - font-weight: bold; - line-height: 1.3157894737; - text-decoration: none; - @include govuk-responsive-margin(4, "right"); - padding: 9px 0px 9px 0px; - - &:focus { - background-color: transparent !important; - box-shadow: none !important; - } - - &:active { - background-color: transparent !important; - } -} - -.active, .eyfs-top-nav__link:hover { - color: black !important; - border-bottom: 3px solid #000; -} - -.eyfs-top-nav__link:focus { - background-color: none; -} - -.eyfs-top-nav-anchors:target::before { - content: ""; - display: block; - height: 50px; /* fixed header height*/ - margin: -50px 0 0; /* negative fixed header height */ -} - -//styles for social links - -.gem-c-share-links--columns .gem-c-share-links__list { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(9.5em, 1fr)); -} - -.gem-c-share-links__list { - list-style: none; - margin: 0; - padding: 0; -} - -.gem-c-share-links--columns .gem-c-share-links__list-item { - float: left; - min-width: 9.5em; -} - -.gem-c-share-links__list-item { - box-sizing: border-box; - position: relative; - display: inline-block; - min-height: 32px; - padding-left: 42px; - padding-right: 10px; - margin-bottom: 10px; - font-size: 16px; - line-height: 32px; -} - -.gem-c-share-links--columns .gem-c-share-links__link { - margin: 0; -} - -.gem-c-share-links__link { - text-decoration: none; - font-weight: 700; -} - -.gem-c-share-links__link-icon { - position: absolute; - top: 0; - left: 0; - width: 32px; - height: 32px; - line-height: 32px; -} - -//styles for feedback - -.js-enabled { - .gem-c-feedback__js-show, - .gem-c-feedback__prompt-success, - .gem-c-feedback__prompt-questions, - .gem-c-feedback__error-summary { - display: inline-block; - } -} - -.gem-c-feedback { - background: #fff; - margin-top: 30px; -} - -.gem-c-feedback__prompt { - background-color: #1d70b8; - color: #fff; - outline: 0; -} - -.gem-c-feedback__prompt:after { - content: ""; - display: block; - clear: both; -} - -.gem-c-feedback__prompt-questions { - text-align: center; - border-bottom: 1px solid #fff; - padding: 15px 25px 0; - box-sizing: border-box; -} - -.gem-c-feedback__prompt-question { - vertical-align: top; - display: inline-block; - margin: 10px 20px; - font-weight: 700; - color: govuk-colour("white"); -} - -.gem-c-feedback__option-list { - display: inline-block; - margin-right: 10px; - list-style-type: none; - margin: 0; - padding: 0; - margin-top: 10px; -} - -.gem-c-feedback__option-list-item { - display: inline-block; -} - -.gem-c-feedback__option-list-item:first-child { - margin-right: 20px; -} - -.gem-c-feedback__prompt-link { - position: relative; - font-family: "GDS Transport",arial,sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - font-weight: 400; - font-size: 16px; - font-size: 1rem; - line-height: 1.25; - background: transparent; - box-shadow: 0 2px 0 #fff; - border: 1px #fff solid; - min-width: 100px; -} - -@media only screen and (max-width: 350px) { - .gem-c-feedback__prompt-link { - min-width: 10px; - } -} diff --git a/app/assets/vendor_styles/govspeak/_advisory.scss b/app/assets/vendor_styles/govspeak/_advisory.scss deleted file mode 100644 index b3257b16..00000000 --- a/app/assets/vendor_styles/govspeak/_advisory.scss +++ /dev/null @@ -1,33 +0,0 @@ -$info-background: #d5e8f3; -$high-alert-border: #cc0000; - -.gem-c-govspeak .advisory { - background-image: url("/images/icon-important.svg"); - background-repeat: no-repeat; - background-size: 30px 30px; - background-position: 98% center; - background-color: $info-background; - line-height: 1.3em; - margin: 0 -1em 1em; - padding: govuk-spacing(3) govuk-spacing(8) govuk-spacing(3) govuk-spacing(3); - text-align: left; - - p { - margin: 0 .75em 0 0; - min-height: 1.75em; - padding-right: 3em; - } - - strong { - font-weight: 400; - } - - &.high-alert { - background-color: govuk-colour("light-grey", $legacy: "grey-3"); - border: 1px solid $high-alert-border; - } - - @include govuk-media-query($until: tablet) { - margin: 0 0 1em; - } -} \ No newline at end of file diff --git a/app/assets/vendor_styles/govspeak/_attachment.scss b/app/assets/vendor_styles/govspeak/_attachment.scss deleted file mode 100644 index d196e459..00000000 --- a/app/assets/vendor_styles/govspeak/_attachment.scss +++ /dev/null @@ -1,118 +0,0 @@ -// Govspeak attachment -// https://components.publishing.service.gov.uk/component-guide/govspeak/block_attachments -// -// Support: -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -// stylelint-disable max-nesting-depth - -.gem-c-govspeak { - - // Scope attachment and attachment-link component styles to gem-c-govspeak - @import "./helpers/attachment-link"; - @import "./helpers/attachment"; - - // This block is duplicated from Whitehall as a transitional step, see the - // commit message for 2d893c10ee3f2cab27162b9aba38b12379a71d07 before making - // changes, original version: - // https://github.com/alphagov/whitehall/blob/master/app/assets/stylesheets/frontend/helpers/_attachment.scss - $thumbnail-width: 99px; - - .attachment { - position: relative; - margin: govuk-spacing(6) 0; - padding: govuk-spacing(3) 0 0 ($thumbnail-width + govuk-spacing(6)); - @include govuk-clearfix; - - &:first-child { - margin-top: 0; - padding-top: 0; - } - - .attachment-thumb { - position: relative; - float: left; - margin-top: $govuk-border-width; - margin-left: -($thumbnail-width + govuk-spacing(6) - $govuk-border-width); - padding-bottom: govuk-spacing(3); - - img { - display: block; - width: $thumbnail-width; - height: 140px; - background: govuk-colour("white"); - outline: $govuk-border-width solid transparentize(govuk-colour("black"), .9); - - box-shadow: 0 2px 2px rgba(govuk-colour("black"), .4); - } - } - - .attachment-details { - h2 { - @include govuk-font($size: 27); - margin: 0; - } - - p { - margin: govuk-spacing(2) 0; - } - - .metadata { - @include govuk-font($size: 14); - } - - .url { - word-break: break-word; - word-wrap: break-word; - } - - .changed, - .references, - .unnumbered-paper { - display: block; - } - - .preview, - .download { - @include govuk-font($size: 19); - - strong { - font-weight: bold; - } - } - - .preview { - padding-right: govuk-spacing(3); - } - - .opendocument-help { - @include govuk-font($size: 14); - } - - .accessibility-warning { - h2 { - @include govuk-font($size: 14); - margin: 0; - } - - word-break: break-word; - word-wrap: break-word; - } - - .js-hidden { - display: none; - } - } - } - - &.direction-rtl .attachment { - padding: govuk-spacing(3) ($thumbnail-width + govuk-spacing(6)) 0 0; - - .attachment-thumb { - float: right; - margin-left: 0; - margin-right: (($thumbnail-width * -1) - govuk-spacing(3)); - } - } -} \ No newline at end of file diff --git a/app/assets/vendor_styles/govspeak/_button.scss b/app/assets/vendor_styles/govspeak/_button.scss deleted file mode 100644 index a812c49f..00000000 --- a/app/assets/vendor_styles/govspeak/_button.scss +++ /dev/null @@ -1,12 +0,0 @@ -@import "govuk-frontend/govuk/components/button/button"; - -// stylelint-disable scss/at-extend-no-missing-placeholder -.gem-c-govspeak { - .gem-c-button { - @extend .govuk-button; - } - - .govuk-button--start { - @extend .govuk-button--start; - } -} \ No newline at end of file diff --git a/app/assets/vendor_styles/govspeak/_call-to-action.scss b/app/assets/vendor_styles/govspeak/_call-to-action.scss deleted file mode 100644 index c78a477c..00000000 --- a/app/assets/vendor_styles/govspeak/_call-to-action.scss +++ /dev/null @@ -1,25 +0,0 @@ -// Govspeak call to action -// https://components.publishing.service.gov.uk/component-guide/govspeak/call_to_action -// -// Support: -// -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -.gem-c-govspeak { - .call-to-action { - margin: 2em 0; - background-color: govuk-colour("light-grey", $legacy: "grey-3"); - padding: 2em; - - &:first-child { - margin-top: 0; - } - - p:last-child, - ul:last-child, - ol:last-child { - margin-bottom: 0; - } - } -} diff --git a/app/assets/vendor_styles/govspeak/_charts.scss b/app/assets/vendor_styles/govspeak/_charts.scss deleted file mode 100644 index 0dfd191b..00000000 --- a/app/assets/vendor_styles/govspeak/_charts.scss +++ /dev/null @@ -1,297 +0,0 @@ -// Govspeak charts -// https://components.publishing.service.gov.uk/component-guide/govspeak/charts -// Uses Magna Charta (https://github.com/alphagov/magna-charta) -// -// Support: -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -// adapted from magna-charta example stylesheet -// https://github.com/alphagov/magna-charta/blob/master/demo/stylesheets/magna-charta.css - -// stylelint-disable max-nesting-depth - -.gem-c-govspeak { - // DEFAULT CHART STYLES - - $label-width: 40%; // Horizontal width taken up by the bar labels - $label-align: right; // Label alignment - $base-unit: 16px; // For font sizes and related spacing - $compact-font-size: 12px; // For the 'compact' bar style - $bar-padding: 8px; // The padding between the bar values and the edge of the bar - $bar-spacing: 5px; // The spacing around the bars - $stack-spacing: 1px; // For stacked bars, the spacing between each stack in a bar - $caption-side: top; // Caption alignment. Top or bottom. - $key-width: 160px; // Only used by IE. Other browsers get smallest width that fits content - - // CHART COLOUR SCHEME - - $chart-border: govuk-colour("white"); // Chart border colour - $key-border: govuk-colour("white"); // Key border colour - $bar-colours: govuk-colour("blue"), govuk-colour("turquoise"), govuk-colour("green"), govuk-colour("light-green"), govuk-colour("yellow"), govuk-colour("orange"), govuk-colour("red"), govuk-colour("bright-purple", $legacy: "bright-red"); - $bar-text-colours: govuk-colour("white"), govuk-colour("black"), govuk-colour("white"), govuk-colour("black"), govuk-colour("black"), govuk-colour("black"), govuk-colour("white"), govuk-colour("white"); - $bar-cell-colour: govuk-colour("black"); - $bar-outdented-colour: govuk-colour("black"); - - // CHART STYLES - .mc-chart { - font-size: $base-unit; - display: table; - width: 100%; - border-spacing: 0 $bar-spacing; - border: 1px solid $chart-border; - padding: $base-unit 0; - position: relative; - margin-bottom: $base-unit; - - // CAPTION STYLES - .mc-caption { - display: table-caption; - font-size: $base-unit; - text-align: center; - caption-side: $caption-side; - margin: $base-unit 0; - } - - // KEY STYLES - .mc-thead { - background-color: govuk-colour("white"); - display: table-header-group; - padding: $bar-spacing; - border: 1px solid $key-border; - - .mc-th { - display: none; // Hide all header cells first - } - - .mc-key-header { - display: block; // Show the header cells that form part of the key - margin-bottom: $bar-spacing; - margin-left: 100%; - padding-left: $bar-spacing; - border-left: $base-unit solid; - text-align: left; - font-weight: normal; - width: 100%; - - &:last-child { - margin-bottom: 0; - } - } - - // Key colours - @for $i from 0 to length($bar-colours) { - .mc-key-#{$i + 1} { - border-left-color: nth($bar-colours, $i + 1); - } - } - } - - // Right and left aligned keys - &.right-key .mc-thead, - &.left-key .mc-thead { - position: absolute; - top: 100px; - - .mc-key-header { - margin-left: 0; - } - } - - &.right-key .mc-thead { - right: 26px; - } - - &.left-key .mc-thead { - left: 26px; - } - - // Hidden keys - &.no-key .mc-thead { - display: none; - } - - // BAR STYLES - .mc-tbody { - display: table-row-group; - - .mc-tr { - display: table-row; - - // Bars and bar labels - .mc-bar-cell, - .mc-key-cell { - padding-right: $bar-spacing; - margin-right: $stack-spacing; - box-sizing: border-box; - border: 0 solid; - } - - // Bars - .mc-bar-cell { - display: block; - text-align: left; - padding: $bar-padding 0; - margin-bottom: 1px; - color: govuk-colour("white"); - text-indent: $bar-padding; - } - - // Bar colours - @for $i from 0 to length($bar-colours) { - .mc-bar-#{$i + 1} { - background-color: nth($bar-colours, $i + 1); - color: nth($bar-text-colours, $i + 1); - } - } - - // Negative bars - .mc-bar-negative { - text-align: right; - padding-right: $bar-padding; - } - - .mc-value-overflow { - text-indent: -99999px !important; // stylelint-disable-line declaration-no-important - } - - // Bar labels - .mc-key-cell { - width: $label-width; - text-indent: 26px; - text-align: $label-align; - display: table-cell; - vertical-align: middle; - } - } - } - - // STACKED CHARTS - &.mc-stacked { - .mc-stacked-header { - display: none; // Hide the header for the totals column - } - - .mc-th:nth-last-child(2) { - margin-bottom: 0; - } - - .mc-stacked-total { - padding: $bar-padding 0; - background-color: transparent !important; // stylelint-disable-line declaration-no-important - color: govuk-colour("black"); - display: inline-block; - text-indent: 5px; - } - - .mc-tbody .mc-bar-cell { - display: inline-block; - } - } - - // COMPACT CHARTS - &.compact { - .mc-td.mc-bar-cell { - font-size: $compact-font-size; - text-indent: 2px; - padding: 0; - } - } - - // Charts with multiple columns get different coloured bars - $len: length($bar-colours); - - @for $i from 0 to $len { - .mc-tr .mc-td.mc-bar-cell.mc-bar-#{$i + 1} { - background-color: nth($bar-colours, $i + 1); - } - - .mc-tr .mc-th.mc-key-#{$i + 1} { - border-left-color: nth($bar-colours, $i + 1); - } - } - - .mc-td, - .mc-th { - padding: 0; - padding-right: $bar-spacing; - margin-right: $stack-spacing; - border: 0 solid; - - &.mc-bar-cell { - display: block; - background-color: $bar-cell-colour; // Just for testing - text-align: left; - padding: $bar-padding 0; - margin-bottom: 1px; - color: govuk-colour("white"); - text-indent: 4px; - line-height: 1.5; - } - } - - .mc-bar-outdented { - span { - color: $bar-outdented-colour; - } - } - - caption { - caption-side: $caption-side; - } - - .mc-td.mc-key-cell { - width: $label-width; - text-indent: 26px; - text-align: $label-align; - display: table-cell; - vertical-align: middle; - } - - // OUTDENTED BAR VALUES - &.mc-outdented { - .mc-tr { - .mc-bar-cell { - color: $bar-cell-colour; - } - - .mc-bar-negative { - text-align: left; - } - } - } - - &.mc-negative .mc-td.mc-key-cell { - padding-right: 25px; - } - } - - .mc-outdented .mc-bar-cell.mc-bar-negative { - text-align: left; - } - - .mc-toggle-button { - @extend %govuk-body-s; - border: 1px solid $govuk-border-colour; - color: $govuk-link-colour; - cursor: pointer; - margin: govuk-spacing(0); - padding: govuk-spacing(2); - background-color: govuk-colour("white"); - - &:focus { - @include govuk-focused-text; - background-color: $govuk-focus-colour; - border-color: transparent; - } - } - - // Hides the original table - .mc-hidden, - .mc-hidden caption { - display: none; - - // It's reapplied to captions because Firefox can't hide - // table captions unless it's applied directly to it. Go figure. - } -} diff --git a/app/assets/vendor_styles/govspeak/_contact.scss b/app/assets/vendor_styles/govspeak/_contact.scss deleted file mode 100644 index 08762372..00000000 --- a/app/assets/vendor_styles/govspeak/_contact.scss +++ /dev/null @@ -1,51 +0,0 @@ -// Govspeak contact -// https://components.publishing.service.gov.uk/component-guide/govspeak/contact -// -// Support: -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -// stylelint-disable max-nesting-depth - -.gem-c-govspeak { - // .address is used by the `$A` markdown pattern - .address, - .contact { - border-left: 1px solid govuk-colour("mid-grey", $legacy: "grey-2"); - padding-left: govuk-spacing(3); - margin-bottom: govuk-spacing(6); - margin-top: govuk-spacing(6); - } - - .contact { - @include govuk-clearfix; - position: relative; - - .content { - float: none; - width: 100%; - - h3 { - @include govuk-font($size: 19, $weight: bold); - margin-bottom: 5px; - } - - .email-url-number { - .email { - word-wrap: break-word; - } - - span { - display: block; - } - } - - .comments { - @include govuk-font($size: 16); - @include govuk-media-query($from: tablet) { - margin-bottom: 0; - } - } - } - } -} diff --git a/app/assets/vendor_styles/govspeak/_example.scss b/app/assets/vendor_styles/govspeak/_example.scss deleted file mode 100644 index e717b356..00000000 --- a/app/assets/vendor_styles/govspeak/_example.scss +++ /dev/null @@ -1,25 +0,0 @@ -// Govspeak example callout -// https://components.publishing.service.gov.uk/component-guide/govspeak/example -// -// Support: -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -.gem-c-govspeak { - .example { - border-left: 10px solid govuk-colour("mid-grey", $legacy: "grey-3"); - padding: 1em 0 1em 1em; - margin: 2em 0; - - // Remove margin from the last element - p:last-child, - ul:last-child, - ol:last-child { - margin-bottom: 0; - } - - strong { - display: block; - } - } -} diff --git a/app/assets/vendor_styles/govspeak/_footnotes.scss b/app/assets/vendor_styles/govspeak/_footnotes.scss deleted file mode 100644 index 31a67171..00000000 --- a/app/assets/vendor_styles/govspeak/_footnotes.scss +++ /dev/null @@ -1,33 +0,0 @@ -// Govspeak footnotes callout -// https://components.publishing.service.gov.uk/component-guide/govspeak/footnotes -// -// Support: -// -// This appears to be built into kramdown, we're just applying styling to it. -// https://kramdown.gettalong.org/syntax.html#footnotes -// -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -// stylelint-disable max-nesting-depth - -.gem-c-govspeak { - .footnotes { - border-top: 1px solid govuk-colour("mid-grey", $legacy: "grey-2"); - margin-top: govuk-spacing(6); - padding-top: govuk-spacing(2); - - a { - overflow-wrap: break-word; - } - - ol { - margin-top: 0; - padding-top: 0; - - li p { - margin: 10px 0; - } - } - } -} diff --git a/app/assets/vendor_styles/govspeak/_form-download.scss b/app/assets/vendor_styles/govspeak/_form-download.scss deleted file mode 100644 index 332b8462..00000000 --- a/app/assets/vendor_styles/govspeak/_form-download.scss +++ /dev/null @@ -1,21 +0,0 @@ -.gem-c-govspeak .form-download { - padding: .25em 0; - - @include govuk-media-query($until: tablet) { - margin: 1em 0 1.5em; - } - - p { - padding-right: 3em; - } - - a { - display: block; - font-weight: 600; - background-image: url("/images/icon-file-download.svg"); - background-repeat: no-repeat; - background-size: 40px 40px; - min-height: 2.5em; - padding: 0 0 0 50px; - } -} \ No newline at end of file diff --git a/app/assets/vendor_styles/govspeak/_fraction.scss b/app/assets/vendor_styles/govspeak/_fraction.scss deleted file mode 100644 index 3f36125a..00000000 --- a/app/assets/vendor_styles/govspeak/_fraction.scss +++ /dev/null @@ -1,22 +0,0 @@ -// Govspeak fractions -// https://components.publishing.service.gov.uk/component-guide/govspeak/image_fractions -// https://components.publishing.service.gov.uk/component-guide/govspeak/text_fractions -// -// Support: -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✘ - -.gem-c-govspeak { - .fraction { - sup, - sub { - @include govuk-font($size: 14); - } - - img { - display: inline-block; - width: auto; - margin: 0 0 -5px; - } - } -} diff --git a/app/assets/vendor_styles/govspeak/_highlight-answer.scss b/app/assets/vendor_styles/govspeak/_highlight-answer.scss deleted file mode 100644 index f2cb03d0..00000000 --- a/app/assets/vendor_styles/govspeak/_highlight-answer.scss +++ /dev/null @@ -1,44 +0,0 @@ -// stylelint-disable max-nesting-depth - -$highlight-answer-bg-color: govuk-colour("green"); -$highlight-answer-color: govuk-colour("white"); - -.gem-c-govspeak .highlight-answer { - background-color: $highlight-answer-bg-color; - color: $highlight-answer-color; - text-align: center; - padding: 1.75em .75em 1.25em; - margin: 0 -1em 1em; - - p { - @include govuk-font($size: 24, $weight: bold); - color: $highlight-answer-color; - - em { - @include govuk-font($size: 80, $weight: bold); - display: block; - padding-top: .1em; - color: $highlight-answer-color; - } - } - - p:last-child { - margin-bottom: 0; - } - - @include govuk-media-query($until: tablet) { - margin: 0 0 1em; - @include govuk-font($size: 48); - - p { - font-size: 1em; - line-height: inherit; - - em { - font-size: 1em; - padding-top: 0; - display: inline; - } - } - } -} diff --git a/app/assets/vendor_styles/govspeak/_images.scss b/app/assets/vendor_styles/govspeak/_images.scss deleted file mode 100644 index 8fc35655..00000000 --- a/app/assets/vendor_styles/govspeak/_images.scss +++ /dev/null @@ -1,32 +0,0 @@ -// Govspeak images -// -// Support: -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -.gem-c-govspeak { - img { - width: auto; - height: auto; - max-width: 100%; - } - - figure { - width: 100%; - clear: both; - overflow: hidden; - padding: govuk-spacing(2) 0 0; - - img { - display: inline; - text-align: center; - width: auto; - height: auto; - max-width: 100%; - } - - figcaption { - @include govuk-font($size: 14); - } - } -} diff --git a/app/assets/vendor_styles/govspeak/_information-callout.scss b/app/assets/vendor_styles/govspeak/_information-callout.scss deleted file mode 100644 index 9b972ad6..00000000 --- a/app/assets/vendor_styles/govspeak/_information-callout.scss +++ /dev/null @@ -1,22 +0,0 @@ -// Govspeak information callout -// https://components.publishing.service.gov.uk/component-guide/govspeak/information_callout -// -// Support: -// -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -.gem-c-govspeak { - .info-notice { - border-left: 10px solid govuk-colour("mid-grey", $legacy: "grey-3"); - padding: 1em 0 1em 1em; - margin: 2em 0; - - // Remove margin from the last element - p:last-child, - ul:last-child, - ol:last-child { - margin-bottom: 0; - } - } -} diff --git a/app/assets/vendor_styles/govspeak/_legislative-list.scss b/app/assets/vendor_styles/govspeak/_legislative-list.scss deleted file mode 100644 index c234c98f..00000000 --- a/app/assets/vendor_styles/govspeak/_legislative-list.scss +++ /dev/null @@ -1,26 +0,0 @@ -// Govspeak legislative list -// https://components.publishing.service.gov.uk/component-guide/govspeak/legislative_lists - -// Support: -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -.gem-c-govspeak { - .legislative-list { - list-style: none; - margin: 5px 0; - - li { - margin: 5px 0; - } - - p { - margin: 20px 0; - } - - ol { - margin: govuk-spacing(2) 0 govuk-spacing(2) govuk-spacing(6); - list-style: none; - } - } -} diff --git a/app/assets/vendor_styles/govspeak/_media-player.scss b/app/assets/vendor_styles/govspeak/_media-player.scss deleted file mode 100644 index f281899d..00000000 --- a/app/assets/vendor_styles/govspeak/_media-player.scss +++ /dev/null @@ -1,27 +0,0 @@ -// Govspeak media player -// https://components.publishing.service.gov.uk/component-guide/govspeak/with_youtube_embed -// -// Support: -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -.gem-c-govspeak__youtube-video { - position: relative; - height: 0; - overflow: hidden; - margin-top: govuk-spacing(2); - margin-bottom: govuk-spacing(2); - padding-top: 0; - padding-left: 0; - padding-right: 0; - padding-bottom: 56.25%; -} - -.gem-c-govspeak__youtube-video iframe { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - border: 0; -} diff --git a/app/assets/vendor_styles/govspeak/_place.scss b/app/assets/vendor_styles/govspeak/_place.scss deleted file mode 100644 index 681cfeb6..00000000 --- a/app/assets/vendor_styles/govspeak/_place.scss +++ /dev/null @@ -1,29 +0,0 @@ -.gem-c-govspeak .place { - margin: 1.5em 0; - border-bottom: solid 1px govuk-colour("mid-grey", $legacy: "grey-2"); - padding-bottom: 1.5em; - - .address { - margin: 0; - padding: 0; - width: auto; - display: block; - } - - .url { - overflow: hidden; - text-overflow: ellipsis; - } - - .additional-information { - @include govuk-font($size: 16); - - p { - margin: .25em 0; - } - } - - @include govuk-media-query($until: tablet) { - margin: .75em 0; - } -} diff --git a/app/assets/vendor_styles/govspeak/_stat-headline.scss b/app/assets/vendor_styles/govspeak/_stat-headline.scss deleted file mode 100644 index a463afbc..00000000 --- a/app/assets/vendor_styles/govspeak/_stat-headline.scss +++ /dev/null @@ -1,29 +0,0 @@ -// Govspeak statistic headline -// https://components.publishing.service.gov.uk/component-guide/govspeak/statistic_headlines -// -// Support: -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -.gem-c-govspeak { - .stat-headline { - margin-bottom: govuk-spacing(3); - margin-top: govuk-spacing(3); - - @include govuk-media-query($from: tablet) { - margin-bottom: govuk-spacing(4); - margin-top: govuk-spacing(4); - } - - p { - @include govuk-font($size: 19, $weight: bold); - margin: 0; - } - - em { - @include govuk-font($size: 80, $weight: bold); - display: block; - margin: 3px 0 -5px; - } - } -} diff --git a/app/assets/vendor_styles/govspeak/_steps.scss b/app/assets/vendor_styles/govspeak/_steps.scss deleted file mode 100644 index 431d165d..00000000 --- a/app/assets/vendor_styles/govspeak/_steps.scss +++ /dev/null @@ -1,22 +0,0 @@ -.gem-c-govspeak .steps { - padding-left: 0; - margin-left: 0; - overflow: hidden; - - > li { - background-position: 0 .87em; - background-repeat: no-repeat; - list-style-type: decimal; - margin-left: 0; - padding: .75em 0 .75em 2.5em; - - @for $i from 1 through 30 { - &:nth-child(#{$i}) { - background-image: url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 250 250' preserveAspectRatio='xMinYMin meet'%3E%3Cg%3E%3Ccircle r='50%25' cx='50%25' cy='50%25' class='circle-back'%3E%3C/circle%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' dy='0.3em' font-family='nta,arial,sans-serif' font-size='8rem' fill='%23ffffff'%3E#{$i}%3C/text%3E%3C/g%3E%3C/svg%3E "); - background-repeat: no-repeat; - background-position: .2em .7em; - background-size: 1.4em 1.4em; - } - } - } -} diff --git a/app/assets/vendor_styles/govspeak/_summary.scss b/app/assets/vendor_styles/govspeak/_summary.scss deleted file mode 100644 index 19528f78..00000000 --- a/app/assets/vendor_styles/govspeak/_summary.scss +++ /dev/null @@ -1,24 +0,0 @@ -.gem-c-govspeak .summary { - margin: 0 0 2em; - padding: 0; - color: $govuk-text-colour; - - p { - @include govuk-font($size: 19); - } - - @include govuk-media-query($until: tablet) { - margin: 0 0 2em; - padding: 0; - } - - p, - h2 { - border: 0; - margin: 0 .75em 0 0; - } - - h2 { - line-height: 1.35em; - } -} diff --git a/app/assets/vendor_styles/govspeak/_tables.scss b/app/assets/vendor_styles/govspeak/_tables.scss deleted file mode 100644 index 2e80c04d..00000000 --- a/app/assets/vendor_styles/govspeak/_tables.scss +++ /dev/null @@ -1,40 +0,0 @@ -// Govspeak tables -// https://components.publishing.service.gov.uk/component-guide/govspeak/tables -// -// Support: -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -.gem-c-govspeak { - table { - border-collapse: collapse; - border-spacing: 0; - display: block; - margin: govuk-spacing(6) 0; - overflow-x: auto; - width: 100%; - @include govuk-font($size: 14); - - caption { - text-align: left; - margin-bottom: .5em; - } - - th, - td { - vertical-align: top; - padding: govuk-spacing(2) govuk-spacing(2) govuk-spacing(2) 0; - border-bottom: solid 1px govuk-colour("mid-grey", $legacy: "grey-2"); - } - - th { - @include govuk-font($size: 14, $weight: bold); - text-align: left; - color: $govuk-text-colour; - } - - td small { - font-size: 1em; - } - } -} diff --git a/app/assets/vendor_styles/govspeak/_typography.scss b/app/assets/vendor_styles/govspeak/_typography.scss deleted file mode 100644 index bd18b864..00000000 --- a/app/assets/vendor_styles/govspeak/_typography.scss +++ /dev/null @@ -1,100 +0,0 @@ -@import "./helpers/markdown-typography"; -// Govspeak typography -// https://components.publishing.service.gov.uk/component-guide/govspeak/heading_levels -// https://components.publishing.service.gov.uk/component-guide/govspeak/lists -// https://components.publishing.service.gov.uk/component-guide/govspeak/nested_lists -// https://components.publishing.service.gov.uk/component-guide/govspeak/blockquote -// -// Support: -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -// stylelint-disable max-nesting-depth - -.gem-c-govspeak { - @include markdown-typography; - - &.direction-rtl ol, - &.direction-rtl ul { - margin-left: 0; - margin-right: govuk-spacing(4); - - a { - overflow-wrap: break-word; - } - - ul, - ol { - margin-top: 0; - margin-bottom: 0; - } - } - - // Block quotes - - blockquote { - padding: 0 0 0 govuk-spacing(4); - margin: 0; - border: 0; - - @include govuk-media-query($from: desktop) { - margin: 0 0 0 (- govuk-spacing(6)); - } - - p { - padding-left: govuk-spacing(3); - - @include govuk-media-query($from: tablet) { - padding-left: govuk-spacing(6); - } - - &:before { - content: "\201C"; - float: left; - clear: both; - margin-left: (- govuk-spacing(3)); - } - - &:last-child:after { - content: "\201D"; - } - } - } - - &.direction-rtl blockquote { - padding: 0 govuk-spacing(4) 0 0; - - @include govuk-media-query($from: desktop) { - margin: 0 (- govuk-spacing(6)) 0 0; - } - - p { - padding-right: govuk-spacing(3); - padding-left: 0; - - @include govuk-media-query($from: tablet) { - padding-right: govuk-spacing(6); - padding-left: 0; - } - - &:before { - content: "\201D"; - float: right; - margin-right: (- govuk-spacing(3)); - margin-left: 0; - } - - &:last-child:after { - content: "\201C"; - } - } - } - - // Text styles - - em, - i { - font-style: normal; - font-weight: inherit; - } -} diff --git a/app/assets/vendor_styles/govspeak/_warning-callout.scss b/app/assets/vendor_styles/govspeak/_warning-callout.scss deleted file mode 100644 index a1534f60..00000000 --- a/app/assets/vendor_styles/govspeak/_warning-callout.scss +++ /dev/null @@ -1,36 +0,0 @@ -// Govspeak warning callout -// https://components.publishing.service.gov.uk/component-guide/govspeak/warning_callout -// -// Support: -// -// - alphagov/whitehall: ✔︎ -// - alphagov/govspeak: ✔︎ - -.gem-c-govspeak { - .help-notice { - $icon-size: 34px; - $line-height-mobile: 20px; - $line-height-tablet: 25px; - - margin: 2em 0; - - // Add '!' icon - background-image: url("/images/icon-important.svg"); - background-size: $icon-size $icon-size; - background-repeat: no-repeat; - min-height: $icon-size; - padding-left: $icon-size; - - // Center the icon around the baseline - padding-top: ($icon-size - $line-height-mobile) * 0.5; - - @include govuk-media-query($from: tablet) { - padding-top: ($icon-size - $line-height-tablet) * 0.5; - } - - p { - @include govuk-font($size: 19, $weight: bold); - margin-left: 1em; - } - } -} \ No newline at end of file diff --git a/app/assets/vendor_styles/govspeak/helpers/_attachment-link.scss b/app/assets/vendor_styles/govspeak/helpers/_attachment-link.scss deleted file mode 100644 index 632e51e2..00000000 --- a/app/assets/vendor_styles/govspeak/helpers/_attachment-link.scss +++ /dev/null @@ -1,4 +0,0 @@ -.gem-c-attachment-link__abbr { - text-decoration: none; - cursor: help; -} diff --git a/app/assets/vendor_styles/govspeak/helpers/_attachment.scss b/app/assets/vendor_styles/govspeak/helpers/_attachment.scss deleted file mode 100644 index 616c728a..00000000 --- a/app/assets/vendor_styles/govspeak/helpers/_attachment.scss +++ /dev/null @@ -1,76 +0,0 @@ -$thumbnail-width: 99px; -$thumbnail-height: 140px; -$thumbnail-border-width: 5px; -$thumbnail-background: govuk-colour("white"); -$thumbnail-border-colour: rgba(11, 12, 12, .1); -$thumbnail-shadow-colour: rgba(11, 12, 12, .4); -$thumbnail-shadow-width: 0 2px 2px; -$thumbnail-icon-border-colour: govuk-colour("mid-grey", $legacy: "grey-3"); - -.gem-c-attachment { - @include govuk-font(19); - @include govuk-clearfix; - position: relative; - - .govuk-details__summary { - @include govuk-font($size: 14); - } -} - -.gem-c-attachment__thumbnail { - position: relative; - width: auto; - margin-right: govuk-spacing(5); - margin-bottom: govuk-spacing(3); - padding: $thumbnail-border-width; - float: left; -} - -.gem-c-attachment__thumbnail-image { - display: block; - width: auto; // for IE8 - max-width: $thumbnail-width; - height: $thumbnail-height; - border: $thumbnail-border-colour; // for IE9 & IE10 - outline: $thumbnail-border-width solid $thumbnail-border-colour; - background: $thumbnail-background; - box-shadow: $thumbnail-shadow-width $thumbnail-shadow-colour; - fill: $thumbnail-icon-border-colour; - stroke: $thumbnail-icon-border-colour; -} - -.gem-c-attachment__details { - padding-left: $thumbnail-width + $thumbnail-border-width * 2 + govuk-spacing(5); - - .gem-c-details { - word-break: break-word; - word-wrap: break-word; - } -} - -.gem-c-attachment__title { - @include govuk-font($size: 27); - margin: 0 0 govuk-spacing(3); -} - -.gem-c-attachment__link { - line-height: 1.29; -} - -.gem-c-attachment__metadata { - @include govuk-font($size: 14); - margin: 0 0 govuk-spacing(3); - - &:last-of-type { - margin-bottom: 0; - } -} - -.gem-c-attachment__metadata--compact { - margin-bottom: 0; -} - -.gem-c-attachment__abbr { - text-decoration: none; - cursor: help; -} diff --git a/app/assets/vendor_styles/govspeak/helpers/_markdown-typography.scss b/app/assets/vendor_styles/govspeak/helpers/_markdown-typography.scss deleted file mode 100644 index 88eebbab..00000000 --- a/app/assets/vendor_styles/govspeak/helpers/_markdown-typography.scss +++ /dev/null @@ -1,149 +0,0 @@ -@use "sass:math"; - -@mixin markdown-typography { - @include govuk-text-colour; - - @include govuk-font($size: 16); - - $gutter-two-thirds: $govuk-gutter - math.div($govuk-gutter, 3); - - ol, - ul, - p { - @include govuk-font($size: 19); - margin-top: $govuk-gutter-half; - margin-bottom: $govuk-gutter-half; - - @include govuk-media-query($from: tablet) { - margin-top: $gutter-two-thirds; - margin-bottom: $gutter-two-thirds; - } - } - - // Headings - - // Markdown is expected to be styled within a document with a H1 title - // thus H1's are not expected and are discouraged by bare styling - - /* - h1 { - @include govuk-font($size: 19); - margin: 0; - padding: 0; - } - */ - - h2 { - @include govuk-font($size: 27, $weight: bold); - margin-top: $govuk-gutter; - margin-bottom: 0; - - @include govuk-media-query($from: desktop) { - margin-top: $govuk-gutter * 1.5; - margin-bottom: 0; - } - } - - h3 { - @include govuk-font($size: 19, $weight: bold); - margin-top: $govuk-gutter + 5px; - margin-bottom: 0; - } - - // H4, H5 and H6 are discouraged and thus styled the same - - h4, - h5, - h6 { - @include govuk-font($size: 19, $weight: bold); - margin-top: $govuk-gutter + 5px; - margin-bottom: 0; - - + p { - margin-top: 5px; - } - } - - h5, - h6 { - margin: 0; - } - - h2:first-child, - h3:first-child, - h4:first-child, - p:first-child { - margin-top: 0; - } - - // Links - - a { - @include govuk-link-style-default; - - &:focus { - @include govuk-focused-text; - } - } - - // Lists - - ol, - ul { - list-style: decimal; - list-style-position: outside; - margin-left: $gutter-two-thirds; - padding: 0; - - ul, - ol { - margin-top: 0; - margin-bottom: 0; - padding: 0; - } - } - - ul { - list-style: disc; - list-style-position: outside; - } - - li { - margin: 0 0 5px; - padding: 0; - - p { - margin: 0; - padding: 0; - } - - p + p, - p + ul, - p + ol, - ul + p, - ul + ol, - ol + p, - ol + ul { - margin-top: 5px; - } - } - - // Text styles - - sup { - font-size: .8em; - line-height: .7em; - vertical-align: super; - } - - abbr { - cursor: help; - text-decoration: none; - } - - // Horizontal Rule - hr { - margin-top: $govuk-gutter - 1px; - margin-bottom: $govuk-gutter; - } -} diff --git a/app/controllers/admin/admin_controller.rb b/app/controllers/admin/admin_controller.rb deleted file mode 100644 index d56f2353..00000000 --- a/app/controllers/admin/admin_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Admin - class AdminController < ApplicationController - layout "beta/cms" - before_action :authenticate_user! - end -end diff --git a/app/controllers/admin/content_blocks_controller.rb b/app/controllers/admin/content_blocks_controller.rb deleted file mode 100644 index 4f500d58..00000000 --- a/app/controllers/admin/content_blocks_controller.rb +++ /dev/null @@ -1,55 +0,0 @@ -module Admin - class ContentBlocksController < AdminController - before_action :set_content_block, only: %i[edit update] - - def index - authorize User - @content_blocks = ContentBlock.all - end - - def new - @content_block = ContentBlock.new - end - - def edit; end - - def create - @content_block = ContentBlock.new(content_block_params) - begin - authorize @content_block, :create? - if @content_block.save - redirect_to admin_content_blocks_path, notice: "Content block was successfully created." - else - render :new - end - rescue Pundit::NotAuthorizedError - @content_block.errors.add(:base, "You don't have permission to create a new block") - render :new - end - end - - def update - authorize @content_block, :update? - if @content_block.update(content_block_params) - redirect_to admin_content_blocks_path, notice: "Content block was successfully updated." - else - render :edit - end - rescue Pundit::NotAuthorizedError - @content_block.errors.add(:base, "You don't have permission to edit blocks") - render :edit - end - - private - - # Use callbacks to share common setup or constraints between actions. - def set_content_block - @content_block = ContentBlock.find(params[:id]) - end - - # Only allow a list of trusted parameters through. - def content_block_params - params.require(:content_block).permit(:name, :description, :markdown) - end - end -end diff --git a/app/controllers/admin/content_page_versions_controller.rb b/app/controllers/admin/content_page_versions_controller.rb deleted file mode 100644 index 90741cba..00000000 --- a/app/controllers/admin/content_page_versions_controller.rb +++ /dev/null @@ -1,80 +0,0 @@ -module Admin - class ContentPageVersionsController < AdminController - before_action :set_content_page_version, only: %i[destroy edit update preview_of_draft publish] - - def destroy - authorize @content_page_version, :destroy? - authorize @content_page_version.content_page, :destroy? - @parent_page = @content_page_version.content_page - - @content_page_version.destroy! - - # There is a requirement to delete the ContentPage if it is unpublished and if - # the last of its ContentPageVersions have been removed - if !@parent_page.is_published && @parent_page.content_page_versions.count.zero? - @parent_page.destroy! - end - - redirect_to admin_content_pages_path, notice: "Draft successfuly deleted" - end - - def edit; end - - def update - authorize @content_page_version, :update? - @content_page_version.author = current_user.name - - if @content_page_version.update(content_page_version_params) - redirect_to versions_admin_content_page_path(@content_page_version.content_page), notice: "This version was successfully updated" - else - render :edit - end - rescue Pundit::NotAuthorizedError - @content_page_version.errors.add(:base, "You don't have permission to change versions of pages") - render :edit - end - - def preview_of_draft - @page = ContentPage.new(title: @content_page_version.title, - intro: @content_page_version.intro, - markdown: @content_page_version.markdown, - content_list: @content_page_version.content_list, - position: 22, - description: @content_page_version.description, - previous_id: @content_page_version.content_page.id, - next_id: @content_page_version.content_page.id) - - render layout: "beta/application" - end - - def publish - @page = @content_page_version.content_page - @page.update!( - markdown: @content_page_version.markdown, - intro: @content_page_version.intro, - content_list: @content_page_version.content_list, - is_published: true, - author: current_user.name, - title: @content_page_version.title, - description: @content_page_version.description, - ) - - # Delete the version that this page was published from - @content_page_version.destroy! - - redirect_to versions_admin_content_page_path(@page), notice: "Published" - end - - private - - # Use callbacks to share common setup or constraints between actions. - def set_content_page_version - @content_page_version = ContentPageVersion.find(params[:id]) - end - - # Only allow a list of trusted parameters through. - def content_page_version_params - params.require(:content_page_version).permit(:title, :intro, :markdown, :content_list, :author, :description) - end - end -end diff --git a/app/controllers/admin/content_pages_controller.rb b/app/controllers/admin/content_pages_controller.rb deleted file mode 100644 index f1d86f98..00000000 --- a/app/controllers/admin/content_pages_controller.rb +++ /dev/null @@ -1,132 +0,0 @@ -module Admin - class ContentPagesController < AdminController - before_action :set_content_page, only: %i[show edit update destroy preview_of_live versions unpublish] - - def index - @content_pages = ContentPage.top_level.order_by_position - end - - def show - unless @content_page.is_published - redirect_to("/404") - end - end - - def new - # If the new page is a child, pass through its parent id - # Pages with a nil parent_id are top_level - next_position = ContentPage.maximum("position") ? (ContentPage.maximum("position") + 1) : 1 - @content_page = ContentPage.new(parent_id: params[:parent_id], position: next_position) - end - - def create - @content_page = ContentPage.new(content_page_params) - @content_page.author = current_user.name - @content_page.is_published = false - - begin - authorize @content_page, :create? - - if @content_page.save - redirect_to "#{admin_content_page_path(@content_page)}/versions", notice: "A new version was successfully created" - else - render :new - end - rescue Pundit::NotAuthorizedError - @content_page.errors.add(:base, "You don't have permission to create pages") - render :new - end - end - - def edit; end - - # ContentPage markdown is never directly updated. Changes happen to markdown - # as ContentPageVersions are created, edited and published - # Changes to position are applied directly to the published page, position has - # no meaning for drafts - # This update method does not do things the normal Rails way - def update - authorize @content_page, :update? - - # If the position has changed, honour it. Versions do not have positions - if content_page_params[:position] != @content_page.position - @content_page.position = content_page_params[:position] - if @content_page.valid? - @content_page.save! - end - end - - # This will not be saved, just doing it to take advantage of - # ContentPage validation, before the same values are used to - # create the ContentPageVersion - @content_page.markdown = content_page_params[:markdown] - @content_page.content_list = content_page_params[:content_list] - if content_page_params[:title] - @content_page.title = content_page_params[:title] - end - - if @content_page.valid? - ContentPageVersion.create!(title: @content_page.title, - intro: content_page_params[:intro], - markdown: content_page_params[:markdown], - content_list: content_page_params[:content_list], - author: current_user.name, - content_page: @content_page, - description: content_page_params[:description]) - redirect_to "#{admin_content_page_path(@content_page)}/versions", notice: "A new version was successfully created" - else - render :edit - end - rescue Pundit::NotAuthorizedError - @content_page.errors.add(:base, "You don't have permission to change pages") - render :edit - end - - def destroy - authorize @content_page, :destroy? - @content_page.destroy! - redirect_to admin_content_pages_path, notice: "Content page was successfully destroyed." - end - - # POST of preview, returns html - def preview - html = GovspeakDecorator.translate_markdown(params["markdown"]) - - render json: { html: html } - end - - def preview_of_live - @page = @content_page - render layout: "beta/application" - end - - def versions; end - - def unpublish - authorize @content_page, :unpublish? - - @content_page.update!(is_published: false) - ContentPageVersion.create!(title: @content_page.title, - markdown: @content_page.markdown, - intro: @content_page.intro, - content_list: @content_page.content_list, - author: current_user.name, - content_page: @content_page, - description: @content_page.description) - - redirect_to versions_admin_content_page_path(@content_page), notice: t(".notice") - end - - private - - # Use callbacks to share common setup or constraints between actions. - def set_content_page - @content_page = ContentPage.find(params[:id]) - end - - # Only allow a list of trusted parameters through. - def content_page_params - params.require(:content_page).permit(:title, :intro, :markdown, :content_list, :parent_id, :position, :description) - end - end -end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb deleted file mode 100644 index 478178fd..00000000 --- a/app/controllers/admin/users_controller.rb +++ /dev/null @@ -1,77 +0,0 @@ -module Admin - class UsersController < AdminController - before_action :set_user, only: %i[edit update destroy] - - def index - authorize User - @users = User.all - rescue Pundit::NotAuthorizedError - flash[:alert] = "You do not have permission to view users" - redirect_to request.referer || admin_content_pages_path - end - - def new - @user = User.new - end - - def edit; end - - def create - @user = User.new(user_params) - begin - authorize @user - if @user.save - redirect_to admin_users_path, notice: "User #{@user.name} created" - else - render :new - end - rescue Pundit::NotAuthorizedError - @user.errors.add(:base, "You don't have permission to create a user") - render :new - end - end - - def update - authorize @user - - if user_params[:password].blank? - if @user.update_without_password(user_params) - redirect_to admin_users_path, notice: "User #{@user.name} saved" - else - render :edit - end - else - @user.reset_password_token = Devise.friendly_token - @user.reset_password(user_params[:password], user_params[:password_confirmation]) - if @user.reload.update_without_password(user_params) - redirect_to admin_users_path, notice: "User #{@user.name} saved and password changed" - else - render :edit - end - end - rescue Pundit::NotAuthorizedError - @user.errors.add(:base, "You don't have permission to update a user") - render :edit - end - - def destroy - authorize @user, :destroy? - @user.update!(unique_session_id: nil) # kill any current session - @user.destroy! - redirect_to admin_users_path, notice: "User #{@user.name} deleted" - rescue Pundit::NotAuthorizedError - @user.errors.add(:base, "You don't have permission to delete this user") - render :edit - end - - private - - def set_user - @user = User.find(params[:id]) - end - - def user_params - params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :role) - end - end -end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5d077d59..297e9500 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,6 @@ class ApplicationController < ActionController::Base - layout Rails.application.new_design? ? 'application' : 'beta/application' + layout 'application' + default_form_builder(GOVUKDesignSystemFormBuilder::FormBuilder) before_action { cookies.delete :track_google_analytics } before_action do |_controller| @@ -7,12 +8,10 @@ class ApplicationController < ActionController::Base end before_action :prepare_cms - include Pundit::Authorization - helper_method :menu_item, :section def check - render json: { status: "OK", version: release_version, sha: ENV["SHA"], environment: Rails.env }, status: :ok + render json: { status: 'OK', version: release_version, sha: ENV['SHA'], environment: Rails.env }, status: :ok end protected @@ -29,7 +28,7 @@ def prepare_cms end def release_version - ENV["RELEASE_VERSION"] || "-" + ENV['RELEASE_VERSION'] || '-' end private @@ -47,7 +46,7 @@ def section end def not_found - raise ActionController::RoutingError, "Not Found" + raise ActionController::RoutingError, 'Not Found' end def after_sign_out_path_for(_resource_or_scope) diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb deleted file mode 100644 index 89111970..00000000 --- a/app/controllers/content_controller.rb +++ /dev/null @@ -1,43 +0,0 @@ -class ContentController < ApplicationController - before_action :authenticate_user!, if: proc { !ENV["AUTH_ON_EVERYTHING"].nil? } - after_action :set_cache_headers - - # This is a page whose title and children's titles are rendered - # a block in the landing_page_layout template - FEATURED_PAGE_TITLES = ["Get help to improve your practice", "Safeguarding and welfare"].freeze - FEATURED_PAGE_HASH = { "Get help to improve your practice" => "Get help", "Safeguarding and welfare" => "Safeguarding" }.freeze - - # GET /page_title - def show - @page = ContentPage.find_by_slug!(params["slug"]) - # If in a section page and page has parent, it must be a child of existing page - not_found if (!@page.is_published || @page.parent || content_section?) && params["section"] != parent_slug - rescue ActiveRecord::RecordNotFound - not_found - end - - # GET / - def index - @featured_pages = ContentPage.published.where(title: FEATURED_PAGE_TITLES).order_by_position - # Don't show featured pages in the cards - @content_pages = ContentPage.top_level.published.order_by_position - @featured_pages - - respond_to do |format| - format.html { render :index, layout: "beta/landing_page_layout" } - end - end - -private - - def set_cache_headers - response.headers["Cache-Control"] = "max-age=3600, public" if cookies[:track_analytics].present? - end - - def parent_slug - @page.parent && @page.parent.slug - end - - def content_section? - params["section"].present? - end -end diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index 62dad8c5..b358ba06 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -1,10 +1,8 @@ class ErrorsController < ApplicationController - layout "beta/errors" - def not_found respond_to do |format| format.html { render status: :not_found } - format.json { render json: { error: "Resource not found" }, status: :not_found } + format.json { render json: { error: 'Resource not found' }, status: :not_found } format.all { render status: :not_found, body: nil } end end @@ -12,21 +10,21 @@ def not_found def internal_server_error respond_to do |format| format.html { render status: :internal_server_error } - format.json { render json: { error: "Internal server error" }, status: :internal_server_error } + format.json { render json: { error: 'Internal server error' }, status: :internal_server_error } end end def unprocessable_entity respond_to do |format| format.html { render status: :unprocessable_entity } - format.json { render json: { error: "Unprocessable entity" }, status: :unprocessable_entity } + format.json { render json: { error: 'Unprocessable entity' }, status: :unprocessable_entity } end end def service_unavailable respond_to do |format| format.html { render status: :service_unavailable } - format.json { render json: { error: "Service unavailable" }, status: :service_unavailable } + format.json { render json: { error: 'Service unavailable' }, status: :service_unavailable } end end end diff --git a/app/controllers/feedbacks_controller.rb b/app/controllers/feedbacks_controller.rb index e5bedf0b..4a787f38 100644 --- a/app/controllers/feedbacks_controller.rb +++ b/app/controllers/feedbacks_controller.rb @@ -4,7 +4,7 @@ def create feedback = Feedback.new(feedback_params) cookies[:feedback_page_useful] = cookie(feedback) uri = redirect_uri - uri.fragment = "feedback" + uri.fragment = 'feedback' redirect_to uri.to_s, format: :html end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 4e110edf..2374946d 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,5 +1,5 @@ class HomeController < ApplicationController - before_action :authenticate_user!, if: proc { !ENV["AUTH_ON_EVERYTHING"].nil? } + before_action :authenticate_user!, if: proc { !ENV['AUTH_ON_EVERYTHING'].nil? } helper_method :section, :page diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index caec751a..24a9678b 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -20,10 +20,10 @@ def page(page_name) end def breadcrumbs - if cms_path == "/" + if cms_path == '/' {} else - cms_path_array.each_with_object({ "Home" => "/" }) do |obj, memo| + 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 @@ -31,11 +31,11 @@ def breadcrumbs end def cms_path - page_params[:cms_path] || "/" + page_params[:cms_path] || '/' end def cms_path_array - cms_path&.split("/") + cms_path&.split('/') end def page_name diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index 178ebad1..67ffb7f2 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -15,7 +15,7 @@ def show private def track_analytics - params.fetch(:track_analytics, "No") + params.fetch(:track_analytics, 'No') end def set_cookie_pref diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb deleted file mode 100644 index 083eb555..00000000 --- a/app/controllers/static_pages_controller.rb +++ /dev/null @@ -1,9 +0,0 @@ -class StaticPagesController < ApplicationController - def accessibility_statement; end - - def disclaimer; end - - def contact_us; end - - def child_development_training; end -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 589f9f23..000a6bea 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,25 +1,25 @@ module ApplicationHelper def nav_link_to(title:, path:) classes = %w[govuk-header__navigation-item] - classes << "govuk-header__navigation-item--active" if request.path == path || (request.path == "/admin" && path == "/admin/users") + classes << 'govuk-header__navigation-item--active' if request.path == path || (request.path == '/admin' && path == '/admin/users') tag.li(class: classes) do - link_to title, path, class: "govuk-header__link", aria: { current: "page" } + link_to title, path, class: 'govuk-header__link', aria: { current: 'page' } end end def feature_image(page:) if page.featured_image.attached? - image_tag(url_for(page.featured_image), class: "page-responsive-img", alt: page.featured_alt_text, title: page.featured_alt_text, width: "500px") + image_tag(url_for(page.featured_image), class: 'page-responsive-img', alt: page.featured_alt_text, title: page.featured_alt_text, width: '500px') else - image_text = page.featured_alt_text || "featured image alt text missing" - image_tag("apple.jpeg", class: "page-responsive-img", alt: image_text, title: image_text) + image_text = page.featured_alt_text || 'featured image alt text missing' + image_tag('apple.jpeg', class: 'page-responsive-img', alt: image_text, title: image_text) end end def link_to_preview(article, link_to_args = {}) return unless policy(article).preview? - text = policy(article).publish? ? "Preview and publish" : "Preview" + text = policy(article).publish? ? 'Preview and publish' : 'Preview' link_to text, admin_article_path(article), link_to_args end diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index 6e85b11e..62050963 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb @@ -3,7 +3,7 @@ module ContentHelper # @param key [String] # @return [String] def m(key, headings_start_with: 'l', **args) - return "" if key.nil? + return '' if key.nil? markdown = I18n.exists?(key, scope: args[:scope]) ? t(key, **args) : key.to_s @@ -33,27 +33,23 @@ def is_mobile_menu_section_current?(page) params[:slug] == page.slug || params[:section] == page.slug end - def translate_markdown(markdown) - raw GovspeakDecorator.translate_markdown(markdown) - end - def insert_block(block_name) block = ContentBlock.find_by_name(block_name.underscore) html_to_use = block ? block.markdown : "Error - block not found for #{block_name.humanize}" - translate_markdown(html_to_use) + m(html_to_use) end def print_button(*additional_classes) button = '<button class="govuk-link gem-c-print-link__button" onclick="window.print()" data-module="print-link" >Print this page</button>'.html_safe - classes = ["gem-c-print-link", "print-button"] + additional_classes + classes = ['gem-c-print-link', 'print-button'] + additional_classes content_tag :div, button, class: classes end def govuk_input_classes(input_type, errors: nil) classes = %w[govuk-input] classes << "govuk-#{input_type}" - classes << "govuk-input--error" if errors.present? + classes << 'govuk-input--error' if errors.present? classes end diff --git a/app/helpers/feedbacks_helper.rb b/app/helpers/feedbacks_helper.rb index 9dd5e370..b4b66a9f 100644 --- a/app/helpers/feedbacks_helper.rb +++ b/app/helpers/feedbacks_helper.rb @@ -1,17 +1,17 @@ module FeedbacksHelper def link_to_feedback(args = {}) link_to( - "Give Feedback", + 'Give Feedback', Rails.configuration.feedback_url, { - class: "govuk-button", + class: 'govuk-button', data: { - track_category: "Onsite Feedback", - track_action: "GOV-UK Open Form", + track_category: 'Onsite Feedback', + track_action: 'GOV-UK Open Form', }, aria: { - controls: "something-is-wrong", - expanded: "false", + controls: 'something-is-wrong', + expanded: 'false', }, }.merge(args), ) diff --git a/app/javascript/application.js b/app/javascript/application.js index 79c17c09..38add276 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -5,25 +5,3 @@ import '@hotwired/turbo-rails'; import './controllers'; import $ from 'jquery'; - -export function createPreview(el, target) { - - $.ajaxSetup({ - headers: { - 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') - } - }); - - $.post("/admin/preview_markdown", { markdown: $(el).val() }) - .done(function (response) { - $(target).html(response.html); - }); -} - -/* copies to clipboard in content_assets/_clipboard.html.erb */ -export function copyToClipboard() { - var copyText = document.getElementById("clipboard_content"); - copyText.select(); - copyText.setSelectionRange(0, 99999); /* For mobile devices */ - navigator.clipboard.writeText(copyText.value); -} \ No newline at end of file diff --git a/app/models/content_block.rb b/app/models/content_block.rb deleted file mode 100644 index 8c364596..00000000 --- a/app/models/content_block.rb +++ /dev/null @@ -1,17 +0,0 @@ -class ContentBlock < ApplicationRecord - audited - - default_scope { order(name: :asc) } - - # rubocop:disable Rails/UniqueValidationWithoutIndex - validates :name, uniqueness: true # There is also a unique index in SQL, rubocop disagrees - # rubocop:enable Rails/UniqueValidationWithoutIndex - validates :name, presence: true, format: { without: /\s/, message: "Name must contain no spaces" } - validates :name, format: { with: ContentPage::ONLY_ALPHA_NUMERIC_COMMA_HYPHEN_SPACE_AND_ROUND_BRACES, message: ContentPage::TITLE_FORMAT_ERROR_MESSAGE } - validates :name, length: { maximum: 10_000 } - validates :description, presence: true - validates :description, length: { maximum: 10_000 } - - validates :markdown, presence: true - validates :markdown, length: { maximum: 30_000 } -end diff --git a/app/models/content_page.rb b/app/models/content_page.rb deleted file mode 100644 index bc32350f..00000000 --- a/app/models/content_page.rb +++ /dev/null @@ -1,98 +0,0 @@ -class ContentPage < ApplicationRecord - acts_as_tree - audited - - has_many :content_page_versions - - scope :top_level, -> { where("parent_id IS NULL") } - scope :order_by_position, -> { order("position ASC") } - scope :published, -> { where("is_published = true") } - - CHARS_TO_OMIT_FROM_SLUG = ",:()".freeze - ONLY_ALPHA_NUMERIC_COMMA_HYPHEN_SPACE_AND_ROUND_BRACES = /\A[a-zA-Z0-9,:\-()_ ]+\Z/.freeze - TITLE_FORMAT_ERROR_MESSAGE = "Heading should only contain alphabetic, numeric and -#{CHARS_TO_OMIT_FROM_SLUG}".freeze - validates :title, format: { with: ONLY_ALPHA_NUMERIC_COMMA_HYPHEN_SPACE_AND_ROUND_BRACES, message: TITLE_FORMAT_ERROR_MESSAGE } - validates :title, presence: true, uniqueness: true - validates :markdown, presence: true - validates :markdown, length: { maximum: 30_000 } - validates :title, :intro, :description, :content_list, length: { maximum: 10_000 } - - validates :position, presence: true, numericality: { only_integer: true }, uniqueness: { scope: :parent_id } - - before_save :set_slug_from_title - - after_create do - ContentPage.reorder - create_first_version - end - - def create_first_version - ContentPageVersion.create!(title: title, - markdown: markdown, - content_list: content_list, - content_page_id: id, - author: author, - description: description) - end - - after_save do - if saved_change_to_position? || saved_change_to_is_published? - ContentPage.reorder - end - end - - def full_path - if parent - "/#{parent.slug}/#{slug}" - else - "/#{slug}" - end - end - - def set_slug_from_title - self.slug = title.downcase.gsub(/ /, "-") - CHARS_TO_OMIT_FROM_SLUG.each_char do |character| - self.slug = slug.gsub(character, "") - end - end - - def next_page - ContentPage.find(next_id) if next_id - end - - def previous_page - ContentPage.find(previous_id) if previous_id - end - - def navigation - true - end - - def helpful_tools - true - end - - def meta_description - description - end - - # Called when a page is created or a position attribute changes - class << self - def reorder - page_order = [] - - ContentPage.published.top_level.order_by_position.each do |p| - page_order << p - p.children.published.order_by_position.each do |child| - page_order << child - end - end - - page_order.each_with_index do |page, index| - page.next_id = page_order[index + 1].id unless page == page_order.last - page.previous_id = page_order[index - 1].id unless page == page_order.first - page.save! - end - end - end -end diff --git a/app/models/content_page_version.rb b/app/models/content_page_version.rb deleted file mode 100644 index b6ae4eb9..00000000 --- a/app/models/content_page_version.rb +++ /dev/null @@ -1,20 +0,0 @@ -class ContentPageVersion < ApplicationRecord - audited - - scope :order_by_created_at, -> { order("created_at DESC") } - - belongs_to :content_page - - validates :title, format: { with: ContentPage::ONLY_ALPHA_NUMERIC_COMMA_HYPHEN_SPACE_AND_ROUND_BRACES, message: ContentPage::TITLE_FORMAT_ERROR_MESSAGE } - validates :title, presence: true - validates :markdown, presence: true - validates :markdown, length: { maximum: 30_000 } - validates :title, :intro, :description, :content_list, length: { maximum: 10_000 } - - delegate :parent, :parent_id, to: :content_page, allow_nil: true - - # TODO: Are navigation and breadcrumb methods required? They do not appear to be used anywhere. - def navigation - true - end -end diff --git a/app/models/govspeak_decorator.rb b/app/models/govspeak_decorator.rb deleted file mode 100644 index fdf5bf8f..00000000 --- a/app/models/govspeak_decorator.rb +++ /dev/null @@ -1,28 +0,0 @@ -class GovspeakDecorator < DelegateClass(Govspeak::Document) - ALLOWED_TAGS = %w[details summary p h1 h2 h3 h4 ul li img div ol a span strong iframe].freeze - - def self.translate_markdown(markdown, sanitize: true) - newdoc = new(Govspeak::Document.new(markdown, sanitize: sanitize, allowed_elements: ALLOWED_TAGS)) - newdoc.to_html - end - - Govspeak::Document.extension("YoutubeVideo", /\$YoutubeVideo(?:\[(.*?)\])?\((.*?)\)\$EndYoutubeVideo/m) do |title, youtube_link| - youtube_id = youtube_link.scan(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)[0][1] - embed_url = %(https://www.youtube.com/embed/#{youtube_id}?enablejsapi=1&origin=https://help-for-early-years-providers.education.gov.uk) - optional_title = title ? %(title="#{title}") : "" - %(<div class="govspeak-embed-container"><iframe class="govspeak-embed-video" src="#{embed_url}" #{optional_title} frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>) - end - - # TODO: Determine why commenting this method out has no affect on the specs - # Find out what content is meant to be blocked/fixed by GovspeakDecorator::HtmlSanitizerDecorator - def to_html - @to_html ||= begin - html = kramdown_doc.to_html - Govspeak::PostProcessor.process(html, self) - end - end - - def kramdown_doc - __getobj__.send("kramdown_doc") - end -end diff --git a/app/models/page.rb b/app/models/page.rb deleted file mode 100644 index ede69732..00000000 --- a/app/models/page.rb +++ /dev/null @@ -1,53 +0,0 @@ -class Page - include ActiveModel::Model - - attr_accessor :slug, :title, :body, :menu_title, :parent_path, :hero_attributes, :card_attributes - - def full_path - ["/", parent_path, slug].join("/").squeeze("/") - end - - def meta_description - 'placeholder' - end - - def cards - if card_attributes.present? - card_attributes.map { |attrs| Card.new(attrs) } - else - [] - end - end - - def hero - Hero.new(hero_attributes) - end - - class Hero - include ActiveModel::Model - - attr_accessor :title, :body - end - - class Card - include ActiveModel::Model - - attr_accessor :slug, :image_id, :title, :body, :parent_path, :subpages - - def path - [parent_path, slug].join("/") - end - - def meta_description - 'card description' - end - - def thumbnail - OpenStruct.new( - url: 'https://placehold.co/380x254/347ca9/FFFFFF/png', - description: 'A placeholder picture', - title: 'Title for a placeholder picture', - ) - end - end -end diff --git a/app/models/page_delegator.rb b/app/models/page_delegator.rb deleted file mode 100644 index e65e32a2..00000000 --- a/app/models/page_delegator.rb +++ /dev/null @@ -1,23 +0,0 @@ -class PageDelegator < SimpleDelegator - def hero - Hero.new(title: title, body: intro) - end - - def body - GovspeakDecorator.translate_markdown(markdown).html_safe - end - - def cards - [] - end - - def menu_title - title - end - - class Hero - include ActiveModel::Model - - attr_accessor :title, :body - end -end diff --git a/app/models/user.rb b/app/models/user.rb index af3bd4fc..48aba987 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,8 +1,8 @@ class User < ApplicationRecord acts_as_paranoid - ADMIN = "admin".freeze - EDITOR = "editor".freeze + ADMIN = 'admin'.freeze + EDITOR = 'editor'.freeze APPROVED_DOMAINS = %w[@education.gov.uk @digital.education.gov.uk].freeze ROLES = %w[reader editor admin].freeze EMAIL_ERROR_MESSAGE = "You must provide a valid DfE email address (#{APPROVED_DOMAINS.to_sentence})".freeze @@ -25,7 +25,7 @@ class User < ApplicationRecord validates :role, with: :ensure_at_least_one_user_has_admin_role def name - [first_name, last_name].join(" ") + [first_name, last_name].join(' ') end def reset_password(new_password, new_password_confirmation) @@ -44,13 +44,13 @@ def reset_password(new_password, new_password_confirmation) end def self.valid_roles - roles.slice("editor", "admin").transform_values do |value| - I18n.translate(value, scope: :roles, default: "Unknown role") + roles.slice('editor', 'admin').transform_values do |value| + I18n.translate(value, scope: :roles, default: 'Unknown role') end end def ensure_at_least_one_user_has_admin_role - if changes["role"] && (changes["role"].first == ADMIN) && (User.admin.count <= 1) + if changes['role'] && (changes['role'].first == ADMIN) && (User.admin.count <= 1) errors.add(:role, "Can not remove the 'admin' role, there would be no admin left") end end diff --git a/app/models/web/page.rb b/app/models/web/page.rb index bbdc5cfc..9c77542e 100644 --- a/app/models/web/page.rb +++ b/app/models/web/page.rb @@ -28,17 +28,17 @@ def self.by_slug(slug) end def path - ["/", parent&.parent&.slug, parent&.slug, slug].join("/").gsub(/home/, "").squeeze("/") + ['/', parent&.parent&.slug, parent&.slug, slug].join('/').gsub(/home/, '').squeeze('/') end def footer_path - ["/", parent&.parent&.slug, parent&.slug, slug].join("/").gsub(/footer/, "").squeeze("/") + ['/', parent&.parent&.slug, parent&.slug, slug].join('/').gsub(/footer/, '').squeeze('/') end def breadcrumbs list = [self, self&.parent, self&.parent&.parent, self&.parent&.parent&.parent].compact.reverse list.shift - list.each_with_object({ "Home" => "/" }) do |obj, memo| + list.each_with_object({ 'Home' => '/' }) do |obj, memo| memo[obj.title] = obj.path end end diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb deleted file mode 100644 index 9c2b7d9f..00000000 --- a/app/policies/application_policy.rb +++ /dev/null @@ -1,12 +0,0 @@ -class ApplicationPolicy - attr_reader :user, :record - - def initialize(user, record) - @user = user - @record = record - end - - def edit? - update? - end -end diff --git a/app/policies/article_policy.rb b/app/policies/article_policy.rb deleted file mode 100644 index 63b94ff9..00000000 --- a/app/policies/article_policy.rb +++ /dev/null @@ -1,15 +0,0 @@ -class ArticlePolicy < ContentPagePolicy - def unpublish? - record.published? - end - - def publish? - preview? && record.complete? - end - - def preview? - return if record.new_record? - - !record.published? - end -end diff --git a/app/policies/content_asset_policy.rb b/app/policies/content_asset_policy.rb deleted file mode 100644 index d981a467..00000000 --- a/app/policies/content_asset_policy.rb +++ /dev/null @@ -1,2 +0,0 @@ -class ContentAssetPolicy < ContentPagePolicy -end diff --git a/app/policies/content_block_policy.rb b/app/policies/content_block_policy.rb deleted file mode 100644 index 543df17c..00000000 --- a/app/policies/content_block_policy.rb +++ /dev/null @@ -1,22 +0,0 @@ -class ContentBlockPolicy - attr_reader :user, :content_block - - def initialize(user, content_block) - @user = user - @content_block = content_block - end - - def create? - permissions? - end - - def update? - permissions? - end - -private - - def permissions? - user.admin? - end -end diff --git a/app/policies/content_page_policy.rb b/app/policies/content_page_policy.rb deleted file mode 100644 index 46538cc6..00000000 --- a/app/policies/content_page_policy.rb +++ /dev/null @@ -1,23 +0,0 @@ -class ContentPagePolicy < ApplicationPolicy - def create? - permissions? - end - - def update? - permissions? - end - - def destroy? - permissions? - end - - def unpublish? - permissions? && record.is_published - end - -private - - def permissions? - user.editor? || user.admin? - end -end diff --git a/app/policies/content_page_version_policy.rb b/app/policies/content_page_version_policy.rb deleted file mode 100644 index 3a70d5fb..00000000 --- a/app/policies/content_page_version_policy.rb +++ /dev/null @@ -1,15 +0,0 @@ -class ContentPageVersionPolicy < ApplicationPolicy - def update? - permissions? - end - - def destroy? - permissions? - end - -private - - def permissions? - user.editor? || user.admin? - end -end diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb deleted file mode 100644 index 92ee1a7f..00000000 --- a/app/policies/user_policy.rb +++ /dev/null @@ -1,27 +0,0 @@ -class UserPolicy < ApplicationPolicy - def index? - permissions? - end - - def create? - permissions? - end - - def update? - permissions? - end - - def destroy? - user != record && permissions? - end - - def change_role? - user != record && permissions? - end - -private - - def permissions? - user.admin? - end -end diff --git a/app/views/admin/content_blocks/_form.html.erb b/app/views/admin/content_blocks/_form.html.erb deleted file mode 100644 index 919ffcd2..00000000 --- a/app/views/admin/content_blocks/_form.html.erb +++ /dev/null @@ -1,47 +0,0 @@ -<div class="govuk-width-container"> - <div class="govuk-grid-row"> - <div class="govuk-grid-column-one-half"> - <p class="govuk-heading-m">Details</p> - <%= form_with(model: [:admin, content_block], data: { turbo: false }, local: true, builder: GOVUKDesignSystemFormBuilder::FormBuilder) do |form| %> - <%= form.govuk_error_summary order: %i[name description markdown] %> - - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.govuk_text_field :name, label: {text: "Name - this should be provided by the developers, it refers to part of the fixed pages"}, disabled: content_block&.id, 'data-character-counter-target': 'input', maxlength: '10000', hint: {text: "<p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the name.</p>".html_safe} %> - </div> - - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.govuk_text_field :description, label: {text: "Description - where does this appear in the site ?"}, 'data-character-counter-target': 'input', maxlength: '10000', hint: {text: "<p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the description.</p>".html_safe} %> - </div> - - <!-- This text_area is not rendered with gov_text_field because it needs to - set its own id, and the GOVUKDesignSystemFormBuilder hijacks it --> - - <% markdown_class = 'govuk-form-group--error' if @content_block.errors[:markdown].count > 0 %> - <div class="govuk-form-group gem-c-govspeak govuk-form-group <%= markdown_class %>" id="content-block-markdown-field-error"> - <label id="markdown-hint" for="markdown-editor" class="govuk-label"> - Content - Markdown for the block - </label> - <% if @content_block&.errors[:markdown].count > 0 %> - <span class="govuk-error-message"><%= @content_block.errors[:markdown][0] %></span> - <% end %> - <% text_area_class = (@content_block.errors[:markdown].count > 0) ? 'govuk-input govuk-input--error govuk-textarea' : 'govuk-input govuk-textarea' %> - - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.text_area :markdown, id: 'markdown-editor', rows: 20, cols: 35, class: text_area_class, 'data-character-counter-target': 'input', maxlength: '30000' %> - <p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the markdown.</p> - </div> - </div> - <%= form.govuk_submit "Save" %> - <% end %> - - <p class="govuk-body"><%= link_to "Cancel", admin_content_blocks_path %></p> - </div> - - <div class="govuk-grid-column-one-half"> - <p class="govuk-heading-m">Preview</p> - <div id='markdown-render' class='gem-c-govspeak'> - <%= translate_markdown(@content_block.markdown) %> - </div> - </div> - </div> -</div> diff --git a/app/views/admin/content_blocks/edit.html.erb b/app/views/admin/content_blocks/edit.html.erb deleted file mode 100644 index 428dacb2..00000000 --- a/app/views/admin/content_blocks/edit.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -<h1 class="govuk-heading-l">Edit a block</h1> -<%= render 'form', content_block: @content_block %> diff --git a/app/views/admin/content_blocks/index.html.erb b/app/views/admin/content_blocks/index.html.erb deleted file mode 100644 index ce8a5269..00000000 --- a/app/views/admin/content_blocks/index.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -<h1 class="govuk-heading-l">Blocks</h1> -<p class="govuk-body-s">A block is part of one of the fixed pages that you can edit. Blocks will usually be created by - developers, only the content will be editable</p> -<%= link_to 'Create a block', new_admin_content_block_path, :class => "govuk-button" %> - -<div> - <% if @content_blocks.count == 0 %> - <p class="govuk-error-message">No blocks have been created yet</p> - <% end %> - - <div> - <% @content_blocks.each_with_index do |content_block, index| %> - <div> - <p class="govuk-heading-m"> - <%= content_block.name %> - </p> - <p class="govuk-body-s"> - <%= content_block.description %> - <span> - <%= link_to 'Edit', edit_admin_content_block_path(content_block), { :class => "govuk-link" } %> - </span> - </p> - </div> - <% end %> - </div> -</div> diff --git a/app/views/admin/content_blocks/new.html.erb b/app/views/admin/content_blocks/new.html.erb deleted file mode 100644 index 340b7d4a..00000000 --- a/app/views/admin/content_blocks/new.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<h1 class="govuk-heading-l">Add a new block</h1> - -<%= link_to 'Back', admin_content_blocks_path, class: 'govuk-back-link'%> - -<%= render 'form', content_block: @content_block %> - -<%= link_to 'Back', admin_content_blocks_path, class: 'govuk-back-link'%> - diff --git a/app/views/admin/content_page_versions/_details_for_a_single_page.erb b/app/views/admin/content_page_versions/_details_for_a_single_page.erb deleted file mode 100644 index 0c4337a7..00000000 --- a/app/views/admin/content_page_versions/_details_for_a_single_page.erb +++ /dev/null @@ -1,27 +0,0 @@ -<div class="nesting_level_<%= level %>"> - - <div class="summary"> - <p class="govuk-heading-m"> - <%= page_to_render.title %> - <% if !page_to_render.is_published %> - (Draft) - <% end %> - <span class="links"> - <%= link_to 'Versions', versions_admin_content_page_path(page_to_render), { :class => "govuk-link" } %> - <% if !page_to_render.parent_id %> - |<%= link_to 'Add a child page', new_admin_content_page_path(:parent_id => page_to_render.id) %> - <% end %> - |<%= link_to 'Preview', path_for_this_page(page_to_render), target: "_blank" %> - </span> - </p> - </div> - <div> - <ul class="govuk-list"> - <% page_to_render.children.order_by_position.each_with_index do |child, index| %> - <li> - <%= render partial: 'details_for_a_single_page', locals: {page_to_render: child, level: level + 1} %> - </li> - <% end %> - </ul> - </div> -</div> diff --git a/app/views/admin/content_page_versions/_form.html.erb b/app/views/admin/content_page_versions/_form.html.erb deleted file mode 100644 index 3777c1c2..00000000 --- a/app/views/admin/content_page_versions/_form.html.erb +++ /dev/null @@ -1,77 +0,0 @@ -<div class="govuk-width-container"> - <div class="govuk-grid-row"> - <div class="govuk-grid-column-one-half"> - <p class="govuk-heading-m">Details</p> - <%= form_with(model: [:admin, :content_page, @content_page_version], data: { turbo: false }, local: true, builder: GOVUKDesignSystemFormBuilder::FormBuilder) do |form| %> - <fieldset class="govuk-fieldset"> - <%= form.govuk_error_summary order: %i[title markdown] %> - - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.govuk_text_field :title, label: {text: "Heading"}, :class => 'govuk-input govuk-!-width-three-quarters', 'data-character-counter-target': 'input', maxlength: '10000' %> - <p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the title.</p> - </div> - - <!-- This text_area is not rendered with gov_text_field because it needs to - set its own id, and the GOVUKDesignSystemFormBuilder hijacks it --> - <div class="govuk-form-group gem-c-govspeak"> - - <label id="intro-hint" for="intro-editor" class="govuk-label"> - Introduction - </label> - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.text_area :intro, id: 'intro-editor', rows: 8, cols: 35, class: 'govuk-input govuk-textarea', 'data-character-counter-target': 'input', maxlength: '10000' %> - <p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the introduction.</p> - </div> - - <label id="content-list-hint" for="content-list-editor" class="govuk-label"> - Table of contents - </label> - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.text_area :content_list, id: 'content-list-editor', rows: 8, cols: 35, class: 'govuk-input govuk-textarea', 'data-character-counter-target': 'input', maxlength: '10000' %> - <p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the content list.</p> - </div> - - <label id="markdown-hint" for="markdown-editor" class="govuk-label"> - Content - </label> - - <% if @content_page_version&.errors[:markdown].present? %> - <span class="govuk-error-message"><%= @content_page_version.errors[:markdown][0] %></span> - <% end %> - - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.text_area :markdown, :id => 'markdown-editor', :rows => 20, :cols => 35, :class => govuk_input_classes(:textarea, errors: @content_page_version.errors[:markdown]), 'data-character-counter-target': 'input', maxlength: '30000' %> - <p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the markdown.</p> - </div> - - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.govuk_text_area :description, label: {text: "Meta Description"}, 'data-character-counter-target': 'input', maxlength: '10000' %> - <p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the description.</p> - </div> - </div> - - <% if action_name === "edit" || action_name === "new" || action_name === "update" %> - <div class="fixed-footer"> - <%= form.govuk_submit "Save as draft" %> - <%= link_to 'Cancel', versions_admin_content_page_path(@content_page_version.content_page), data: { confirm: "Any changes will be lost, are you sure ?" }, class: "govuk-link" %> - </div> - <% end %> - </fieldset> - - <% end %> - </div> - - <div class="govuk-grid-column-one-half"> - <p class="govuk-heading-m">Preview</p> - <div id='intro-render' class='gem-c-govspeak'> - <%= translate_markdown(@content_page_version.intro) %> - </div> - <div id='content-list-render' class='gem-c-govspeak'> - <%= translate_markdown(@content_page_version.content_list) %> - </div> - <div id='markdown-render' class='gem-c-govspeak govuk-!-margin-top-5'> - <%= translate_markdown(@content_page_version.markdown) %> - </div> - </div> - </div> -</div> diff --git a/app/views/admin/content_page_versions/edit.html.erb b/app/views/admin/content_page_versions/edit.html.erb deleted file mode 100644 index a9db6f64..00000000 --- a/app/views/admin/content_page_versions/edit.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<div class="govuk-grid-row"> - <div class="govuk-grid-column-one-half"> - <h1 class="govuk-heading-l">Edit page - <%= @content_page_version&.title %></h1> - </div> - <div class="govuk-grid-column-one-half draft"> - <strong class="published-status govuk-tag"> - Draft - </strong> - </div> -</div> - -<%= render 'form', content_page_version: @content_page_version %> diff --git a/app/views/admin/content_page_versions/preview_of_draft.erb b/app/views/admin/content_page_versions/preview_of_draft.erb deleted file mode 100644 index e8295ce8..00000000 --- a/app/views/admin/content_page_versions/preview_of_draft.erb +++ /dev/null @@ -1,24 +0,0 @@ -<strong aria-label="Preview label" class="govuk-tag">Preview</strong> -<% if @content_page_version.content_page.parent %> - <span class="govuk-caption-l"><%= @content_page_version.content_page.parent.title %></span> -<% end %> -<h1 class="govuk-heading-l"> - <%= @content_page_version.title %> -</h1> - -<%= translate_markdown(@content_page_version.intro) %> - -<% unless @content_page_version.content_list.blank? %> - <p id="contents-list-heading" class="govuk-body govuk-!-margin-bottom-1"> Contents </p> - <%= translate_markdown(@content_page_version.content_list) %> - <%= print_button("govuk-!-margin-top-7", "govuk-!-margin-bottom-2") %> -<% end %> - -<div class="govuk-!-margin-top-4"> - <%= translate_markdown(@content_page_version.markdown) %> -</div> - -<div class="fixed-footer"> - <%= button_to "Publish", publish_admin_content_page_content_page_version_path(@content_page_version.content_page, @content_page_version), class: "govuk-button", data: { confirm: "Are you sure you want to publish this draft ?" } %> - <%= link_to 'Back', versions_admin_content_page_path(@content_page_version.content_page) %> -</div> diff --git a/app/views/admin/content_pages/_details_for_a_single_page.erb b/app/views/admin/content_pages/_details_for_a_single_page.erb deleted file mode 100644 index d8b2fcb2..00000000 --- a/app/views/admin/content_pages/_details_for_a_single_page.erb +++ /dev/null @@ -1,27 +0,0 @@ -<div class="nesting_level_<%= level %>"> - - <div class="summary"> - <p class="govuk-heading-m"> - <%= page_to_render.title %> - <span class="links"> - <%= link_to 'Versions', versions_admin_content_page_path(page_to_render), { class: "govuk-link" } %> - <% if !page_to_render.parent_id %> - |<%= link_to 'Add a child page', new_admin_content_page_path(parent_id: page_to_render.id), { class: "govuk-link" } %> - <% end %> - <% if (page_to_render.is_published) %> - | <%= link_to 'Preview', preview_of_live_admin_content_page_path(page_to_render), { class: "govuk-link", target: "_blank" } %> - <% end %> - <span><%= page_to_render.is_published ? "Published - " : "Unpublished - " %><%= page_to_render.content_page_versions.count %> draft<%= page_to_render.content_page_versions.count > 1 ? "s": ""%></span> - </span> - </p> - </div> - <div> - <ul class="govuk-list"> - <% page_to_render.children.order_by_position.each_with_index do |child, index| %> - <li> - <%= render partial: 'details_for_a_single_page', locals: {page_to_render: child, level: level + 1} %> - </li> - <% end %> - </ul> - </div> -</div> diff --git a/app/views/admin/content_pages/_form.html.erb b/app/views/admin/content_pages/_form.html.erb deleted file mode 100644 index fe5d721d..00000000 --- a/app/views/admin/content_pages/_form.html.erb +++ /dev/null @@ -1,77 +0,0 @@ -<div class="govuk-width-container"> - <div class="govuk-grid-row"> - <div class="govuk-grid-column-one-half"> - <p class="govuk-heading-m">Details</p> - <%= form_with(model: [:admin, content_page], data: { turbo: false }, local: true, builder: GOVUKDesignSystemFormBuilder::FormBuilder) do |form| %> - <%= form.govuk_error_summary order: %i[title markdown position] %> - - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.govuk_text_field :title, label: {text: "Heading"}, :class => 'govuk-input govuk-!-width-three-quarters', disabled: (@content_page.title && !content_page.parent_id), 'data-character-counter-target': 'input', maxlength: '10000' %> - <p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the title.</p> - </div> - - <!-- This text_area is not rendered with gov_text_field because it needs to - set its own id, and the GOVUKDesignSystemFormBuilder hijacks it --> - <div class="govuk-form-group gem-c-govspeak"> - - <label id="intro-hint" for="intro-editor" class="govuk-label"> - Introduction - </label> - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.text_area :intro, id: 'intro-editor', rows: 8, cols: 35, class: 'govuk-input govuk-textarea', 'data-character-counter-target': 'input', maxlength: '10000' %> - <p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the introduction.</p> - </div> - - <label id="content-list-hint" for="content-list-editor" class="govuk-label"> - Table of contents - </label> - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.text_area :content_list, id: 'content-list-editor', rows: 8, cols: 35, class: 'govuk-input govuk-textarea', 'data-character-counter-target': 'input', maxlength: '10000' %> - <p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the content list.</p> - </div> - - <label id="markdown-hint" for="markdown-editor" class="govuk-label"> - Content - </label> - - <% if @content_page&.errors[:markdown].present? %> - <span class="govuk-error-message"><%= @content_page.errors[:markdown][0] %></span> - <% end %> - - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.text_area :markdown, :id => 'markdown-editor', :rows => 20, :cols => 35, :class => govuk_input_classes(:textarea, errors: @content_page.errors[:markdown]), 'data-character-counter-target': 'input', maxlength: '30000' %> - <p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the markdown.</p> - </div> - - <%= form.hidden_field :parent_id, id: "parent_id" %> - <%= form.govuk_text_field :position, label: {text: "Position"}%> - - <div data-controller='character-counter' data-character-counter-countdown-value='true'> - <%= form.govuk_text_area :description, label: {text: "Meta Description"}, 'data-character-counter-target': 'input', maxlength: '10000' %> - <p>There are <strong data-character-counter-target='counter' ></strong> remaining characters in the description.</p> - </div> - </div> - - <div class="fixed-footer"> - <%= form.govuk_submit "Save" %> - <% if action_name === "edit" || action_name === "update" %> - <%= link_to 'Cancel', versions_admin_content_page_path(content_page), data: { confirm: "Any changes will be lost, are you sure ?" }, class: "govuk-link" %> - <% end %> - </div> - <% end %> - </div> - - <div class="govuk-grid-column-one-half"> - <p class="govuk-heading-m">Preview</p> - <div id='intro-render' class='gem-c-govspeak'> - <%= translate_markdown(content_page.intro) %> - </div> - <div id='content-list-render' class='gem-c-govspeak'> - <%= translate_markdown(content_page.content_list) %> - </div> - <div id='markdown-render' class='gem-c-govspeak govuk-!-margin-top-5'> - <%= translate_markdown(content_page.markdown) %> - </div> - </div> - </div> -</div> diff --git a/app/views/admin/content_pages/_table_of_draft_versions.erb b/app/views/admin/content_pages/_table_of_draft_versions.erb deleted file mode 100644 index b08c02d5..00000000 --- a/app/views/admin/content_pages/_table_of_draft_versions.erb +++ /dev/null @@ -1,24 +0,0 @@ -<table class="govuk-table"> - <thead class="govuk-table__head"> - <tr class="govuk-table__row"> - <th scope="col" class="govuk-table__header govuk-!-width-one-quarter">Draft</th> - <th scope="col" class="govuk-table__header govuk-!-width-one-quarter"></th> - <th scope="col" class="govuk-table__header govuk-!-width-one-quarter"></th> - <th scope="col" class="govuk-table__header govuk-!-width-one-quarter">Author</th> - </tr> - </thead> - <tbody class="govuk-table__body"> - <% @content_page.content_page_versions.order_by_created_at.each do |version| %> - <tr class="govuk-table__row"> - <td class="govuk-table__cell govuk-!-width-one-quarter"><%= version.title %></td> - <td class="govuk-table__cell govuk-!-width-one-quarter"><%= version.updated_at.strftime("%d/%m/%Y %H:%M %p") %></td> - <td class="govuk-table__cell govuk-!-width-one-quarter"> - <%= link_to 'Edit', edit_admin_content_page_content_page_version_path(@content_page, version), { :class => "govuk-link" } %> - <%= link_to 'Preview and Publish', preview_of_draft_admin_content_page_content_page_version_path(@content_page, version), { :class => "govuk-link" } %> - <%= link_to "Delete", admin_content_page_content_page_version_path(@content_page, version), data: { 'turbo-method': :delete, 'turbo-confirm': "Are you certain you want to delete this version ? " + version.created_at.strftime('%d/%m/%Y %I:%M') } %> - </td> - <td class="govuk-table__cell govuk-!-width-one-quarter"><%= version.author %></td> - </tr> - <% end %> - </tbody> -</table> diff --git a/app/views/admin/content_pages/_table_of_live_version.erb b/app/views/admin/content_pages/_table_of_live_version.erb deleted file mode 100644 index e215f857..00000000 --- a/app/views/admin/content_pages/_table_of_live_version.erb +++ /dev/null @@ -1,22 +0,0 @@ -<table class="govuk-table"> - <thead class="govuk-table__head"> - <tr class="govuk-table__row"> - <th scope="col" class="govuk-table__header">Live</th> - <th scope="col" class="govuk-table__header"></th> - <th scope="col" class="govuk-table__header"></th> - <th scope="col" class="govuk-table__header">Author</th> - </tr> - </thead> - <tbody class="govuk-table__body"> - <tr class="govuk-table__row"> - <td class="govuk-table__cell govuk-!-width-one-quarter"><%= @content_page.title %></td> - <td class="govuk-table__cell govuk-!-width-one-quarter"><%= @content_page.updated_at.strftime("%d/%m/%Y %H:%M %p") %></td> - <td class="govuk-table__cell govuk-!-width-one-quarter"> - <%= link_to "Edit", edit_admin_content_page_path(@content_page), { :class => "govuk-link" } %> - <%= link_to "Unpublish", unpublish_admin_content_page_path(@content_page), method: :post, :class => "govuk-link" %> - <%= link_to "Preview", preview_of_live_admin_content_page_path(@content_page), { :class => "govuk-link", :target => "_blank" } %> - </td> - <td class="govuk-table__cell govuk-!-width-one-quarter"><%= @content_page.author %></td> - </tr> - </tbody> -</table> diff --git a/app/views/admin/content_pages/edit.html.erb b/app/views/admin/content_pages/edit.html.erb deleted file mode 100644 index 8ee6804e..00000000 --- a/app/views/admin/content_pages/edit.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<div class="govuk-grid-row"> - <div class="govuk-grid-column-one-half"> - <h1 class="govuk-heading-l">Edit page - <%= @content_page&.title %></h1> - </div> - <div class="govuk-grid-column-one-half draft"> - <strong class="published-status govuk-tag"> - <%= @content_page.is_published ? "Published" : "Draft" %> - </strong> - </div> -</div> - -<%= render 'form', content_page: @content_page %> diff --git a/app/views/admin/content_pages/index.html.erb b/app/views/admin/content_pages/index.html.erb deleted file mode 100644 index 551df4b4..00000000 --- a/app/views/admin/content_pages/index.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -<h1 class="govuk-heading-l">Pages</h1> -<br/> - -<div> - <% @content_pages.each_with_index do |content_page, index| %> - <%= render partial: 'details_for_a_single_page', locals: {page_to_render: content_page, level: 1} %> - <% end %> -</div> - diff --git a/app/views/admin/content_pages/new.html.erb b/app/views/admin/content_pages/new.html.erb deleted file mode 100644 index f05bd4a3..00000000 --- a/app/views/admin/content_pages/new.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<h1 class="govuk-heading-l">Add a new page</h1> - -<%= link_to 'Back', admin_content_pages_path, class: 'govuk-back-link'%> - -<%= render 'form', content_page: @content_page %> - -<%= link_to 'Back', admin_content_pages_path, class: 'govuk-back-link'%> - diff --git a/app/views/admin/content_pages/preview_of_live.erb b/app/views/admin/content_pages/preview_of_live.erb deleted file mode 100644 index 22ef211a..00000000 --- a/app/views/admin/content_pages/preview_of_live.erb +++ /dev/null @@ -1,24 +0,0 @@ -<strong aria-label="Preview label" class="govuk-tag">Preview</strong> -<% if @content_page.parent %> - <span class="govuk-caption-l"><%= @content_page.parent.title %></span> -<% end %> - -<h1 class="govuk-heading-l"> - <%= @content_page.title %> -</h1> - -<%= translate_markdown(@content_page.intro) %> - -<% unless @content_page.content_list.blank? %> - <p id="contents-list-heading" class="govuk-body govuk-!-margin-bottom-1"> Contents </p> - <%= translate_markdown(@content_page.content_list) %> - <%= print_button("govuk-!-margin-top-7") %> -<% end %> - -<div class="govuk-!-margin-top-4"> - <%= translate_markdown(@content_page.markdown) %> -</div> - -<div class="fixed-footer"> - <%= link_to 'Back', versions_admin_content_page_path(@content_page) %> -</div> diff --git a/app/views/admin/content_pages/show.html.erb b/app/views/admin/content_pages/show.html.erb deleted file mode 100644 index c5d365f9..00000000 --- a/app/views/admin/content_pages/show.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -<p> - <strong>Title:</strong> - <%= @content_page.title %> -</p> - -<%= translate_markdown(@content_page.intro) %> - -<p> - <strong>Content (Govspeak):</strong> - <%= @content_page.markdown %> -</p> - -<%= link_to 'Edit', edit_admin_content_page_path(@content_page) %> | -<%= link_to 'Back', admin_content_pages_path %> diff --git a/app/views/admin/content_pages/versions.erb b/app/views/admin/content_pages/versions.erb deleted file mode 100644 index b68b033f..00000000 --- a/app/views/admin/content_pages/versions.erb +++ /dev/null @@ -1,12 +0,0 @@ -<h1 class="govuk-heading-l">Page versions</h1> - -<h2 class="govuk-heading-s"><%= @content_page.title %></h2> - -<% if @content_page.is_published %> - <%= render partial: 'table_of_live_version' %> -<% else %> - <p class="govuk-body-s">No versions published yet</p> -<% end %> - -<%= render partial: 'table_of_draft_versions' %> - diff --git a/app/views/admin/users/_form.html.erb b/app/views/admin/users/_form.html.erb deleted file mode 100644 index 16ecaf35..00000000 --- a/app/views/admin/users/_form.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<%= form_with(model: [:admin, user], data: { turbo: false }, local: true, builder: GOVUKDesignSystemFormBuilder::FormBuilder) do |form| %> - <%= form.govuk_error_summary order: %i[first_name last_name email password password_confirmation role] %> - <%= form.govuk_text_field :first_name, label: {text: "First name"} %> - <%= form.govuk_text_field :last_name, label: {text: "Last name"} %> - <%= form.govuk_email_field :email, disabled: user.persisted?, label: {text: "Email"} %> - <span class="govuk-fieldset tooltip"> - <%= form.govuk_password_field :password, placeholder: user.persisted? ? "********" : "", label: {text: "Password", id: "user-password-label"} do %> - <%= t('password_hint.html') %> - <% end %> - <%= form.govuk_password_field :password_confirmation, placeholder: user.persisted? ? "********" : "", label: {text: "Confirm password"} %> - </span> - <% if policy(@user).change_role? %> - <%= form.govuk_collection_radio_buttons(:role, User.valid_roles, :first, :last, inline: true )%> - <% else %> - <p class="govuk-heading-m">Your role is admin and you cannot change it</p> - <% end %> - <%= form.govuk_submit "Save" %> -<% end %> -<p class="govuk-body"><%= link_to "Cancel", admin_users_path %></p> diff --git a/app/views/admin/users/_user.html.haml b/app/views/admin/users/_user.html.haml deleted file mode 100644 index 92690947..00000000 --- a/app/views/admin/users/_user.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%tr.govuk-table__row - %td.govuk-table__cell - = user.name - %td.govuk-table__cell - = user.email - %td.govuk-table__cell - = t(user.role, scope: :roles, default: 'Unknown role') - %td.govuk-table__cell - %b - = link_to('Edit', edit_admin_user_path(user), id: dom_id(user)) diff --git a/app/views/admin/users/edit.html.erb b/app/views/admin/users/edit.html.erb deleted file mode 100644 index 8f890e15..00000000 --- a/app/views/admin/users/edit.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%= link_to "Back", admin_users_path, class: "govuk-back-link" %> - -<h1 class="govuk-heading-l">Edit user</h1> -<% if policy(@user).destroy? %> - <%= button_to "Delete", [:admin, @user], method: :delete, class: "govuk-button govuk-button--warning", data: { turbo_confirm: "Are you sure you want to delete #{@user.email}?" } %> -<% end %> -<div class="govuk-width-container"> - <div class="govuk-grid-row"> - <div class="govuk-grid-column-one-half"> - <%= render "form", user: @user %> - </div> - </div> -</div> diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml deleted file mode 100644 index d40e52ee..00000000 --- a/app/views/admin/users/index.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h1.govuk-heading-xl - User administration - -= link_to "Add user", new_admin_user_path, id: 'add-user', class: 'govuk-button' -%table.govuk-table - %thead.govuk-table__head - %tr.govuk-table__row - %th.govuk-table__header{scope: 'col'} - Name - %th.govuk-table__header{scope: 'col'} - Email address - %th.govuk-table__header{scope: 'col'} - Role (CMS) - %th.govuk-table__header{ scope: 'col' } - %tbody.govuk-table__body - =render @users.order(email: :asc) diff --git a/app/views/admin/users/new.html.erb b/app/views/admin/users/new.html.erb deleted file mode 100644 index a9c346d1..00000000 --- a/app/views/admin/users/new.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<%= link_to "Back", admin_users_path, class: "govuk-back-link" %> - -<h1 class="govuk-heading-l">Add user</h1> -<div class="govuk-width-container"> -<div class="govuk-grid-row"> - <div class="govuk-grid-column-one-half"> - <%= render partial: 'form', locals: {user: @user} %> - </div> -</div> -</div> diff --git a/app/views/content/index.html.erb b/app/views/content/index.html.erb deleted file mode 100644 index 085c9c58..00000000 --- a/app/views/content/index.html.erb +++ /dev/null @@ -1,83 +0,0 @@ -<div class="govuk-main-wrapper" id="main-content"> - <div class="govuk-width-container govuk-!-margin-bottom-1"> - <div class="govuk-grid-row"> - <div class="govuk-grid-column-full landing-page_header-text-container govuk-!-margin-bottom-0 govuk-!-padding-bottom-0"> - <%== insert_block('landing-page-introduction') %> - </div> - </div> - </div> - - <!--Cards section--> - <!--7 Areas of Learning Section --> - <div class="landing-page__section--grey"> - <div class="govuk-width-container"> - <h2 class="govuk-heading-l">Areas of learning</h2> - <div class="govuk-grid-row"> - <div class="govuk-grid-column-full"> - <p class="govuk-body govuk-!-margin-bottom-7">Find information about each area of learning in the EYFS and get - ideas for activities you can do with early years children.</p> - </div> - </div> - <ul class="govuk-grid-row eyfs-card-group"> - <% @content_pages.each do |content_page| %> - <li class="govuk-grid-column-one-half eyfs-card-group__item"> - <div class="eyfs-card eyfs-card--clickable eyfs-card--link"> - <div class="eyfs-card__content"> - <a class="govuk-link govuk-!-font-size-19 govuk-!-font-weight-bold govuk-link--no-visited-state" href="<%= '/' + content_page.slug %>"><%= content_page.title %></a> - <svg class="eyfs-card--icon" width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> - <path d="M9 4.49992L20.0217 15.5213L9 26.5427" stroke="#1D70B8" stroke-width="2"/> - </svg> - </div> - </div> - </li> - <% end %> - </ul> - </div> - <!--End of 7 Areas of Learning Section --> - - <!-- Featured Pages Section --> - <div class="govuk-width-container"> - <% @featured_pages.each do |featured_page| %> - <h2 class="govuk-heading-l govuk-!-padding-top-5"><%= featured_page.title %></h2> - <ul class="govuk-grid-row eyfs-card-group"> - <% if featured_page.title != "Safeguarding and welfare" %> - <li class="govuk-grid-column-one-half eyfs-card-group__item"> - <div class="eyfs-card eyfs-card--clickable eyfs-card--link"> - <div class="eyfs-card__content"> - <a class="govuk-link govuk-!-font-size-19 govuk-!-font-weight-bold govuk-link--no-visited-state" href="<%= path_for_this_page(featured_page) %>">Overview</a> - <svg class="eyfs-card--icon" width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> - <path d="M9 4.49992L20.0217 15.5213L9 26.5427" stroke="#1D70B8" stroke-width="2"/> - </svg> - </div> - </div> - </li> - <% end %> - <% (featured_page&.children.published.order_by_position || []).each do |child| %> - <li class="govuk-grid-column-one-half eyfs-card-group__item"> - <div class="eyfs-card eyfs-card--clickable eyfs-card--link"> - <div class="eyfs-card__content"> - <a class="govuk-link govuk-!-font-size-19 govuk-!-font-weight-bold govuk-link--no-visited-state" href="<%= path_for_this_page(child) %>"><%= child.title %></a> - <svg class="eyfs-card--icon" width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> - <path d="M9 4.49992L20.0217 15.5213L9 26.5427" stroke="#1D70B8" stroke-width="2"/> - </svg> - </div> - </div> - </li> - <% end %> - </ul> - <% end %> - </div> - </div> - <!-- End of Featured Pages Section --> - <!--End of cards section--> - - <!--Other useful resources--> - <div class="govuk-width-container govuk-!-padding-top-8 govuk-!-margin-bottom-7"> - <div class="govuk-grid-row"> - <div class="govuk-grid-column-full"> - <%== insert_block('other_useful_resources') %> - </div> - </div> - </div> - <!--End of Other useful resources--> -</div> diff --git a/app/views/content/show.html.erb b/app/views/content/show.html.erb deleted file mode 100644 index 0823e1b4..00000000 --- a/app/views/content/show.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -<% if @page.parent %> - <span class="govuk-caption-l"><%= @page.parent.title %></span> -<% end %> - -<h1 class="govuk-heading-l"> - <%= @page.title %> -</h1> - -<%= translate_markdown(@page.intro) %> - -<% unless @page.content_list.blank? %> - <p id="contents-list-heading" class="govuk-body govuk-!-margin-bottom-1"> - Contents - </p> - <%= translate_markdown(@page.content_list) %> -<% end %> - -<% if @page.content_list %> - <%= print_button("govuk-!-margin-top-7") %> -<% end %> - -<div class="govuk-!-margin-top-4"> - <%= translate_markdown(@page.markdown) %> -</div> diff --git a/app/views/errors/internal_server_error.html.erb b/app/views/errors/internal_server_error.html.erb deleted file mode 100644 index 8f98fb22..00000000 --- a/app/views/errors/internal_server_error.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<div class="govuk-grid-row"> - <div class="govuk-grid-column-two-thirds"> - <h1 class="govuk-heading-xl">Sorry, there is a problem with the website</h1> - <p class="govuk-body">Please try again later.</p> - <p class="govuk-body">Contact the Help for early years team on </p> - <p class="govuk-body"> - <a class="govuk-link email" href="mailto:help_for_early_years_providers@digital.education.gov.uk"> - help_for_early_years_providers@digital.education.gov.uk - </a> for any questions - </p> - </div> -</div> diff --git a/app/views/errors/internal_server_error.html.slim b/app/views/errors/internal_server_error.html.slim new file mode 100644 index 00000000..57b6c0bc --- /dev/null +++ b/app/views/errors/internal_server_error.html.slim @@ -0,0 +1,11 @@ +.govuk-grid-row + .govuk-grid-column-two-thirds + h1.govuk-heading-xl Sorry, there is a problem with the website + + p.govuk-body Please try again later. + + p.govuk-body Please contact the Help for early years team on: + + p.govuk-body + a.govuk-link.email href='mailto:help_for_early_years_providers@digital.education.gov.uk' target='_blank' rel="noopener noreferrer' help_for_early_years_providers@digital.education.gov.uk + diff --git a/app/views/errors/not_found.html.erb b/app/views/errors/not_found.html.erb deleted file mode 100644 index 471398b2..00000000 --- a/app/views/errors/not_found.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<div class="govuk-grid-row"> - <div class="govuk-grid-column-two-thirds"> - <h1 class="govuk-heading-xl">Page not found</h1> - <p class="govuk-body"> - Use this link to go back to the homepage - <%= link_to("Help for early years providers", root_path) %> - </p> - <p class="govuk-body"> - If the web address is correct or you selected a link or button, contact - <a class="govuk-link email" href="mailto:help_for_early_years_providers@digital.education.gov.uk"> - help_for_early_years_providers@digital.education.gov.uk - </a> to report a fault about the service. - </p> - </div> -</div> diff --git a/app/views/errors/not_found.html.slim b/app/views/errors/not_found.html.slim new file mode 100644 index 00000000..935e1d89 --- /dev/null +++ b/app/views/errors/not_found.html.slim @@ -0,0 +1,12 @@ +.govuk-grid-row + .govuk-grid-column-two-thirds + h1.govuk-heading-xl Page not found + + p.govuk-body + | Use this link to go back to the homepage + = govuk_link_to 'Help for early years providers', root_path + + p.govuk-body + | If the web address is correct or you selected a link or button, contact + = govuk_link_to 'help_for_early_years_providers@digital.education.gov.uk', 'mailto:help_for_early_years_providers@digital.education.gov.uk' + | to report a fault about the service. diff --git a/app/views/errors/service_unavailable.html.erb b/app/views/errors/service_unavailable.html.erb deleted file mode 100644 index 86723a52..00000000 --- a/app/views/errors/service_unavailable.html.erb +++ /dev/null @@ -1,11 +0,0 @@ - <div class="govuk-grid-row"> - <div class="govuk-grid-column-two-thirds"> - <h1 class="govuk-heading-l">Help for early years providers</h1> - <h2 class="govuk-heading-m">Sorry, the site is unavailable</h2> - <p class="govuk-body">You will be able to use the website later.</p> - <p class="govuk-body">Please contact the Help for early years team on:</p> - <p class="govuk-body"> - <a href="mailto:help_for_early_years_providers@digital.education.gov.uk" target="_blank" rel="noopener noreferrer" class="govuk-link email"> help_for_early_years_providers@digital.education.gov.uk</a> - </p> - </div> - </div> diff --git a/app/views/errors/service_unavailable.html.slim b/app/views/errors/service_unavailable.html.slim new file mode 100644 index 00000000..f6cf9f6e --- /dev/null +++ b/app/views/errors/service_unavailable.html.slim @@ -0,0 +1,13 @@ +.govuk-grid-row + .govuk-grid-column-two-thirds + h1.govuk-heading-l Help for early years providers + + h2.govuk-heading-m Sorry, the site is unavailable + + p.govuk-body You will be able to use the website later. + + p.govuk-body Please contact the Help for early years team on: + + p.govuk-body + a.govuk-link.email href='mailto:help_for_early_years_providers@digital.education.gov.uk' target='_blank' rel='noopener noreferrer' help_for_early_years_providers@digital.education.gov.uk + diff --git a/app/views/errors/unprocessable_entity.html.erb b/app/views/errors/unprocessable_entity.html.erb deleted file mode 100644 index d1810b7f..00000000 --- a/app/views/errors/unprocessable_entity.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<div class="govuk-grid-row"> - <div class="govuk-grid-column-two-thirds"> - <h1 class="govuk-heading-xl">The change you wanted was rejected</h1> - <p class="govuk-body">Maybe you tried to change something you didn't have access to.</p> - <p class="govuk-body">If you are the application owner check the logs for more information.</p> - </div> -</div> diff --git a/app/views/errors/unprocessable_entity.html.slim b/app/views/errors/unprocessable_entity.html.slim new file mode 100644 index 00000000..1c40483f --- /dev/null +++ b/app/views/errors/unprocessable_entity.html.slim @@ -0,0 +1,8 @@ +.govuk-grid-row + .govuk-grid-column-two-thirds + h1.govuk-heading-xl The change you wanted was rejected + + p.govuk-body Maybe you tried to change something you didn't have access to. + + p.govuk-body If you are the application owner check the logs for more information. + diff --git a/app/views/home/index.html.slim b/app/views/home/index.html.slim index 929aa9ef..9bfcae16 100644 --- a/app/views/home/index.html.slim +++ b/app/views/home/index.html.slim @@ -12,11 +12,11 @@ .govuk-grid-row class='govuk-!-margin-top-4 govuk-!-margin-bottom-5' .govuk-grid-column-full h2 = page.title - p.govuk-body = translate_markdown(page.body) + p.govuk-body = m(page.body) .govuk-grid-row class='govuk-!-margin-bottom-6' = render partial: 'shared/card', collection: page.pages = render 'shared/ctas' -= render 'shared/other_resources' \ No newline at end of file += render 'shared/other_resources' diff --git a/app/views/layouts/_analytics_body.html.slim b/app/views/layouts/_analytics_body.html.slim new file mode 100644 index 00000000..616884d0 --- /dev/null +++ b/app/views/layouts/_analytics_body.html.slim @@ -0,0 +1,2 @@ +noscript + iframe.govuk-visually-hidden aria-hidden='true' src=Rails.configuration.js_url height='0' width='0' diff --git a/app/views/layouts/beta/_analytics_header.html.erb b/app/views/layouts/_analytics_header.html.slim similarity index 62% rename from app/views/layouts/beta/_analytics_header.html.erb rename to app/views/layouts/_analytics_header.html.slim index afe8256e..8eedc637 100644 --- a/app/views/layouts/beta/_analytics_header.html.erb +++ b/app/views/layouts/_analytics_header.html.slim @@ -1,9 +1,8 @@ -<!-- Google tag (gtag.js) --> -<script async src=<%= Rails.configuration.js_url %>></script> -<script> +script async src=Rails.configuration.js_url + +javascript: window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '<%= Rails.configuration.tracking_id %>'); -</script> \ No newline at end of file diff --git a/app/views/layouts/beta/_hotjar.html b/app/views/layouts/_hotjar.html.slim similarity index 95% rename from app/views/layouts/beta/_hotjar.html rename to app/views/layouts/_hotjar.html.slim index 817caaa1..b605c9ba 100644 --- a/app/views/layouts/beta/_hotjar.html +++ b/app/views/layouts/_hotjar.html.slim @@ -1,4 +1,4 @@ -<script> +javascript: (function (h, o, t, j, a, r) { h.hj = h.hj || function () { (h.hj.q = h.hj.q || []).push(arguments) }; h._hjSettings = { hjid: 2424199, hjsv: 6 }; @@ -7,4 +7,3 @@ r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv; a.appendChild(r); })(window, document, 'https://static.hotjar.com/c/hotjar-', '.js?sv='); -</script> \ No newline at end of file diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index 80eb416d..6287816a 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -6,8 +6,8 @@ html.govuk-template lang='en' = csp_meta_tag = tag.meta content: 'text/html; charset=UTF-8', 'http-equiv': 'Content-Type' - = render 'layouts/beta/analytics_header' - = render 'layouts/beta/hotjar' + = render 'layouts/analytics_header' + = render 'layouts/hotjar' = tag.meta content: 'width=device-width,initial-scale=1', name: 'viewport' = tag.meta name: 'robots', content: 'noindex,nofollow' unless Rails.application.live? @@ -22,7 +22,7 @@ html.govuk-template lang='en' = favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' = favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' = favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' - = stylesheet_link_tag 'main', 'data-turbo-track': 'reload' + = stylesheet_link_tag 'application', 'data-turbo-track': 'reload' = javascript_include_tag 'application', 'data-turbo-track': 'reload', defer: true = yield :head @@ -30,7 +30,7 @@ html.govuk-template lang='en' script | document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled'); - = render 'layouts/beta/analytics_body' + = render 'layouts/analytics_body' = render 'layouts/cookie_banner' = govuk_skip_link diff --git a/app/views/layouts/beta/_analytics_body.html.erb b/app/views/layouts/beta/_analytics_body.html.erb deleted file mode 100644 index 71570525..00000000 --- a/app/views/layouts/beta/_analytics_body.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<!-- Google Tag Manager (noscript) --> -<noscript> - <iframe src="<%= Rails.configuration.js_url %>" height="0" width="0" style="display:none;visibility:hidden"> - </iframe> -</noscript> -<!-- End Google Tag Manager (noscript) --> diff --git a/app/views/layouts/beta/_breadcrumbs.html.erb b/app/views/layouts/beta/_breadcrumbs.html.erb deleted file mode 100644 index d82ce814..00000000 --- a/app/views/layouts/beta/_breadcrumbs.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<div class="govuk-breadcrumbs"> - <ol class="govuk-breadcrumbs__list"> - <li class="govuk-breadcrumbs__list-item"> - <a class="govuk-breadcrumbs__link" href="/">Home</a> - </li> - <% if @page.parent %> - <li class="govuk-breadcrumbs__list-item"> - <a class="govuk-breadcrumbs__link" href="<%= path_for_this_page(@page.parent) %>"> - <%= @page.parent.title %> - </a> - </li> - <% end %> - - <li class="govuk-breadcrumbs__list-item"> - <a class="govuk-breadcrumbs__link" href="<%= path_for_this_page(@page)%>"> - <%= @page.title %> - </a> - </li> - </li> - </ol> -</div> diff --git a/app/views/layouts/beta/_cookies_notice.html.erb b/app/views/layouts/beta/_cookies_notice.html.erb deleted file mode 100644 index bd140f82..00000000 --- a/app/views/layouts/beta/_cookies_notice.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<div class="govuk-cookie-banner " role="region" aria-label="Cookies on Help for early years providers" > - <div class="govuk-cookie-banner__message govuk-width-container"> - <div class="govuk-grid-row"> - <div class="govuk-grid-column-two-thirds"> - <h2 class="govuk-cookie-banner__heading govuk-heading-m">Cookies on Help for early years providers</h2> - <div class="govuk-cookie-banner__content"> - <p>We use some essential cookies to make this service work.</p> - <p>We'd also like to use analytics cookies so we can understand how you use this service and make improvements.</p> - </div> - </div> - </div> - <div class="govuk-button-group"> - <%= button_to "Accept analytics cookies", { controller: "/settings", action: "create" }, params: { track_analytics: "Yes", return_url: request.path }, :method => :post, class: "govuk-button" %> - <%= button_to "Reject analytics cookies", { controller: "/settings", action: "create" }, params: { track_analytics: "No", return_url: request.path }, :method => :post, class: "govuk-button" %> - <%= link_to "View cookies", "/settings/cookie-policy", class: "govuk-link" %> - </div> - </div> -</div> \ No newline at end of file diff --git a/app/views/layouts/beta/_desktop_menu.html.erb b/app/views/layouts/beta/_desktop_menu.html.erb deleted file mode 100644 index ecf09450..00000000 --- a/app/views/layouts/beta/_desktop_menu.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -<nav role="navigation" class="app-subnav"> - <% ContentPage.published.top_level.order_by_position.each do |top_level_page| %> - <a class="govuk-link app-subnav__link govuk-link--no-visited-state <%= is_current?(top_level_page) ? 'app-subnav__section-item--current' : '' %>" href="<%= path_for_this_page(top_level_page) %>"> - <p class="app-subnav__theme"><%= top_level_page.title %></p> - </a> - <ul class="app-subnav__section "> - <% top_level_page.children.published.order_by_position.each do |child| %> - <li class=" app-subnav__section-item <%= is_current?(child) ? 'app-subnav__section-item--current' : '' %>"> - <a class="govuk-link app-subnav__link govuk-link--no-visited-state" href="<%= path_for_this_page(child) %>"><%= child.title %></a> - </li> - <% end %> - </ul> - <% end %> -</nav> diff --git a/app/views/layouts/beta/_feedback.html.erb b/app/views/layouts/beta/_feedback.html.erb deleted file mode 100644 index 8e00c8c8..00000000 --- a/app/views/layouts/beta/_feedback.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<!--Feedback Section--> -<div id="feedback" class="govuk-width-container govuk-!-padding-top-4" role="dialog" aria-label="feedback"> - <div class="govuk-grid-row"> - <div class="govuk-grid-column-full govuk-!-padding-left-9 govuk-!-padding-right-9"> - <% - partial = case cookies[:feedback_page_useful] - when "yes" - "positive" - when "no" - "negative" - else - "default" - end - %> - <%= render "layouts/beta/feedback_#{partial}" %> - </div> - </div> -</div> -<!--End of Feedback Section--> diff --git a/app/views/layouts/beta/_feedback_default.html.erb b/app/views/layouts/beta/_feedback_default.html.erb deleted file mode 100644 index 324f08c9..00000000 --- a/app/views/layouts/beta/_feedback_default.html.erb +++ /dev/null @@ -1,42 +0,0 @@ -<div class="gem-c-feedback" data-module="feedback"> - <div class="gem-c-feedback__prompt gem-c-feedback__js-show js-prompt" tabindex="-1"> - <div class="gem-c-feedback__prompt-questions js-prompt-questions"> - <h2 class="govuk-heading-s gem-c-feedback__prompt-question">Is this page useful?</h2> - - <ul class="gem-c-feedback__option-list"> - <li class="gem-c-feedback__option-list-item"> - <%= button_to( - feedbacks_path, - params: { 'feedback[page_useful]' => 'yes' }, - class: "govuk-button gem-c-feedback__prompt-link", - data: { - track_category: "yesNoFeedbackForm", - track_action: "ffYesClick", - turbo: false - } - ) do %> - Yes <span class="govuk-visually-hidden">this page is useful</span> - <% end %> - </li> - <li class="gem-c-feedback__option-list-item"> - <%= button_to( - feedbacks_path, - params: { 'feedback[page_useful]' => 'no' }, - class: "govuk-button gem-c-feedback__prompt-link", - data: { - track_category: "yesNoFeedbackForm", - track_action: "ffNoClick", - turbo: false - } - ) do %> - No <span class="govuk-visually-hidden">this page is not useful</span> - <% end %> - </li> - </ul> - </div> - - <div class="gem-c-feedback__prompt-questions gem-c-feedback__prompt-questions--something-is-wrong js-prompt-questions"> - <%= link_to_feedback class: "govuk-button gem-c-feedback__prompt-link", target: "_blank" %> - </div> - </div> -</div> diff --git a/app/views/layouts/beta/_feedback_negative.html.erb b/app/views/layouts/beta/_feedback_negative.html.erb deleted file mode 100644 index 86b32406..00000000 --- a/app/views/layouts/beta/_feedback_negative.html.erb +++ /dev/null @@ -1,24 +0,0 @@ -<hr> -<div class="govuk-grid-row govuk-!-margin-top-4" tabindex="-1"> - <div class="govuk-grid-column-three-quarters"> - <h2 class="govuk-heading-m"> - Help us improve Help for early years providers - </h2> - <p class="govuk-body"> - We're sorry you didn't find this page useful. Please tell us why, so we can improve the site for everyone. - Our feedback form will take around 2 minutes to complete. - </p> - - <%= link_to_feedback target: "_blank" %> - </div> - - <div class="govuk-grid-column-one-quarter"> - <%= button_to( - "Close", - feedbacks_path, - params: { 'feedback[page_useful]' => 'reset' }, - class: "govuk-button govuk-button--secondary" - ) %> - </div> -</div> - diff --git a/app/views/layouts/beta/_feedback_positive.html.erb b/app/views/layouts/beta/_feedback_positive.html.erb deleted file mode 100644 index 33c51bdf..00000000 --- a/app/views/layouts/beta/_feedback_positive.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<div class="gem-c-feedback" data-module="feedback"> - <div class="gem-c-feedback__prompt govuk-!-padding-5"> - Thank you for your feedback - </div> -</div> diff --git a/app/views/layouts/beta/_footer_content.html.erb b/app/views/layouts/beta/_footer_content.html.erb deleted file mode 100644 index e0cc4a87..00000000 --- a/app/views/layouts/beta/_footer_content.html.erb +++ /dev/null @@ -1,44 +0,0 @@ -<footer class="govuk-footer " role="contentinfo"> - <div class="govuk-width-container "> - <div class="govuk-footer__meta"> - <div class="govuk-footer__meta-item govuk-footer__meta-item--grow"> - <h2 class="govuk-visually-hidden">Support links</h2> - - <ul class="govuk-footer__inline-list"> - <li class="govuk-footer__inline-list-item"> - <a class="govuk-footer__link" href="/accessibility-statement"> - Accessibility - </a> - </li> - - <li class="govuk-footer__inline-list-item"> - <a class="govuk-footer__link" href="/settings/cookie-policy"> - Cookies - </a> - </li> - - <li class="govuk-footer__inline-list-item"> - <%= link_to "Contact us", contact_us_path, class: "govuk-footer__link" %> - </li> - - <li class="govuk-footer__inline-list-item"> - <a class="govuk-footer__link" href="/disclaimer"> - Disclaimer - </a> - </li> - </ul> - - <svg aria-hidden="true" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 483.2 195.7" height="17" width="41"> - <path fill="currentColor" d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"></path> - </svg> - <span class="govuk-footer__licence-description"> - All content is available under the - <a class="govuk-footer__link" href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" rel="license">Open Government Licence v3.0</a>, except where otherwise stated - </span> - </div> - <div class="govuk-footer__meta-item"> - <a class="govuk-footer__link govuk-footer__copyright-logo" href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/">© Crown copyright</a> - </div> - </div> - </div> -</footer> diff --git a/app/views/layouts/beta/_mobile_menu.html.erb b/app/views/layouts/beta/_mobile_menu.html.erb deleted file mode 100644 index 526b16a0..00000000 --- a/app/views/layouts/beta/_mobile_menu.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<nav class="app-subnav--mobile app-mobile-nav js-app-mobile-nav" id="mobile-menu-nav" title="Mobile menu"> - <ul class="app-mobile-nav__list" aria-label="Navigation menu"> - <% ContentPage.top_level.published.order_by_position.each do |top_level_page| %> - <li> - <div class="learning-section-mobile-nav app-mobile-nav-subnav-toggler"> - <%= link_to(raw('<p class="app-subnav__theme ">' + top_level_page.title + '</p>'), path_for_this_page(top_level_page), class: "govuk-link govuk-link--no-visited-state app-mobile-nav-subnav-toggler__link js-mobile-nav-subnav-toggler") %> - </div> - <ul class="app-mobile-nav__list app-mobile-subnav-section app-mobile-nav__subnav <%= is_mobile_menu_section_current?(top_level_page) ? 'app-mobile-nav__subnav--active' : '' %>"> - <li class="app-mobile-nav__subnav-item <%= is_current?(top_level_page) ? 'app-mobile-nav__subnav-item--current' : '' %>"> - <%= link_to('Overview', path_for_this_page(top_level_page), aria: {label: "#{top_level_page.title} Overview"}, class: "govuk-link govuk-link--no-visited-state app-mobile-nav__link") %> - </li> - <% top_level_page.children.published.order_by_position.each do |child| %> - <li class="app-mobile-nav__subnav-item <%= is_current?(child) ? 'app-mobile-nav__subnav-item--current' : '' %>"> - <%= link_to(child.title, path_for_this_page(child), class: "govuk-link govuk-link--no-visited-state app-mobile-nav__link") %> - </li> - <% end %> - </ul> - </li> - <% end %> - </ul> -</nav> diff --git a/app/views/layouts/beta/_notice.html.haml b/app/views/layouts/beta/_notice.html.haml deleted file mode 100644 index a670fb83..00000000 --- a/app/views/layouts/beta/_notice.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -- if notice - .govuk-success-summary.banner-with-tick{aria: {labelledby: "success-message"}, data: {qa: "success-message"}, tabindex: "-1", role: "alert"} - .govuk-success-summary__title - %h2.govuk-heading-m#success-message - = notice.html_safe \ No newline at end of file diff --git a/app/views/layouts/beta/_phase_banner.html.erb b/app/views/layouts/beta/_phase_banner.html.erb deleted file mode 100644 index 262bf612..00000000 --- a/app/views/layouts/beta/_phase_banner.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<aside class='govuk-width-container', title='Beta Banner'> - <%= govuk_phase_banner(tag: { text: 'Beta' }, classes: 'noprint') do %> - <%= t('phase_banner_html', feedback_link: govuk_link_to('feedback', Rails.configuration.feedback_url, target: '_blank', rel: 'noopener noreferrer')) %> - <% end %> -</aside> diff --git a/app/views/layouts/beta/_show_links_to_children_of_page_with_title.html.erb b/app/views/layouts/beta/_show_links_to_children_of_page_with_title.html.erb deleted file mode 100644 index 3863fed5..00000000 --- a/app/views/layouts/beta/_show_links_to_children_of_page_with_title.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<div> - <% @featured_pages.each do |featured_page| %> - <h2 id="<%= featured_page.slug %>" class="govuk-heading-l eyfs-top-nav-anchors"><%= featured_page.title %></h2> - <% if featured_page.title != "Safeguarding and welfare" %> - <p class="govuk-body"><a class="govuk-link" href="<%= path_for_this_page(featured_page) %>">Overview</a></p> - <% end %> - - <% (featured_page&.children.published.order_by_position || []).each do |child| %> - <p class="govuk-body"><a class="govuk-link" href="<%= path_for_this_page(child) %>"><%= child.title %></a></p> - <% end %> - <% end %> -</div> diff --git a/app/views/layouts/beta/_top_navigation_menu.html.erb b/app/views/layouts/beta/_top_navigation_menu.html.erb deleted file mode 100644 index 6e3b2903..00000000 --- a/app/views/layouts/beta/_top_navigation_menu.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<nav class="eyfs-top-nav--with-background-and-border"> - <div class="govuk-width-container eyfs-top-nav-inner-div"> - <ul class="eyfs-top-nav-group"> - <li><a class="eyfs-top-nav__link govuk-link govuk-link--no-visited-state active" href="#">Home</a><li> - <li><a class="eyfs-top-nav__link govuk-link govuk-link--no-visited-state" href="#areas-of-learning" >Areas of learning</a><li> - <li><a class="eyfs-top-nav__link govuk-link govuk-link--no-visited-state" href="#get-support-and-guidance" >Get support</a><li> - <% @featured_pages.each do |featured_page| %> - <li><a class="eyfs-top-nav__link govuk-link govuk-link--no-visited-state" href="#<%=featured_page.slug%>" ><%= ContentController::FEATURED_PAGE_HASH[featured_page.title] %></a><li> - <% end %> - </ul> - </div> -</nav> \ No newline at end of file diff --git a/app/views/layouts/beta/application.html.erb b/app/views/layouts/beta/application.html.erb deleted file mode 100644 index dd6d9fec..00000000 --- a/app/views/layouts/beta/application.html.erb +++ /dev/null @@ -1,147 +0,0 @@ -<!DOCTYPE html> -<html lang="en" class="govuk-template"> - <head> - <meta name="Cache-Control" content="max-age=3500, public"> - <title><%= @page.title %> - Help for early years providers - GOV.UK</title> - <%= render 'layouts/beta/analytics_header' if cookies[:track_analytics] == 'Yes' %> - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - <%= canonical_tag %> - <%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %> - <%= tag :meta, property: 'og:image', content: asset_path('images/govuk-opengraph-image.png') %> - <%= tag :meta, name: 'theme-color', content: '#0b0c0c' %> - <%= tag(:meta, name: :description, content: @page.description) if @page.description.present? %> - <%= favicon_link_tag asset_path('images/favicon.ico') %> - <%= favicon_link_tag asset_path('images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %> - <%= stylesheet_link_tag 'application', 'data-turbo-track': 'reload', media: 'all' %> - <%= javascript_include_tag 'application', 'data-turbo-track': 'reload', defer: true %> - </head> - - <body class="govuk-template__body "> - <script> - document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled'); - </script> - <%= render 'layouts/beta/analytics_body' if cookies[:track_analytics] == 'Yes' %> - - <% if !cookies[:track_analytics] %> - <%= render 'layouts/beta/cookies_notice' %> - <% end %> - - <header class="govuk-header app-header" role="banner" data-module="govuk-header"> - <a href="#main-content" class="govuk-skip-link">Skip to main content</a> - <div class="govuk-header__container govuk-width-container"> - <div class="govuk-header__logo govuk-!-padding-right-0"> - <a href="https://www.gov.uk/" class="govuk-header__link govuk-header__link--homepage"> - <span class="govuk-header__logotype"> - <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 132 97" height="30" width="36"> - <path fill="currentColor" fill-rule="evenodd" d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path> - <image src="<%= asset_path('images/govuk-logotype-crown.png') %>" xlink:href="" class="govuk-header__logotype-crown-fallback-image" width="36" height="32"></image> - </svg> - <span class="govuk-header__logotype-text"> - GOV.UK - </span> - </span> - </a> - <% if @page.navigation %> - <div class="app-header-mobile-nav-toggler-wrapper"> - <button aria-controls="mobile-menu-nav" id="app-mobile-nav-toggler" class="govuk-js-header-toggle govuk-button eyfs-menu-button--border app-header-mobile-nav-toggler js-app-mobile-nav-toggler" aria-expanded="false"> - Menu - </button> - </div> - <% end %> - </div> - <div class="govuk-header__content"> - <a href="/" class="govuk-header__link govuk-header__link--service-name"> - Help for early years providers - </a> - </div> - </div> - </header> - - <%= render 'layouts/beta/mobile_menu' %> - - <%= render 'layouts/beta/phase_banner' %> - - <nav class="govuk-width-container" role="navigation" aria-label="Breadcrumbs"> - <%= render 'layouts/beta/breadcrumbs' %> - </nav> - - <div class="govuk-width-container"> - <main class="govuk-main-wrapper" role="main"> - <div class="govuk-grid-row"> - <% if @page.navigation %> - <div class="govuk-grid-column-one-third desktop-menu"> - <%= render 'layouts/beta/desktop_menu' %> - </div> - <% end %> - - <div class="govuk-grid-column-two-thirds"> - <div id="main-content" class="app-content gem-c-govspeak"> - <%= render 'layouts/beta/notice' %> - <%= yield %> - <% if @page.navigation %> - <nav class="gem-c-pagination" role="navigation" aria-label="Pagination"> - <ul class="gem-c-pagination__list"> - <% if @page.previous_page %> - <li class="gem-c-pagination__item gem-c-pagination__item--previous"> - <a href="<%= @page.previous_page.full_path %>" class="gem-c-pagination__link"> - <span class="gem-c-pagination__link-title"> - <svg class="gem-c-pagination__link-icon" xmlns="http://www.w3.org/2000/svg" height="13" width="17" viewBox="0 0 17 13"> - <path d="m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z"></path> - </svg> - <span class="gem-c-pagination__link-text"> - Previous page - </span> - </span> - <span class="gem-c-pagination__link-divider visually-hidden">:</span> - <span class="gem-c-pagination__link-label"><%= @page.previous_page.title %></span> - </a> - </li> - <% end %> - <% if @page.next_page %> - <li class="gem-c-pagination__item gem-c-pagination__item--next"> - <a href="<%= @page.next_page.full_path %>" class="gem-c-pagination__link"> - <span class="gem-c-pagination__link-title"> - <svg class="gem-c-pagination__link-icon" xmlns="http://www.w3.org/2000/svg" height="13" width="17" viewBox="0 0 17 13"> - <path d="m10.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z"></path> - </svg> - <span class="gem-c-pagination__link-text"> - Next page - </span> - </span> - <span class="gem-c-pagination__link-divider visually-hidden">:</span> - <span class="gem-c-pagination__link-label"><%= @page.next_page.title %></span> - </a> - </li> - <% end %> - </ul> - </nav> - <% end %> - </div> - - <% if @page.helpful_tools %> - <div class="eyfs-helpful-tools"> - <div class="app-back-to-top govuk-!-margin-bottom-7" data-module="app-back-to-top"> - <a class="govuk-link govuk-link--no-visited-state app-back-to-top__link" href="#top"> - <svg role="presentation" focusable="false" class="app-back-to-top__icon" xmlns="http://www.w3.org/2000/svg" width="13" height="17" viewBox="0 0 13 17"> - <path fill="currentColor" d="M6.5 0L0 6.5 1.4 8l4-4v12.7h2V4l4.3 4L13 6.4z"></path> - </svg>Back to top - </a> - </div> - <div class="gem-c-print-link govuk-!-margin-top-3 govuk-!-margin-bottom-6"> - <button class="govuk-link gem-c-print-link__button" onclick="window.print()" data-module="print-link" >Print this page</button> - </div> - </div> - <% end %> - </div> - </div> - </main> - </div> - <%= render 'layouts/beta/feedback' %> - <%= render 'layouts/beta/footer_content' %> - </body> -</html> diff --git a/app/views/layouts/beta/cms.html.erb b/app/views/layouts/beta/cms.html.erb deleted file mode 100644 index 0a724872..00000000 --- a/app/views/layouts/beta/cms.html.erb +++ /dev/null @@ -1,71 +0,0 @@ -<!DOCTYPE html> -<html lang="en" class="govuk-template "> - <head> - <title>Editing Content - Help for early years providers - GOV.UK</title> - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - <%= canonical_tag %> - <%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %> - <%= tag :meta, property: 'og:image', content: asset_path('images/govuk-opengraph-image.png') %> - <%= tag :meta, name: 'theme-color', content: '#0b0c0c' %> - <%= favicon_link_tag asset_path('images/favicon.ico') %> - <%= favicon_link_tag asset_path('images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %> - <%= stylesheet_link_tag 'application', 'data-turbo-track': 'reload', media: 'all' %> - <%= javascript_include_tag 'application', 'data-turbo-track': 'reload', defer: true %> - </head> - - <body class="govuk-template__body "> - <script> - document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled'); - </script> - - <header class="govuk-header app-header" role="banner" data-module="govuk-header"> - <a href="#main-content" class="govuk-skip-link">Skip to main content</a> - <div class="govuk-header__container govuk-width-container"> - <div class="govuk-header__logo"> - <%= link_to "https://www.gov.uk/", class: "govuk-header__link govuk-header__link--homepage" do %> - <span class="govuk-header__logotype"> - <svg role="presentation" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 132 97" height="32" width="36"> - <path fill="currentColor" fill-rule="evenodd" d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path> - <image src="<%= asset_path('images/govuk-logotype-crown.png') %>" class="govuk-header__logotype-crown-fallback-image"></image> - </svg> - <span class="govuk-header__logotype-text"> - GOV.UK - </span> - </span> - <% end %> - </div> - <div class="govuk-header__content"> - <%= link_to "Edit content for: Help for early years providers", "/", class: "govuk-header__link govuk-header__link--service-name" %> - <button type="button" class="govuk-header__menu-button govuk-js-header-toggle" aria-controls="navigation" aria-label="Show or hide navigation menu">Menu</button> - <nav> - <ul id="navigation" class="govuk-header__navigation" aria-label="Top Level Navigation"> - <%= nav_link_to(title: "Admin", path: admin_users_path) if current_user.admin? %> - <%= nav_link_to(title: "Blocks", path: admin_content_blocks_path) if current_user.admin? %> - <%= nav_link_to(title: "Pages", path: admin_content_pages_path) %> - <li class="govuk-header__navigation-item"> - <%= link_to "See the site", "/", class: "govuk-header__link", target: :_blank %> - </li> - <li class="govuk-header__navigation-item"> - <%= link_to('Logout', destroy_user_session_path, data: { turbo_method: :delete }, class: "govuk-header__link") %> - </li> - </ul> - </nav> - </div> - </div> - </header> - - <div class="govuk-width-container"> - <main class="govuk-main-wrapper" role="main" id="main-content" > - <%= render 'layouts/beta/notice' %> - <%= yield %> - </main> - </div> - - <%= render 'layouts/beta/footer_content' %> - </body> -</html> diff --git a/app/views/layouts/beta/errors.html.erb b/app/views/layouts/beta/errors.html.erb deleted file mode 100644 index 11dc22c7..00000000 --- a/app/views/layouts/beta/errors.html.erb +++ /dev/null @@ -1,64 +0,0 @@ -<!DOCTYPE html> -<html lang="en" class="govuk-template "> - <head> - <title>Help for early years providers</title> - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - <%= canonical_tag %> - <%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %> - <%= tag :meta, property: 'og:image', content: asset_path('images/govuk-opengraph-image.png') %> - <%= tag :meta, name: 'theme-color', content: '#0b0c0c' %> - <%= favicon_link_tag asset_path('images/favicon.ico') %> - <%= favicon_link_tag asset_path('images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %> - <%= stylesheet_link_tag 'application', 'data-turbo-track': 'reload', media: 'all' %> - <%= javascript_include_tag 'application', 'data-turbo-track': 'reload', defer: true %> - - </head> - - <body class="govuk-template__body "> - <script> - document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled'); - </script> - - - <header class="govuk-header app-header" role="banner" data-module="govuk-header"> - <a href="#main-content" class="govuk-skip-link">Skip to main content</a> - <div class="govuk-header__container govuk-width-container"> - <div class="govuk-header__logo govuk-!-padding-right-0"> - <a href="https://www.gov.uk/" class="govuk-header__link govuk-header__link--homepage"> - <span class="govuk-header__logotype"> - <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 132 97" height="30" width="36"> - <path fill="currentColor" fill-rule="evenodd" d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path> - <image src="<%= asset_path('images/govuk-logotype-crown.png') %>" xlink:href="" class="govuk-header__logotype-crown-fallback-image" width="36" height="32"></image> - </svg> - <span class="govuk-header__logotype-text"> - GOV.UK - </span> - </span> - </a> - </div> - <div class="govuk-header__content"> - <a href="/" class="govuk-header__link govuk-header__link--service-name"> - Help for early years providers - </a> - </div> - </div> - </header> - - <%= render 'layouts/beta/phase_banner' %> - - <div class="govuk-width-container"> - <main class="govuk-main-wrapper" role="main" id="main-content"> - <%= render 'layouts/beta/notice' %> - <%= yield %> - </main> - </div> - - <%= render 'layouts/beta/feedback' %> - <%= render 'layouts/beta/footer_content' %> - </body> -</html> diff --git a/app/views/layouts/beta/landing_page_layout.html.erb b/app/views/layouts/beta/landing_page_layout.html.erb deleted file mode 100644 index a2a862cd..00000000 --- a/app/views/layouts/beta/landing_page_layout.html.erb +++ /dev/null @@ -1,83 +0,0 @@ -<!DOCTYPE html> -<html lang="en" class="govuk-template"> - <head> - <meta charset="utf-8"> - <title>Help for early years providers - Department for Education</title> - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - <%= canonical_tag %> - <%= render 'layouts/beta/analytics_header' if cookies[:track_analytics] == 'Yes' %> - <%= render 'layouts/beta/hotjar' if cookies[:track_analytics] == 'Yes' %> - <meta Cache-Control="max-age=3500, public"> - <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> - <meta name="theme-color" content="#0b0c0c"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - - <%= favicon_link_tag asset_path('images/favicon.ico') %> - <%= favicon_link_tag asset_path('images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %> - - <%= stylesheet_link_tag 'application', 'data-turbo-track': 'reload', media: 'all' %> - <%= javascript_include_tag 'application', 'data-turbo-track': 'reload', defer: true %> - - <meta property="og:image" content="/govuk/assets/images/govuk-opengraph-image.png"> - </head> - <body class="govuk-template__body"> - - <script>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script> - <%= render 'layouts/beta/analytics_body' if cookies[:track_analytics] == 'Yes' %> - - <% if !cookies[:track_analytics] %> - <%= render 'layouts/beta/cookies_notice' %> - <% end %> - - <header class="govuk-header app-header" role="banner" data-module="govuk-header"> - <a href="#main-content" class="govuk-skip-link">Skip to main content</a> - <div class="govuk-header__container govuk-width-container"> - <div class="govuk-header__logo govuk-!-padding-right-0"> - <a href="https://www.gov.uk/" class="govuk-header__link govuk-header__link--homepage"> - <span class="govuk-header__logotype"> - <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 132 97" height="30" width="36"> - <path fill="currentColor" fill-rule="evenodd" d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path> - <image src="<%= asset_path('images/govuk-logotype-crown.png') %>" xlink:href="" class="govuk-header__logotype-crown-fallback-image" width="36" height="32"></image> - </svg> - <span class="govuk-header__logotype-text"> - GOV.UK - </span> - </span> - </a> - </div> - <div class="govuk-header__content"> - <a href="/" class="govuk-header__link govuk-header__link--service-name"> - Help for early years providers - </a> - </div> - </div> - </header> - - <%= render 'layouts/beta/phase_banner' %> - - <aside title="Get alerts"> - <div class="govuk-width-container govuk-!-margin-top-4"> - <%= render 'layouts/beta/notice' %> - - <div class="eyfs-signup-link--with-background-and-border"> - <svg class="eyfs-signup-link__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> - <path d="M15.137 3.945c-.644-.374-1.042-1.07-1.041-1.82v-.003c.001-1.172-.938-2.122-2.096-2.122s-2.097.95-2.097 2.122v.003c.001.751-.396 1.446-1.041 1.82-4.667 2.712-1.985 11.715-6.862 13.306v1.749h20v-1.749c-4.877-1.591-2.195-10.594-6.863-13.306zm-3.137-2.945c.552 0 1 .449 1 1 0 .552-.448 1-1 1s-1-.448-1-1c0-.551.448-1 1-1zm3 20c0 1.598-1.392 3-2.971 3s-3.029-1.402-3.029-3h6z"/> - </svg> - <h1 class="govuk-heading-s eyfs-signup-link__title">Get alerts for new EYFS resources</h1> - <%= govuk_link_to 'Sign up to get emails when we add new early years foundation stage resources to this website', Rails.configuration.signup_url, target: '_blank', rel: 'noopener noreferrer', class: 'govuk-link eyfs-signup-link__link' %> - </div> - </div> - </aside> - - <main class="eyfs-wrapper" role="main"> - <%= yield %> - </main> - <%= render 'layouts/beta/feedback' %> - <%= render 'layouts/beta/footer_content' %> - </body> -</html> diff --git a/app/views/layouts/beta/mailer.html.erb b/app/views/layouts/beta/mailer.html.erb deleted file mode 100644 index cbd34d2e..00000000 --- a/app/views/layouts/beta/mailer.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <style> - /* Email styles need to be inline */ - </style> - </head> - - <body> - <%= yield %> - </body> -</html> diff --git a/app/views/layouts/beta/mailer.text.erb b/app/views/layouts/beta/mailer.text.erb deleted file mode 100644 index 37f0bddb..00000000 --- a/app/views/layouts/beta/mailer.text.erb +++ /dev/null @@ -1 +0,0 @@ -<%= yield %> diff --git a/app/views/layouts/xapplication.html.erb b/app/views/layouts/xapplication.html.erb deleted file mode 100644 index c197341c..00000000 --- a/app/views/layouts/xapplication.html.erb +++ /dev/null @@ -1,44 +0,0 @@ -<!DOCTYPE html> -<html lang="en" class="govuk-template"> - <head> - <title><%= [yield(:page_title).presence, t('service.name')].compact.join(' - ') %></title> - - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - - <%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %> - <%= tag :meta, property: 'og:image', content: asset_path('images/govuk-opengraph-image.png') %> - <%= tag :meta, name: 'theme-color', content: '#0b0c0c' %> - <%= favicon_link_tag asset_path('images/favicon.ico') %> - <%= favicon_link_tag asset_path('images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-152x152.png'), rel: 'apple-touch-icon', type: 'image/png', size: '152x152' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-167x167.png'), rel: 'apple-touch-icon', type: 'image/png', size: '167x167' %> - <%= favicon_link_tag asset_path('images/govuk-apple-touch-icon-180x180.png'), rel: 'apple-touch-icon', type: 'image/png', size: '180x180' %> - - <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> - <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> - </head> - - <body class="govuk-template__body"> - <script> - document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled'); - </script> - - <%= govuk_skip_link %> - - <%= govuk_header(service_name: "GOV.UK Rails Boilerplate") do |header| %> - <%= header.with_navigation_item(text: "Navigation item 1", href: "#", active: true) %> - <%= header.with_navigation_item(text: "Navigation item 2", href: "#") %> - <%= header.with_navigation_item(text: "Navigation item 3", href: "#") %> - <% end %> - - <div class="govuk-width-container"> - <main class="govuk-main-wrapper" id="main-content" role="main"> - <%= yield %> - </main> - </div> - - <%= govuk_footer %> - </body> -</html> diff --git a/app/views/pages/show.html.slim b/app/views/pages/show.html.slim index 63d09be8..c46f0667 100644 --- a/app/views/pages/show.html.slim +++ b/app/views/pages/show.html.slim @@ -6,12 +6,12 @@ .govuk-grid-row class='govuk-!-margin-top-4 govuk-!-margin-bottom-5' .govuk-grid-column-full - h2 =@page.title - p.govuk-body =@page.body + h2= @page.title + p.govuk-body= @page.body .govuk-grid-row = render partial: 'shared/card', collection: @page.cards = render 'shared/ctas' -= render 'shared/other_resources' \ No newline at end of file += render 'shared/other_resources' diff --git a/app/views/static_pages/accessibility_statement.html.erb b/app/views/static_pages/accessibility_statement.html.erb deleted file mode 100644 index 2e38d825..00000000 --- a/app/views/static_pages/accessibility_statement.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%== insert_block('accessibility') %> diff --git a/app/views/static_pages/child_development_training.html.erb b/app/views/static_pages/child_development_training.html.erb deleted file mode 100644 index c1869f3e..00000000 --- a/app/views/static_pages/child_development_training.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<div class="govuk-grid-row"> - <div class='govuk-grid-column-full'> - <%= insert_block('child_development_training') %> - </div> -</div> - diff --git a/app/views/static_pages/contact_us.html.erb b/app/views/static_pages/contact_us.html.erb deleted file mode 100644 index 8032db15..00000000 --- a/app/views/static_pages/contact_us.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%== insert_block('contact_us') %> \ No newline at end of file diff --git a/app/views/static_pages/disclaimer.html.erb b/app/views/static_pages/disclaimer.html.erb deleted file mode 100644 index 3e6f2e19..00000000 --- a/app/views/static_pages/disclaimer.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%== insert_block('disclaimer') %> diff --git a/app/views/web/pages/default.html.slim b/app/views/web/pages/default.html.slim index 3e021418..ea52574c 100644 --- a/app/views/web/pages/default.html.slim +++ b/app/views/web/pages/default.html.slim @@ -5,7 +5,7 @@ = render partial: 'hero', locals: { hero: page.hero } - if page.introduction.present? - = translate_markdown(page.introduction) + = m(page.introduction) - if page.content_list.present? .govuk-grid-row @@ -14,10 +14,10 @@ p#contents-list-heading class='govuk-body govuk-!-margin-bottom-1 govuk-!-font-weight-bold' | Contents on this page ul.contents-list__list - = translate_markdown(page.content_list) + = m(page.content_list) .govuk-grid-row class='govuk-!-margin-top-4 govuk-!-margin-bottom-5' .govuk-grid-column-full - p.govuk-body = translate_markdown(page.body) + p.govuk-body = m(page.body) -= render 'shared/ctas' \ No newline at end of file += render 'shared/ctas' diff --git a/app/views/web/pages/side_nav.slim b/app/views/web/pages/side_nav.slim index 204d5f50..ffbee242 100644 --- a/app/views/web/pages/side_nav.slim +++ b/app/views/web/pages/side_nav.slim @@ -20,15 +20,15 @@ .govuk-grid-column-three-quarters - if page.introduction.present? - = translate_markdown(page.introduction) + = m(page.introduction) - if page.content_list.present? .contents-on-page p#contents-list-heading class='govuk-body govuk-!-margin-bottom-1 govuk-!-font-weight-bold' | Contents on this page ul.contents-list__list - = translate_markdown(page.content_list) + = m(page.content_list) - p.govuk-body = translate_markdown(page.body) + p.govuk-body = m(page.body) = render 'shared/ctas' diff --git a/config/application.rb b/config/application.rb index f2208b57..db82df56 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,21 +1,21 @@ -require_relative "boot" +require_relative 'boot' -require "rails" +require 'rails' # Pick the frameworks you want: -require "active_model/railtie" -require "active_job/railtie" -require "active_record/railtie" +require 'active_model/railtie' +require 'active_job/railtie' +require 'active_record/railtie' # require "active_storage/engine" -require "action_controller/railtie" -require "action_mailer/railtie" +require 'action_controller/railtie' +require 'action_mailer/railtie' # require "action_mailbox/engine" # require "action_text/engine" -require "action_view/railtie" -require "action_cable/engine" +require 'action_view/railtie' +require 'action_cable/engine' # require "rails/test_unit/railtie" -require "govuk/components" +require 'govuk/components' -require_relative "../lib/rack/reject_trace" +require_relative '../lib/rack/reject_trace' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. @@ -30,18 +30,18 @@ class Application < Rails::Application # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. - #config.assets.paths << Rails.root.join('node_modules/govuk-frontend/govuk/assets').to_s + # config.assets.paths << Rails.root.join('node_modules/govuk-frontend/govuk/assets').to_s config.exceptions_app = routes # disable client-side XSS Auditors, as they have been removed from most # modern browsers because they can cause additional vulnerabilities # (see https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html#x-xss-protection-header) - config.action_dispatch.default_headers['X-XSS-Protection'] = "0" + config.action_dispatch.default_headers['X-XSS-Protection'] = '0' config.middleware.use Rack::RejectTrace config.middleware.use Rack::Deflater - config.i18n.load_path += Dir[Rails.root.join('config', 'locales', 'content', '*.{rb,yml}').to_s] + config.i18n.load_path += Dir[Rails.root.join('config/locales/content/*.{rb,yml}').to_s] config.feedback_url = ENV.fetch('FEEDBACK_URL', config_for(:configuration)['feedback_url'] || '#FEEDBACK_env_var_missing') config.signup_url = ENV.fetch('SIGNUP_URL', config_for(:configuration)['signup_url'] || '#SIGNUP_env_var_missing') @@ -83,15 +83,5 @@ def dev? def preview? Dry::Types['params.bool'][ENV.fetch('CONTENTFUL_PREVIEW', false)] end - - # - # Feature flags - # - - # @return [Boolean] - def new_design? - ENV['NEW_DESIGN'].present? - end - alias_method :cms?, :new_design? end -end \ No newline at end of file +end diff --git a/config/boot.rb b/config/boot.rb index 988a5ddc..b9e460ce 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,4 @@ -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -require "bundler/setup" # Set up gems listed in the Gemfile. -require "bootsnap/setup" # Speed up boot time by caching expensive operations. +require 'bundler/setup' # Set up gems listed in the Gemfile. +require 'bootsnap/setup' # Speed up boot time by caching expensive operations. diff --git a/config/environment.rb b/config/environment.rb index cac53157..426333bb 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require_relative "application" +require_relative 'application' # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 5cb92aae..ced56445 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,4 +1,4 @@ -require "active_support/core_ext/integer/time" +require 'active_support/core_ext/integer/time' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -19,13 +19,13 @@ # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. - if Rails.root.join("tmp/caching-dev.txt").exist? + if Rails.root.join('tmp/caching-dev.txt').exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true config.cache_store = :memory_store config.public_file_server.headers = { - "Cache-Control" => "public, max-age=#{2.days.to_i}", + 'Cache-Control' => "public, max-age=#{2.days.to_i}", } else config.action_controller.perform_caching = false diff --git a/config/environments/production.rb b/config/environments/production.rb index 16c16924..5842e7e7 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,4 +1,4 @@ -require "active_support/core_ext/integer/time" +require 'active_support/core_ext/integer/time' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -18,11 +18,11 @@ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). - config.require_master_key = true unless ENV["IGNORE_SECRETS_FOR_BUILD"] + config.require_master_key = true unless ENV['IGNORE_SECRETS_FOR_BUILD'] # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass @@ -79,7 +79,7 @@ # require "syslog/logger" # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") - if ENV["RAILS_LOG_TO_STDOUT"].present? + if ENV['RAILS_LOG_TO_STDOUT'].present? logger = ActiveSupport::Logger.new($stdout) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) diff --git a/config/environments/test.rb b/config/environments/test.rb index abe1e663..7b257a34 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,4 @@ -require "active_support/core_ext/integer/time" +require 'active_support/core_ext/integer/time' # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that @@ -14,12 +14,12 @@ # Eager loading loads your whole application. When running a single test locally, # this probably isn't necessary. It's a good idea to do in a continuous integration # system, or in some way before deploying your code. - config.eager_load = ENV["CI"].present? + config.eager_load = ENV['CI'].present? # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - "Cache-Control" => "public, max-age=#{1.hour.to_i}", + 'Cache-Control' => "public, max-age=#{1.hour.to_i}", } # Show full error reports and disable caching. diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 2eeef966..fe48fc34 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,7 +1,7 @@ # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = "1.0" +Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path diff --git a/config/initializers/canonical_rails.rb b/config/initializers/canonical_rails.rb index 92ab6b81..3b72eb24 100644 --- a/config/initializers/canonical_rails.rb +++ b/config/initializers/canonical_rails.rb @@ -3,11 +3,11 @@ CanonicalRails.setup do |config| # Force the protocol. If you do not specify, the protocol will be based on the incoming request's protocol. - config.protocol = "https://" + config.protocol = 'https://' # This is the main host, not just the TLD, omit slashes and protocol. If you have more than one, pick the one you want to rank in search results. - config.host = "help-for-early-years-providers.education.gov.uk" + config.host = 'help-for-early-years-providers.education.gov.uk' # http://en.wikipedia.org/wiki/URL_normalization # Trailing slash represents semantics of a directory, ie a collection view - implying an :index get route; diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 4a2b483d..abe4d7a8 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -12,12 +12,12 @@ # - https://cspvalidator.org GOVUK_DOMAINS = [ - "*.education.gov.uk", + '*.education.gov.uk', ].uniq.freeze S3_DOMAINS = [ - "*.s3.eu-west-1.amazonaws.com", - "*.s3.eu-west-2.amazonaws.com", + '*.s3.eu-west-1.amazonaws.com', + '*.s3.eu-west-2.amazonaws.com', ].uniq.freeze GOOGLE_ANALYTICS_DOMAINS = %w[*.google-analytics.com @@ -44,8 +44,8 @@ policy.font_src :self, :https, *GOVUK_DOMAINS, *GOOGLE_STATIC_DOMAINS, :data policy.frame_src :self, *GOOGLE_ANALYTICS_DOMAINS, *OPTIMIZE_DOMAINS policy.img_src :self, - "images.ctfassets.net", - "placehold.co", + 'images.ctfassets.net', + 'placehold.co', *GOVUK_DOMAINS, *S3_DOMAINS, *GOOGLE_ANALYTICS_DOMAINS, # Tracking pixels @@ -58,9 +58,9 @@ *GOOGLE_STATIC_DOMAINS, *OPTIMIZE_DOMAINS, # Allow YouTube Embeds (Govspeak turns YouTube links into embeds) - "*.ytimg.com", - "www.youtube.com", - "www.youtube-nocookie.com", + '*.ytimg.com', + 'www.youtube.com', + 'www.youtube-nocookie.com', # Allow all inline scripts until we can conclusively # document all the inline scripts we use, # and there's a better way to filter out junk reports @@ -73,8 +73,8 @@ :wss, *GOVUK_DOMAINS, *GOOGLE_ANALYTICS_DOMAINS, - "http://localhost:3035", - "ws://localhost:3035" + 'http://localhost:3035', + 'ws://localhost:3035' # :nocov: else policy.connect_src :self, diff --git a/config/initializers/date_formats.rb b/config/initializers/date_formats.rb index 1b86af77..0e7d5157 100644 --- a/config/initializers/date_formats.rb +++ b/config/initializers/date_formats.rb @@ -1,4 +1,4 @@ # https://www.gov.uk/guidance/style-guide/a-to-z-of-gov-uk-style#dates -Date::DATE_FORMATS[:govuk] = "%-d %B %Y" # 2 January 1998 -Date::DATE_FORMATS[:govuk_short] = "%-d %b %Y" # 2 Jan 1998 -Date::DATE_FORMATS[:govuk_approx] = "%B %Y" # January 1998 +Date::DATE_FORMATS[:govuk] = '%-d %B %Y' # 2 January 1998 +Date::DATE_FORMATS[:govuk_short] = '%-d %b %Y' # 2 Jan 1998 +Date::DATE_FORMATS[:govuk_approx] = '%B %Y' # January 1998 diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 93d5a199..efedcc99 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -36,7 +36,7 @@ # Load and configure the ORM. Supports :active_record (default) and # :mongoid (bson_ext recommended) by default. Other ORMs may be # available as additional gems. - require "devise/orm/active_record" + require 'devise/orm/active_record' # ==> Configuration for any authentication mechanism # Configure which keys are used when authenticating a user. The default is diff --git a/config/initializers/govspeak_post_processor.rb b/config/initializers/govspeak_post_processor.rb deleted file mode 100644 index 4f210f5d..00000000 --- a/config/initializers/govspeak_post_processor.rb +++ /dev/null @@ -1,17 +0,0 @@ -Govspeak::PostProcessor.class_eval do - extension("use custom footnotes") do |document| - document.css("div.footnotes > ol").map do |el| - el.add_previous_sibling('<h2 class="govuk-heading-m">References</h2>') - el.prepend_child('<div class="govuk-visually-hidden">Reference</div>') - end - - document.css("a.footnote").map do |el| - footnote_number = el[:href].gsub(/\D/, "") - el.content = "[reference #{footnote_number}]" - end - - document.css("[role='doc-backlink']").map do |el| - el.content = "↩" - end - end -end diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb index 4f6d13eb..f8bc24e0 100644 --- a/config/initializers/i18n.rb +++ b/config/initializers/i18n.rb @@ -9,8 +9,6 @@ module I18n::Backend::Content # @return [String, nil] def lookup(locale, key, scope = [], options = {}) - return super if ENV['NEW_DESIGN'].blank? - original = super resource_name = scope ? Array(scope).push(key).join('.') : key find_resource(resource_name)&.body || original diff --git a/config/initializers/session.rb b/config/initializers/session.rb index 82d9e324..841ab7dc 100644 --- a/config/initializers/session.rb +++ b/config/initializers/session.rb @@ -1 +1 @@ -Rails.application.config.session_store :cookie_store, key: "_help_for_early_years_providers_session" +Rails.application.config.session_store :cookie_store, key: '_help_for_early_years_providers_session' diff --git a/config/initializers/time_formats.rb b/config/initializers/time_formats.rb index 5d7f8af3..a979a445 100644 --- a/config/initializers/time_formats.rb +++ b/config/initializers/time_formats.rb @@ -1 +1 @@ -Time::DATE_FORMATS[:day_month_year] = "%d-%m-%Y" # 04-11-2021 +Time::DATE_FORMATS[:day_month_year] = '%d-%m-%Y' # 04-11-2021 diff --git a/config/locales/content/blocks.yml b/config/locales/content/blocks.yml deleted file mode 100644 index 53ad905e..00000000 --- a/config/locales/content/blocks.yml +++ /dev/null @@ -1,219 +0,0 @@ -en: - content: - landing_page_introduction: - description: Landing page introduction - markdown: | - <h1 class="govuk-heading-xl govuk-!-margin-bottom-4">Help for early years providers</h1> - <p class="govuk-body-l">The Early Years Foundation Stage (EYFS) has changed. Find guidance and practical support to help you with the changes.</p> - <p class="govuk-body-l">These resources are for childminders, nursery leaders and pre-school practitioners.</p> - - <div class='govuk-grid-row'> - <div class='govuk-grid-column-two-thirds'> - <div class='light-grey-box'> - <h1 class='govuk-heading-l'>New early years child development training</h1> - <p class='govuk-body'>This new, free, online training provides an overview of child development and - practical advice for supporting children in your setting</p> - <p class='govuk-body'><a class="govuk-link" href="/child-development-training">Find out more about the training</a></p> - </div> - </div> - </div> - other_useful_resources: - description: Used on the landing page to describe Other Useful Resources - markdown: | - <h2 class="govuk-heading-l">Other useful resources</h2> - <p class="govuk-body"><a class="govuk-link" href="https://www.gov.uk/government/publications/changes-to-the-early-years-foundation-stage-eyfs-framework/changes-to-the-early-years-foundation-stage-eyfs-framework">Changes to the early years foundation stage framework</a></p> - <p class="govuk-body"><a class="govuk-link" href="https://www.gov.uk/government/publications/early-years-foundation-stage-framework--2">Statutory framework for the early years foundation stage</a></p> - <p class="govuk-body"><a class="govuk-link" href="https://www.gov.uk/government/publications/development-matters--2">Development Matters, non-statutory curriculum guidance for the early years foundation stage</a></p> - child_development_training: - description: Child development training introduction - markdown: | - <div class='govuk-grid-row light-grey-box'> - <div class='govuk-grid-column-two-thirds'> - <h1 class='govuk-heading-l'>Early years child development training</h1> - <p class='govuk-body'>This free, online training provides and overview of child development and practical advice for supporting children in your setting.</p> - </div> - <div class='govuk-grid-column-one-third'> - <img src=''> - </div> - </div> - - # About the training - Each training module covers an important area of child development and has - been written by early years experts, working with the Department for Education - and Ofsted. - - The course has 10 modules. Each module should take between 1 and 2 hours - to complete. - - You can pause and restart the training as much as you like - so you don’t - have to complete it in one sitting. - - # Why should I take this training? - - This training: - - - is free for childminders and nurseries - - combines theory and practical tips - - includes opportunities to reflect on your practice - - includes learning check questions and end of module quizzes to test your understanding - - links to additional resources - - offers the opportunity to download certificates of completion - - has been developed by expert practitioners - - <div class='light-grey-box'> - <h3 class='govuk-heading-l'>Find out more</h3> - <p class='govuk-body'>Sign up to be notified when the training launches in October.</p> - <a href='https://docs.google.com/forms/d/e/1FAIpQLSdZbPz-447CADTErT9eD1IU4yKfsEhyJy1C8U1fyFAQuEtejw/viewform' class='govuk-button'>Sign up to be notified</a> - </div> - - <div class="govuk-accordion" data-module="govuk-accordion" id="accordion-with-summary-sections"> - <div class="govuk-accordion__section"> - <div class="govuk-accordion__section-header"> - <h2 class="govuk-accordion__section-heading"> - <span class="govuk-accordion__section-button" id="accordion-with-summary-sections-heading-1"> - Module 1: Child development and the EYFS - </span> - </h2> - <div class="govuk-accordion__section-summary govuk-body" id="accordion-with-summary-sections-summary-1"> - As an early years practitioner, understanding child development and the early years foundation stage (EYFS) will enable you to meet the needs of all the children in your care. - </div> - </div> - <div id="accordion-with-summary-sections-content-1" class="govuk-accordion__section-content" aria-labelledby="accordion-with-summary-sections-heading-1"> - <div class="gem-c-govspeak"> - <p>This module will encourage you to reflect on why knowledge of child development is important, and help you to - effectively implement the EYFS. It also considers the impact of the coronavirus (COVID-19) pandemic on - children and their development.</p> - </div> - <h2>What you’ll learn </h2> - <p class="govuk_body">This module will cover:</p> - <div class="gem-c-govspeak"> - <ul> - <li>the importance of early childhood education and care, including how to implement strategies to provide a - positive approach in your setting</li> - <li>the importance of child development knowledge and the various factors that impact on children’s - development</li> - <li>how you can effectively deliver the EYFS</li> - <li>the impact of the COVID-19 pandemic on children’s development</li> - </ul> - </div> - </div> - </div> - <div class="govuk-accordion__section"> - <div class="govuk-accordion__section-header"> - <h2 class="govuk-accordion__section-heading"> - <span class="govuk-accordion__section-button" id="accordion-with-summary-sections-heading-2"> - Module 2: Brain development and how children learn - </span> - </h2> - <div class="govuk-accordion__section-summary govuk-body" id="accordion-with-summary-sections-summary-2"> - The rapid changes that happen in the brain in a child's first years lay critical foundations for later childhood and adult life. As an early years practitioner, you can play a significant role in encouraging and supporting children’s brain development. - </div> - </div> - <div id="accordion-with-summary-sections-content-2" class="govuk-accordion__section-content" aria-labelledby="accordion-with-summary-sections-heading-2"> - <div class="gem-c-govspeak"> - <p>This module will reinforce your understanding of how a child’s brain develops, and help you to consider - factors affecting children’s brain development when planning for your setting.</p> - </div> - <h2>What you’ll learn </h2> - <p class="govuk_body">This module will cover:</p> - <div class="gem-c-govspeak"> - <ul> - <li>the stages of children’s brain development</li> - <li>how brain development impacts on children’s holistic development</li> - <li>the connection between brain development and children’s learning</li> - <li>a range of theories underpinning best practice</li> - </ul> - </div> - </div> - </div> - <div class="govuk-accordion__section "> - <div class="govuk-accordion__section-header"> - <h2 class="govuk-accordion__section-heading"> - <span class="govuk-accordion__section-button" id="accordion-with-summary-sections-heading-3"> - Module 3: Supporting childrens’ personal, social and emotional development - </span> - </h2> - <div class="govuk-accordion__section-summary govuk-body" id="accordion-with-summary-sections-summary-3"> - This module explores how you can best support children to learn, develop and rehearse their key personal, social and emotional skills in your everyday practice. - </div> - </div> - <div id="accordion-with-summary-sections-content-3" class="govuk-accordion__section-content" aria-labelledby="accordion-with-summary-sections-heading-3"> - <div class="gem-c-govspeak"> - <p>It will help you to consider how the development of these skills impact on a child’s overall development.</p> - </div> - <h2>What you’ll learn </h2> - <p class="govuk_body">This module will cover:</p> - <div class="gem-c-govspeak"> - <ul> - <li>the stages of children’s personal, social and emotional development</li> - <li>the importance of effective relationships</li> - <li>how different factors influence children’s behaviour</li> - <li>self-regulation and its role in children’s development</li> - </ul> - </div> - </div> - </div> - <div class="govuk-accordion__section "> - <div class="govuk-accordion__section-header"> - <h2 class="govuk-accordion__section-heading"> - <span class="govuk-accordion__section-button" id="accordion-with-summary-sections-heading-4"> - The experts - </span> - </h2> - <div class="govuk-accordion__section-summary govuk-body" id="accordion-with-summary-sections-summary-4"> - This training course has been created by 3 early years experts. - </div> - </div> - <div id="accordion-with-summary-sections-content-4" class="govuk-accordion__section-content" aria-labelledby="accordion-with-summary-sections-heading-4"> - <div class="gem-c-govspeak"> - <h3 id="debbie-parry">Debbie Parry</h3> - - <p>Debbie Parry has over 20 years of experience in education and training. - She spent several years working as an early years practitioner in private day nurseries, - before going on to use her knowledge and experience to teach the practitioners - of the future in college environments.</p> - - <p>Debbie has supported a wide range of practitioners including childminders, - apprentices and nursery staff. Most recently, she has been designing and delivering - bespoke training packages for those working in the early years sector.</p> - - <p>Debbie’s qualifications include:</p> - - <ul> - <li>BTEC National Diploma in Early Childhood Studies</li> - <li>NCFE CACHE Level 2 Certificate in Understanding Behaviour that Challenges</li> - <li>NCFE CACHE Level 2 Certificate in Understanding Autism</li> - <li>Diploma in Teaching in the Lifelong Learning Sector (DTLLS)</li> - </ul> - - <h3 id="melissa-tharm">Melissa Tharm</h3> - - <p>Melissa Tharm worked in SEND residential environments for a number of years. - She now brings her experience and knowledge to designing and delivering - outstanding training programmes to professionals in the health, care and education sectors.</p> - - <p>Melissa’s qualifications include:</p> - - <ul> - <li>Certificate in Education (CertEd)</li> - <li>GNVQ Advanced Health and Social Care</li> - <li>NCFE CACHE Level 2 Certificate in Understanding Autism</li> - <li>Makaton Stage 8</li> - </ul> - - <h3 id="catherine-mcelroy">Catherine Mcelroy</h3> - - <p>Catherine Mcelroy has over 20 years of experience working in private day nurseries with children under 5. - She has spent the last 10 years as a nursery manager, ensuring that - children and their families experience excellent care that is fun and exciting.</p> - - <p>Catherine’s qualifications include:</p> - - <ul> - <li>BTEC National Diploma in Early Childhood Studies</li> - <li>Foundation Degree in Early Childhood Studies</li> - </ul> - </div> - </div> - </div> - </div> diff --git a/config/locales/content/safeguarding.yml b/config/locales/content/safeguarding.yml deleted file mode 100644 index 574c6a66..00000000 --- a/config/locales/content/safeguarding.yml +++ /dev/null @@ -1,219 +0,0 @@ -en: - content: - safeguarding: - title: Safeguarding and welfare - position: 9 - markdown: | - Access resources to help improve safeguarding and welfare in the early years - - [Oral Health](/safeguarding-and-welfare/oral-health) - - [Food Safety](/safeguarding-and-welfare/food-safety) - oral_health: - title: Oral health - position: 1 - markdown: | - Find out about promoting oral health as part of the early years foundation stage (EYFS). - - ##Why oral health is included in the EYFS framework - - This has been included because good oral health habits need to be formed from the earliest age. Tooth decay is largely preventable, but it’s still a serious problem among young children. - - Nearly a quarter of 5 year olds in England have tooth decay, with 3 or 4 teeth affected on average. Tooth extraction is one of the most common procedures for children under 6 in hospital. Extraction is also the most common reason for hospital admission for children aged 6 to 10. Children from more deprived backgrounds are more likely to have tooth decay. - - Children who have toothache, or need treatment, may have pain or infections. This can have a wider effect and lead to problems eating, sleeping, socialising and learning. - - ##Promoting oral health - - You can decide how you promote oral health, based on what works best in your setting. Ideally, you can link oral health to things you already promote, like self-care, healthy eating and physical development. - - Be playful with children about oral health. Suggest they brush the teeth of dolls or soft toys. Read stories about teeth and smiles. Talk about healthy food and drinks that help to grow strong teeth, and those that do not. Get them to look at their own and each other’s teeth, using mirrors. - - Talk about tooth brushing with fluoride toothpaste as children arrive. Give parents and carers knowledge and practical advice to support oral health at home. - - You can also support children’s awareness of oral health by: - - - visiting dentists or having them visit you - - providing or showing toothbrushing kits - - showing toothbrushing routines - - ##Supervised toothbrushing - - You can decide if you want to bring in supervised toothbrushing. There are various schemes that support this. Speak to your [local authority](https://www.gov.uk/find-local-council) about it and read the [supervised tooth brushing programme toolkit](https://www.gov.uk/government/publications/improving-oral-health-supervised-tooth-brushing-programme-toolkit) from Public Health England. - - If you decide to introduce supervised toothbrushing, read the [guidance on supervised toothbrushing during coronavirus (COVID-19).](https://www.gov.uk/government/publications/covid-19-supervised-toothbrushing-programmes) - - ##Useful resources - - [Public Health England: health matters child dental health](https://www.gov.uk/government/publications/health-matters-child-dental-health), guidance to help you prevent tooth decay in children under 5, including links to e-learning. - - [Children's Oral Health: healthcare e-learning](https://www.e-lfh.org.uk/programmes/childrens-oral-health/), aimed at parents, early years healthcare workers, teachers, nurses, GPs and the public. - - [Oral Health Foundation: early years foundation stage](https://www.e-lfh.org.uk/programmes/childrens-oral-health/), how children can keep their mouth healthy and the best way to brush your teeth. - - [Improving oral health in early years](https://pathways.nice.org.uk/pathways/oral-health-improvement-for-local-authorities-and-their-partners/improving-oral-health-in-early-years-services-including-nurseries): National Institute for Health and Care Excellence Pathways. - - PACEY’s [oral health advice: includes factsheet for parents.](https://www.pacey.org.uk/working-in-childcare/spotlight-on/oral-health/) - - PACEY's [nutrition spotlight](https://www.pacey.org.uk/working-in-childcare/spotlight-on/nutrition/), encouraging healthy eating habits. - - [Delivering oral health from Public Health England](https://www.gov.uk/government/publications/delivering-better-oral-health-an-evidence-based-toolkit-for-prevention), includes a quick guide to healthy mouths in children. - - [Change4life children’s centre toolkit](https://campaignresources.phe.gov.uk/resources/campaigns/84/resources/4299) from Public Health England, for promoting healthy eating and dental health. - food_safety: - title: Food safety - position: 2 - markdown: | - ##Why is food safety so important for young children? - - The [EYFS framework](https://www.gov.uk/government/publications/early-years-foundation-stage-framework--2) requires providers to take all necessary steps to keep children safe and well – and you must be confident that those responsible for preparing and handling food in your setting are competent to do so. - - Tragically, a child dies in the UK every month from choking and hundreds more require hospital treatment. It can happen quickly and it can happen to anyone. - - Babies and young children’s immune systems are not as strong and developed as adult’s which means they are more vulnerable to infections which can lead to food poisoning. It is important to take extra care with hygiene and preparing food safely. - - ##What it says in the EYFS framework - - Staffing arrangements must meet the needs of all children and ensure their safety. You must ensure that children are adequately supervised, including whilst eating. - - Before a child is admitted to the setting, you must obtain information about any special dietary requirements, preferences and food allergies that the child has, and any special health requirements. - - There must be an area which is adequately equipped to provide healthy meals, snacks and drinks for children as necessary. There must be suitable facilities for the hygienic preparation of food for children, if necessary including suitable sterilisation equipment for babies’ food. You must be confident that those responsible for preparing and handling food are competent to do so. In group provision, all staff involved in preparing and handling food must receive training in food hygiene. - - [Statutory framework for the early years foundation stage](https://www.gov.uk/government/publications/early-years-foundation-stage-framework--2), pages 28 and 33. - - ##Food safety advice for children age 5 and under - - ###How to reduce the risk of choking - - Food preparation: - - - remove any stones and pips from fruit before serving - - cut small round foods, like grapes, strawberries and cherry tomatoes, lengthways and into quarters - - cut large fruits like melon, and hard fruit or vegetables like raw apple and carrot into slices instead of small chunks - - do not offer raisins as a snack to children under 12 months – although these can be chopped up as part of a meal - - soften hard fruit and vegetables (such as carrot and apple) and remove the skins when first given to babies from around 6 months - - sausages should be avoided due to their high salt content, but if offered to children these should be cut into thin strips rather than chunks and remove the skins - - remove bones from meat or fish - - do not give whole nuts to children under five years old - - do not give whole seeds to children under five years old - - cut cheese into strips rather than chunks - - do not give popcorn as a snack - - do not give children marshmallows or jelly cubes from a packet either to eat or as part of messy play activities as they can get stuck in the throat - - do not give children hard sweets - - ###Supervision - - Infants and young children should be seated safely in a highchair or appropriately sized low chair while eating. Infants and young children should never be left alone while they are eating, and staff should be familiar with paediatric first aid advice for children who are choking. - - The criteria for effective Paediatric First Aid (PFA) training can be found in the [Statutory framework for the early years foundation stage](https://www.gov.uk/government/publications/early-years-foundation-stage-framework--2), Annex A. - - ###Useful resources - - - [Child Accident Prevention Trust - choking avoidance poster](https://www.capt.org.uk/Handlers/Download.ashx?IDMF=9133d866-5a33-4bea-8133-40801d70c1f1&utm_source=CAPT%20safety%20pages&utm_medium=CAPT%20news&utm_campaign=Choking&utm_term=Finger%20Food%20Without%20The%20Fear&utm_content=PDF%20Free%20Download) - - [Choking hazards in the home and how to avoid them (rospa.com)](https://www.rospa.com/rospaweb/docs/advice-services/home-safety/choking-hazards.pdf) - - ##Food and drinks to avoid - - ###Drinks - - Provide only fresh tap water and plain milk for children to drink. Fruit juice, smoothies, squash, fizzy drinks and flavoured milk, even when diluted, contain lots of sugar and can cause tooth decay. Diet or reduced-sugar drinks are not recommended for babies and toddlers either. For older children, these drinks can fill children up so they’re not hungry for healthier food. - - When offering dairy alternatives to cow’s milk: - - - Unsweetened calcium-fortified, plant-based drinks (such as soya, oat and almond drinks) should be avoided before 12 months, however small amounts can be used in cooking. These drinks can be given from 12 months as part of a healthy balanced diet. - - Do not give children under 5 rice drinks, because of the level of arsenic they contain. - - ###Foods to avoid before around 6 months of age - - Ideally, babies should be introduced to solid foods from around 6 months of age. If parents or carers have decided to introduce solid foods to their child before 6 months of age, you will need to work closely with them to ensure a consistent and safe approach. - - It is important to remember that there are some foods which should not be given before 6 months of age: - - - cow’s milk - - eggs - - foods containing wheat or gluten, including wheat, barley and rye (for example bread, pasta) - - nuts, peanuts and peanut products - - seeds - - fish and shellfish - - honey – avoid honey until 12 months old - - if a baby is less than 6 months old, sterilise water by boiling it first and then letting it cool right down - once a baby is 6 months old, this is no longer necessary - - ###Foods to avoid up to 12 months - - - honey for infants under 1 year, as it occasionally contains bacteria which can make them ill - - ###Foods to avoid up to 5 years - - - **Nuts**, especially peanuts, can cause severe allergic reactions in some children and all settings should have an allergy plan in place. Whole nuts, peanuts and seeds should not be given to children under 5 years old as they pose a choking risk. - - **Raw eggs**, or food containing partially cooked eggs, for example uncooked cake mixture and runny boiled eggs (unless they have the red lion stamp or you see the words “British Lion quality”). - - **Foods high in salt** such as: sausages, bacon, crackers, crisps, ready meals and takeaways. - - **Sugar** – both in sugary snacks and by not adding sugar to food. - - **Foods high in saturated fat** such as biscuits, crisps and cakes. - - **Fresh pate** (meat, fish or vegetable-based) to reduce the risk of food poisoning. - - **Unpasteurised milk, milk drinks and cheese**, mould-ripened cheeses and soft blue-veined cheese, to reduce the risk of food poisoning. However, these cheeses can be used as part of a cooked recipe as listeria is killed by cooking. - - **Shark, swordfish and marlin** as the levels of mercury in these fish can affect a child’s developing nervous system. - - **Raw shellfish** to reduce the risk of food poisoning, and make sure any shellfish you use is thoroughly cooked. - - **Raw jelly cubes** – these are a choking hazard. - - ###Foods to serve occasionally from 6 months to 4 years - - - Although it is recommended to provide oily fish in early years settings at least once every 3 weeks, do not provide it more than twice a week, as it can contain low levels of pollutants. - - ##Useful resources - - - [Foods to avoid giving babies and young children - NHS (www.nhs.uk)](https://www.nhs.uk/conditions/baby/weaning-and-feeding/foods-to-avoid-giving-babies-and-young-children/) - - [What to feed young children - NHS (www.nhs.uk)](https://www.nhs.uk/conditions/baby/weaning-and-feeding/what-to-feed-young-children/) - - [Baby and toddler meal ideas - NHS (www.nhs.uk)](https://www.nhs.uk/conditions/baby/weaning-and-feeding/baby-and-toddler-meal-ideas/) - - [Eat-Better-Start-Better1.pdf (foundationyears.org.uk)](https://foundationyears.org.uk/wp-content/uploads/2017/11/Eat-Better-Start-Better1.pdf) - - [Example menus for early years settings in England - Part 1: Guidance](https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/658870/Early_years_menus_part_1_guidance.pdf) - - [Example menus for early years settings in England - Part 2: Recipes](https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/658872/Early_years_menus_part_2_recipes.pdf) - - ##Safe weaning - - Progression from the introduction of first foods (at about 6 months), to a range of blended or mashed foods, and then to a wider range of chopped or minced foods should be a gradual process, based on each infants’ developmental readiness, rather than a staged process based on age alone. - - [Start4Life](https://www.nhs.uk/start4life/weaning/) have lots of helpful information for parents regarding safe weaning, which you will also find it helpful to refer to. - - ##How to prepare infant formula bottles - - Good hygiene is very important when making up a formula feed. Babies’ immune systems are not as strong as adults’ therefore all bottles, teats and feeding equipment need to be washed and sterilised before each feed. The NHS has a helpful step by step guide on how to prepare infant formula. - - ##Useful resources - - - [Your baby's first solid foods - NHS (www.nhs.uk)](https://www.nhs.uk/conditions/baby/weaning-and-feeding/babys-first-solid-foods/) - - [Help your baby enjoy new foods - NHS (www.nhs.uk)](https://www.nhs.uk/conditions/baby/weaning-and-feeding/help-your-baby-enjoy-new-foods/) - - [Drinks and cups for babies and young children - NHS (www.nhs.uk)](https://www.nhs.uk/conditions/baby/weaning-and-feeding/drinks-and-cups-for-babies-and-young-children/) - - [How to make up baby formula - NHS (www.nhs.uk)](https://www.nhs.uk/conditions/baby/breastfeeding-and-bottle-feeding/bottle-feeding/making-up-baby-formula/) - - ##Allergies - - Early years settings and your food provider should work closely with families to support children with allergies or intolerances. As part of the [EYFS framework](https://www.gov.uk/government/publications/early-years-foundation-stage-framework--2), you are required to obtain information about children’s special dietary requirements – including food allergies and intolerances – before they attend, and record and act on the information provided about children’s dietary needs. - - There should be a protocol in place which is accessible to all staff, to ensure everyone is aware of individual children’s allergies and symptoms. - - Understanding which allergens are present in every meal and snack you provide is an important step in providing food which is safe for children with food allergies and intolerances. Since 2014, all food businesses, including early years settings, have been required by law to give details about the allergens in the food they provide. - - ##Useful resources - - - [Food allergies in babies and young children - NHS (www.nhs.uk)](https://www.nhs.uk/conditions/baby/weaning-and-feeding/food-allergies-in-babies-and-young-children/) - - - [Food allergy - NHS](https://www.nhs.uk/conditions/food-allergy/) - - - [Allergy UK National Charity Free Allergy Support & Resources](https://www.allergyuk.org/) - - - [Allergen guidance for food businesses Food Standards Agency](https://www.food.gov.uk/business-guidance/allergen-guidance-for-food-businesses) - - - [Eat Better, Start Better From pregnancy to children aged 5 (foundationyears.org.uk)](https://foundationyears.org.uk/eat-better-start-better/) - - ##Hygiene - - Food should be stored, prepared and presented in a safe and hygienic environment. This is especially important when providing food for young children, as they may have a low resistance to food poisoning. It is also important that children are taught basic hygiene themselves, such as not eating food that has fallen on the floor, and washing their hands with soap and warm water before eating meals or snacks and after going to the toilet or handling animals. - - Ensure food is cooked until steaming hot to kill harmful bacteria, and is then cooled sufficiently before giving it to infants and young children. - - Wash all surfaces for preparing or eating food, especially chopping boards, with hot soapy water (and keep pets away from them). Make sure all bowls and spoons are washed with hot soapy water. Tea towels, kitchen cloths or sponges can harbour lots of germs, so wash them regularly. - - Further information on food hygiene: - - - [Children's food: safety and hygiene - NHS (www.nhs.uk)](https://www.nhs.uk/conditions/baby/weaning-and-feeding/childrens-food-safety-and-hygiene/) - - [Safer food, better business (SFBB) Food Standards Agency](https://www.food.gov.uk/business-guidance/safer-food-better-business-sfbb) - - [Safer food, better business for childminders Food Standards Agency](https://www.food.gov.uk/business-guidance/safer-food-better-business-for-childminders) diff --git a/config/puma.rb b/config/puma.rb index bca244ef..ad7ef4eb 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -4,17 +4,17 @@ # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum; this matches the default thread size of Active Record. # -max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } -min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } +max_threads_count = ENV.fetch('RAILS_MAX_THREADS', 5) +min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count } threads min_threads_count, max_threads_count # Specifies the `port` that Puma will listen on to receive requests; default is 3000. # -port ENV.fetch("PORT") { 3000 } +port ENV.fetch('PORT', 3000) # Specifies the `environment` that Puma will run in. # -environment ENV.fetch("RAILS_ENV") { "development" } +environment ENV.fetch('RAILS_ENV') { 'development' } # Specifies the `pidfile` that Puma will use. # pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } diff --git a/config/routes.rb b/config/routes.rb index d1232b1a..df7e04df 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,53 +1,23 @@ Rails.application.routes.draw do - get "/check" => "application#check" - get "/health" => "application#check" + get '/check' => 'application#check' + get '/health' => 'application#check' # Note These have to be above the wildcard route - get "/404", to: "errors#not_found", via: :all - get "/422", to: "errors#unprocessable_entity", via: :all - get "/500", to: "errors#internal_server_error", via: :all - get "/503", to: "errors#service_unavailable", via: :all + get '/404', to: 'errors#not_found', via: :all + get '/422', to: 'errors#unprocessable_entity', via: :all + get '/500', to: 'errors#internal_server_error', via: :all + get '/503', to: 'errors#service_unavailable', via: :all # explicit redirect for old link - get "/get-help-to-improve-your-practice/send-meeting-the-needs-of-all-children", to: redirect("/get-help-to-improve-your-practice/meeting-the-needs-of-all-children") + get '/get-help-to-improve-your-practice/send-meeting-the-needs-of-all-children', to: redirect('/get-help-to-improve-your-practice/meeting-the-needs-of-all-children') resources :settings, only: %i[show create] - devise_for :users - namespace :admin do - root to: "users#index" - resources :users - resources :content_pages, path: "pages" do - get "versions", on: :member - get "preview_of_live", on: :member - post "unpublish", on: :member - resources :content_page_versions do - get "preview_of_draft", on: :member - post "publish", on: :member - end - end - resources :content_blocks, path: "blocks", only: %i[index new edit create update] - post "preview_markdown", to: "content_pages#preview" - end - - %w[accessibility-statement contact-us disclaimer child-development-training].each do |static_page| - get "/#{static_page}", to: "static_pages##{static_page.underscore}" - end - resources :feedbacks, only: %i[create] - constraints(-> { ENV.fetch('NEW_DESIGN', nil).blank? }) do - get "/:section/:slug", to: "content#show" - get "/:slug", to: "content#show" - root to: "content#index", as: :beta_root - end - - constraints(-> { ENV.fetch('CONTENTFUL', nil).blank? }) do - get "/(*cms_path)/:slug" => "pages#show" - end + get '/:section' => 'web/pages#index' + get '/:section/:slug' => 'web/pages#show' + get '/:section/:overview/:slug' => 'web/pages#show' - get "/:section" => "web/pages#index" - get "/:section/:slug" => "web/pages#show" - get "/:section/:overview/:slug" => "web/pages#show" - root to: "home#index" + root to: 'home#index' end diff --git a/db/migrate/20210120152747_devise_create_users.rb b/db/migrate/20210120152747_devise_create_users.rb index 61ae93c6..d359edfe 100644 --- a/db/migrate/20210120152747_devise_create_users.rb +++ b/db/migrate/20210120152747_devise_create_users.rb @@ -4,8 +4,8 @@ class DeviseCreateUsers < ActiveRecord::Migration[6.1] def change create_table :users do |t| ## Database authenticatable - t.string :email, null: false, default: "" - t.string :encrypted_password, null: false, default: "" + t.string :email, null: false, default: '' + t.string :encrypted_password, null: false, default: '' ## Recoverable t.string :reset_password_token diff --git a/db/migrate/20210120162158_create_active_storage_tables.active_storage.rb b/db/migrate/20210120162158_create_active_storage_tables.active_storage.rb index c6912df6..47c55585 100644 --- a/db/migrate/20210120162158_create_active_storage_tables.active_storage.rb +++ b/db/migrate/20210120162158_create_active_storage_tables.active_storage.rb @@ -21,7 +21,7 @@ def change t.timestamps - t.index %i[record_type record_id name blob_id], name: "index_active_storage_attachments_uniqueness", unique: true + t.index %i[record_type record_id name blob_id], name: 'index_active_storage_attachments_uniqueness', unique: true t.foreign_key :active_storage_blobs, column: :blob_id end @@ -29,7 +29,7 @@ def change t.belongs_to :blob, null: false, index: false t.string :variation_digest, null: false - t.index %i[blob_id variation_digest], name: "index_active_storage_variant_records_uniqueness", unique: true + t.index %i[blob_id variation_digest], name: 'index_active_storage_variant_records_uniqueness', unique: true t.foreign_key :active_storage_blobs, column: :blob_id t.timestamps end diff --git a/db/migrate/20210201170927_add_alt_to_content_assets.rb b/db/migrate/20210201170927_add_alt_to_content_assets.rb index 7dc980a0..2da2ad68 100644 --- a/db/migrate/20210201170927_add_alt_to_content_assets.rb +++ b/db/migrate/20210201170927_add_alt_to_content_assets.rb @@ -1,5 +1,5 @@ class AddAltToContentAssets < ActiveRecord::Migration[6.1] def change - add_column :content_assets, :alt_text, :string, null: false, default: "" + add_column :content_assets, :alt_text, :string, null: false, default: '' end end diff --git a/db/migrate/20210212120340_remove_position_index_from_content_page.rb b/db/migrate/20210212120340_remove_position_index_from_content_page.rb index 247cd7a1..417b6840 100644 --- a/db/migrate/20210212120340_remove_position_index_from_content_page.rb +++ b/db/migrate/20210212120340_remove_position_index_from_content_page.rb @@ -1,6 +1,6 @@ class RemovePositionIndexFromContentPage < ActiveRecord::Migration[6.1] def up - remove_index :content_pages, name: "index_content_pages_on_position" + remove_index :content_pages, name: 'index_content_pages_on_position' end def down diff --git a/db/migrate/20210303125510_install_audited.rb b/db/migrate/20210303125510_install_audited.rb index fe54222d..3d1cf72e 100644 --- a/db/migrate/20210303125510_install_audited.rb +++ b/db/migrate/20210303125510_install_audited.rb @@ -17,9 +17,9 @@ def self.up t.timestamps end - add_index :audits, %i[auditable_type auditable_id version], name: "auditable_index" - add_index :audits, %i[associated_type associated_id], name: "associated_index" - add_index :audits, %i[user_id user_type], name: "user_index" + add_index :audits, %i[auditable_type auditable_id version], name: 'auditable_index' + add_index :audits, %i[associated_type associated_id], name: 'associated_index' + add_index :audits, %i[user_id user_type], name: 'user_index' add_index :audits, :request_uuid add_index :audits, :created_at end diff --git a/db/migrate/20210407151553_add_role_to_user.rb b/db/migrate/20210407151553_add_role_to_user.rb index f1a54467..c5018196 100644 --- a/db/migrate/20210407151553_add_role_to_user.rb +++ b/db/migrate/20210407151553_add_role_to_user.rb @@ -1,5 +1,5 @@ class AddRoleToUser < ActiveRecord::Migration[6.1] def change - add_column :users, :role, :string, null: false, default: "" + add_column :users, :role, :string, null: false, default: '' end end diff --git a/db/migrate/20211018113347_add_status_to_article.rb b/db/migrate/20211018113347_add_status_to_article.rb index f22820f0..d8fa83d6 100644 --- a/db/migrate/20211018113347_add_status_to_article.rb +++ b/db/migrate/20211018113347_add_status_to_article.rb @@ -1,6 +1,6 @@ class AddStatusToArticle < ActiveRecord::Migration[6.1] def change - add_column :articles, :status, :string, default: "draft" + add_column :articles, :status, :string, default: 'draft' add_index :articles, :status end end diff --git a/db/migrate/20240118115523_delete_active_storage_tables.rb b/db/migrate/20240118115523_delete_active_storage_tables.rb index 78815b02..e7aa0b27 100644 --- a/db/migrate/20240118115523_delete_active_storage_tables.rb +++ b/db/migrate/20240118115523_delete_active_storage_tables.rb @@ -3,7 +3,7 @@ def change drop_table :active_storage_variant_records do |t| t.belongs_to :blob, null: false, index: false t.string :variation_digest, null: false - t.index %i[blob_id variation_digest], name: "index_active_storage_variant_records_uniqueness", unique: true + t.index %i[blob_id variation_digest], name: 'index_active_storage_variant_records_uniqueness', unique: true t.foreign_key :active_storage_blobs, column: :blob_id t.timestamps end @@ -12,7 +12,7 @@ def change t.references :record, null: false, polymorphic: true, index: false t.references :blob, null: false t.timestamps - t.index %i[record_type record_id name blob_id], name: "index_active_storage_attachments_uniqueness", unique: true + t.index %i[record_type record_id name blob_id], name: 'index_active_storage_attachments_uniqueness', unique: true t.foreign_key :active_storage_blobs, column: :blob_id end drop_table :active_storage_blobs do |t| diff --git a/db/seeds.rb b/db/seeds.rb index 3dd0664a..52fd12d8 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -3,5 +3,5 @@ Seeder.seed(:user, name_method: :email) if Rails.application.credentials.user_password.present? puts Seeder.report # rubocop:disable Rails/Output -Rails.logger.info "Seeding completed" +Rails.logger.info 'Seeding completed' Seeder.report.each { |line| Rails.logger.info line } diff --git a/db/seeds/archive/advice_for_effective_supervision_of_staff_seeds.rb b/db/seeds/archive/advice_for_effective_supervision_of_staff_seeds.rb index e3e24aff..1a37548c 100644 --- a/db/seeds/archive/advice_for_effective_supervision_of_staff_seeds.rb +++ b/db/seeds/archive/advice_for_effective_supervision_of_staff_seeds.rb @@ -26,15 +26,15 @@ MARKDOWN_FOR_ADVICE_FOR_EFFECTIVE_SUPERVISION_OF_STAFF advice_for_effective_supervision_of_staff = { - title: "Advice for effective supervision of staff", + title: 'Advice for effective supervision of staff', markdown: markdown_for_advice_for_effective_supervision_of_staff, - description: "Advice for effective supervision of staff", - featured_alt_text: "Featured alt text", - thumbnail_alt_text: "Thumbnail alt text", + description: 'Advice for effective supervision of staff', + featured_alt_text: 'Featured alt text', + thumbnail_alt_text: 'Thumbnail alt text', } advice_for_effective_supervision_of_staff_page = Article.new advice_for_effective_supervision_of_staff -advice_for_effective_supervision_of_staff_page.featured_image.attach(io: File.open("spec/fixtures/sample.jpeg"), filename: "sample.jpeg", content_type: "image/jpeg") -advice_for_effective_supervision_of_staff_page.thumbnail_image.attach(io: File.open("spec/fixtures/sample.jpeg"), filename: "sample.jpeg", content_type: "image/jpeg") +advice_for_effective_supervision_of_staff_page.featured_image.attach(io: File.open('spec/fixtures/sample.jpeg'), filename: 'sample.jpeg', content_type: 'image/jpeg') +advice_for_effective_supervision_of_staff_page.thumbnail_image.attach(io: File.open('spec/fixtures/sample.jpeg'), filename: 'sample.jpeg', content_type: 'image/jpeg') advice_for_effective_supervision_of_staff_page.save! # rubocop:enable Layout/HeredocIndentation diff --git a/db/seeds/archive/create_content_blocks.rb b/db/seeds/archive/create_content_blocks.rb index 1a2b9dc2..e75442fc 100644 --- a/db/seeds/archive/create_content_blocks.rb +++ b/db/seeds/archive/create_content_blocks.rb @@ -109,10 +109,10 @@ Our approach was to test all pages. HTML_FOR_ACCESSIBILITY -unless ContentBlock.exists?(name: "accessibility") +unless ContentBlock.exists?(name: 'accessibility') ContentBlock.create! do |u| - u.name = "accessibility" - u.description = "Used on the Accessibility page" + u.name = 'accessibility' + u.description = 'Used on the Accessibility page' u.markdown = html_for_accessibility end end @@ -178,10 +178,10 @@ MARKDOWN_FOR_COOKIES_PAGE -unless ContentBlock.exists?(name: "cookies") +unless ContentBlock.exists?(name: 'cookies') ContentBlock.create! do |u| - u.name = "cookies" - u.description = "Markdown for the cookies page" + u.name = 'cookies' + u.description = 'Markdown for the cookies page' u.markdown = markdown_for_cookies end end @@ -215,10 +215,10 @@ MARKDOWN_FOR_DISCLAIMER_PAGE -unless ContentBlock.exists?(name: "disclaimer") +unless ContentBlock.exists?(name: 'disclaimer') ContentBlock.create! do |u| - u.name = "disclaimer" - u.description = "For the disclaimer page" + u.name = 'disclaimer' + u.description = 'For the disclaimer page' u.markdown = markdown_for_disclaimer_page end end @@ -236,10 +236,10 @@ MARKDOWN_FOR_CONTACT_US -unless ContentBlock.exists?(name: "contact_us") +unless ContentBlock.exists?(name: 'contact_us') ContentBlock.create! do |u| - u.name = "contact_us" - u.description = "Markdown for the Contact Us page" + u.name = 'contact_us' + u.description = 'Markdown for the Contact Us page' u.markdown = markdown_for_contact_us end end diff --git a/db/seeds/archive/expressive_arts_and_design_seeds.rb b/db/seeds/archive/expressive_arts_and_design_seeds.rb index c2abd28a..7b18a0bf 100644 --- a/db/seeds/archive/expressive_arts_and_design_seeds.rb +++ b/db/seeds/archive/expressive_arts_and_design_seeds.rb @@ -29,7 +29,7 @@ MARKDOWN_FOR_EXPRESSIVE_ARTS_AND_DESIGN expressive_arts_and_design = { - title: "Expressive arts and design", + title: 'Expressive arts and design', markdown: markdown_for_expressive_arts_and_design, position: 7, } @@ -45,7 +45,7 @@ MARKDOWN_FOR_IMAGINATION_AND_CREATIVITY imagination_and_creativity = { - title: "Imagination and creativity", + title: 'Imagination and creativity', markdown: markdown_for_imagination_and_creativity, position: 1, parent_id: expressive_arts_and_design_page.id, @@ -62,7 +62,7 @@ MARKDOWN_FOR_SELF_EXPRESSION self_expression = { - title: "Self expression", + title: 'Self expression', markdown: markdown_for_self_expression, position: 2, parent_id: expressive_arts_and_design_page.id, @@ -79,7 +79,7 @@ MARKDOWN_FOR_COMMUNICATING_THROUGH_ARTS communicating_through_arts = { - title: "Communicating through arts", + title: 'Communicating through arts', markdown: markdown_for_communicating_through_arts, position: 3, parent_id: expressive_arts_and_design_page.id, diff --git a/db/seeds/archive/get_help_to_improve_your_practice_seeds.rb b/db/seeds/archive/get_help_to_improve_your_practice_seeds.rb index a92dd821..bc517af3 100644 --- a/db/seeds/archive/get_help_to_improve_your_practice_seeds.rb +++ b/db/seeds/archive/get_help_to_improve_your_practice_seeds.rb @@ -20,7 +20,7 @@ MARKDOWN attrs = { - title: "Get help to improve your practice", + title: 'Get help to improve your practice', markdown: markdown, position: 8, } @@ -39,7 +39,7 @@ MARKDOWN attrs = { - title: "Planning", + title: 'Planning', markdown: markdown, position: 1, parent_id: parent_page.id, @@ -59,7 +59,7 @@ MARKDOWN attrs = { - title: "Reducing paperwork", + title: 'Reducing paperwork', markdown: markdown, position: 2, parent_id: parent_page.id, @@ -79,7 +79,7 @@ MARKDOWN attrs = { - title: "Identifying and supporting children with special educational needs and disability", + title: 'Identifying and supporting children with special educational needs and disability', markdown: markdown, position: 3, parent_id: parent_page.id, @@ -98,7 +98,7 @@ MARKDOWN attrs = { - title: "Promoting oral health as part of the safeguarding and welfare requirements", + title: 'Promoting oral health as part of the safeguarding and welfare requirements', markdown: markdown, position: 4, parent_id: parent_page.id, @@ -125,7 +125,7 @@ MARKDOWN attrs = { - title: "Working in partnership with parents", + title: 'Working in partnership with parents', markdown: markdown, position: 5, parent_id: parent_page.id, diff --git a/db/seeds/archive/guide_to_childrens_mental_health_seeds.rb b/db/seeds/archive/guide_to_childrens_mental_health_seeds.rb index fa7acaed..936a7378 100644 --- a/db/seeds/archive/guide_to_childrens_mental_health_seeds.rb +++ b/db/seeds/archive/guide_to_childrens_mental_health_seeds.rb @@ -26,15 +26,15 @@ MARKDOWN_FOR_GUIDE_TO_CHILDRENS_MENTAL_HEALTH guide_to_childrens_mental_health = { - title: "Guide to childrens mental health in the early years", + title: 'Guide to childrens mental health in the early years', markdown: markdown_for_guide_to_childrens_mental_health, - description: "Guide to childrens mental health in the early years", - featured_alt_text: "Featured alt text", - thumbnail_alt_text: "Thumbnail alt text", + description: 'Guide to childrens mental health in the early years', + featured_alt_text: 'Featured alt text', + thumbnail_alt_text: 'Thumbnail alt text', } guide_to_childrens_mental_health_page = Article.new guide_to_childrens_mental_health -guide_to_childrens_mental_health_page.featured_image.attach(io: File.open("spec/fixtures/sample.jpeg"), filename: "sample.jpeg", content_type: "image/jpeg") -guide_to_childrens_mental_health_page.thumbnail_image.attach(io: File.open("spec/fixtures/sample.jpeg"), filename: "sample.jpeg", content_type: "image/jpeg") +guide_to_childrens_mental_health_page.featured_image.attach(io: File.open('spec/fixtures/sample.jpeg'), filename: 'sample.jpeg', content_type: 'image/jpeg') +guide_to_childrens_mental_health_page.thumbnail_image.attach(io: File.open('spec/fixtures/sample.jpeg'), filename: 'sample.jpeg', content_type: 'image/jpeg') guide_to_childrens_mental_health_page.save! # rubocop:enable Layout/HeredocIndentation diff --git a/db/seeds/archive/internet_safety_seeds.rb b/db/seeds/archive/internet_safety_seeds.rb index 8ba8d439..03caa47a 100644 --- a/db/seeds/archive/internet_safety_seeds.rb +++ b/db/seeds/archive/internet_safety_seeds.rb @@ -26,15 +26,15 @@ MARKDOWN_FOR_INTERNET_SAFETY internet_safety = { - title: "Internet safety at home and in nursery", + title: 'Internet safety at home and in nursery', markdown: markdown_for_internet_safety, - description: "Internet safety at home and in nursery", - featured_alt_text: "Featured alt text", - thumbnail_alt_text: "Thumbnail alt text", + description: 'Internet safety at home and in nursery', + featured_alt_text: 'Featured alt text', + thumbnail_alt_text: 'Thumbnail alt text', } internet_safety_page = Article.new internet_safety -internet_safety_page.featured_image.attach(io: File.open("spec/fixtures/sample.jpeg"), filename: "sample.jpeg", content_type: "image/jpeg") -internet_safety_page.thumbnail_image.attach(io: File.open("spec/fixtures/sample.jpeg"), filename: "sample.jpeg", content_type: "image/jpeg") +internet_safety_page.featured_image.attach(io: File.open('spec/fixtures/sample.jpeg'), filename: 'sample.jpeg', content_type: 'image/jpeg') +internet_safety_page.thumbnail_image.attach(io: File.open('spec/fixtures/sample.jpeg'), filename: 'sample.jpeg', content_type: 'image/jpeg') internet_safety_page.save! # rubocop:enable Layout/HeredocIndentation diff --git a/db/seeds/archive/mathematics_seeds.rb b/db/seeds/archive/mathematics_seeds.rb index a9107423..b06a163e 100644 --- a/db/seeds/archive/mathematics_seeds.rb +++ b/db/seeds/archive/mathematics_seeds.rb @@ -29,7 +29,7 @@ MARKDOWN_FOR_MATHEMATICS mathematics = { - title: "Mathematics", + title: 'Mathematics', markdown: markdown_for_mathematics, position: 5, } @@ -106,7 +106,7 @@ - Praise children for effort rather than talent. This shows them that by working hard they can always improve MARKDOWN_FOR_COUNTING counting = { - title: "Patterns and connections", + title: 'Patterns and connections', markdown: markdown_for_counting, position: 2, parent_id: mathematics_page.id, @@ -123,7 +123,7 @@ MARKDOWN_FOR_NUMBER_PATTERNS number_patterns = { - title: "Numbers in context", + title: 'Numbers in context', markdown: markdown_for_number_patterns, position: 1, parent_id: mathematics_page.id, @@ -140,7 +140,7 @@ MARKDOWN_FOR_SPATIAL_REASONING spatial_reasoning = { - title: "Reasoning", + title: 'Reasoning', markdown: markdown_for_spatial_reasoning, position: 3, parent_id: mathematics_page.id, diff --git a/db/seeds/archive/personal_social_and_emotional_development_seeds.rb b/db/seeds/archive/personal_social_and_emotional_development_seeds.rb index 4527f4d1..b6942bf4 100644 --- a/db/seeds/archive/personal_social_and_emotional_development_seeds.rb +++ b/db/seeds/archive/personal_social_and_emotional_development_seeds.rb @@ -35,7 +35,7 @@ MARKDOWN_FOR_PERSONAL_SOCIAL_AND_DEVELOPMENT personal_social_and_emotional_development = { - title: "Personal, social and emotional development", + title: 'Personal, social and emotional development', markdown: markdown_for_personal_social_and_emotional_development, position: 3, } @@ -301,7 +301,7 @@ - Consider talking about how children’s emotional outbursts make you feel with other providers. MARKDOWN_FOR_EMOTIONS emotions = { - title: "Emotions", + title: 'Emotions', markdown: markdown_for_emotions, position: 1, parent_id: personal_social_and_emotional_development_page.id, @@ -318,7 +318,7 @@ MARKDOWN_FOR_RELATIONSHIPS relationships = { - title: "Relationships", + title: 'Relationships', markdown: markdown_for_relationships, position: 3, parent_id: personal_social_and_emotional_development_page.id, @@ -461,7 +461,7 @@ MARKDOWN_FOR_SENSE_OF_SELF sense_of_self = { - title: "Sense of self", + title: 'Sense of self', markdown: markdown_for_sense_of_self, position: 2, parent_id: personal_social_and_emotional_development_page.id, diff --git a/db/seeds/archive/physical_development.rb b/db/seeds/archive/physical_development.rb index cbb3e998..a063219a 100644 --- a/db/seeds/archive/physical_development.rb +++ b/db/seeds/archive/physical_development.rb @@ -37,7 +37,7 @@ MARKDOWN_FOR_PHYSICAL_DEVELOPMENT physical_development = { - title: "Physical development", + title: 'Physical development', markdown: markdown_for_physical_development, position: 2, } @@ -51,7 +51,7 @@ ### To be completed MARKDOWN_FOR_CORE_STRENGTH core_strength = { - title: "Core strength and co-ordination", + title: 'Core strength and co-ordination', markdown: markdown_for_core_strength, position: 1, parent_id: physical_development_page.id, @@ -63,7 +63,7 @@ ### To be completed MARKDOWN_FOR_FINE_MOTOR_SKILS fine_motor_skills = { - title: "Fine motor skills", + title: 'Fine motor skills', markdown: markdown_for_fine_motor_skills, position: 3, parent_id: physical_development_page.id, @@ -75,7 +75,7 @@ ### To be completed MARKDOWN_FOR_GROSS_MOTOR_SKILLS gross_motor_skills = { - title: "Gross motor skills", + title: 'Gross motor skills', markdown: markdown_for_gross_motor_skills, position: 2, parent_id: physical_development_page.id, diff --git a/db/seeds/archive/support_for_staff_seeds.rb b/db/seeds/archive/support_for_staff_seeds.rb index 7de517f8..3b633bf5 100644 --- a/db/seeds/archive/support_for_staff_seeds.rb +++ b/db/seeds/archive/support_for_staff_seeds.rb @@ -26,15 +26,15 @@ MARKDOWN_FOR_SUPPORT_FOR_STAFF support_for_staff = { - title: "Support for staff mental health and wellbeing", + title: 'Support for staff mental health and wellbeing', markdown: markdown_for_support_for_staff, - description: "Support for staff mental health and wellbeing", - featured_alt_text: "Featured alt text", - thumbnail_alt_text: "Thumbnail alt text", + description: 'Support for staff mental health and wellbeing', + featured_alt_text: 'Featured alt text', + thumbnail_alt_text: 'Thumbnail alt text', } support_for_staff_page = Article.new support_for_staff -support_for_staff_page.featured_image.attach(io: File.open("spec/fixtures/sample.jpeg"), filename: "sample.jpeg", content_type: "image/jpeg") -support_for_staff_page.thumbnail_image.attach(io: File.open("spec/fixtures/sample.jpeg"), filename: "sample.jpeg", content_type: "image/jpeg") +support_for_staff_page.featured_image.attach(io: File.open('spec/fixtures/sample.jpeg'), filename: 'sample.jpeg', content_type: 'image/jpeg') +support_for_staff_page.thumbnail_image.attach(io: File.open('spec/fixtures/sample.jpeg'), filename: 'sample.jpeg', content_type: 'image/jpeg') support_for_staff_page.save! # rubocop:enable Layout/HeredocIndentation diff --git a/db/seeds/archive/understanding_the_world_seeds.rb b/db/seeds/archive/understanding_the_world_seeds.rb index bcbcdc06..36f3c13c 100644 --- a/db/seeds/archive/understanding_the_world_seeds.rb +++ b/db/seeds/archive/understanding_the_world_seeds.rb @@ -27,7 +27,7 @@ MARKDOWN_FOR_UNDERSTANDING_THE_WORLD understanding_the_world = { - title: "Understanding the world", + title: 'Understanding the world', markdown: markdown_for_understanding_the_world, position: 6, } @@ -43,7 +43,7 @@ MARKDOWN_FOR_PERSONAL_EXPERIENCES personal_experiences = { - title: "Personal experiences", + title: 'Personal experiences', markdown: markdown_for_personal_experiences, position: 1, parent_id: understanding_the_world_page.id, @@ -60,7 +60,7 @@ MARKDOWN_FOR_DIVERSE_WORLD diverse_world = { - title: "Diverse world", + title: 'Diverse world', markdown: markdown_for_diverse_world, position: 2, parent_id: understanding_the_world_page.id, @@ -77,7 +77,7 @@ MARKDOWN_FOR_WIDENING_VOCABULARY widening_vocabulary = { - title: "Widening vocabulary", + title: 'Widening vocabulary', markdown: markdown_for_widening_vocabulary, position: 3, parent_id: understanding_the_world_page.id, diff --git a/docs/cms-view.png b/docs/cms-view.png deleted file mode 100644 index 1c9cdff9..00000000 Binary files a/docs/cms-view.png and /dev/null differ diff --git a/docs/landing-page-view.png b/docs/landing-page-view.png deleted file mode 100644 index 9c47f8ae..00000000 Binary files a/docs/landing-page-view.png and /dev/null differ diff --git a/docs/public-view-of-a-page.png b/docs/public-view-of-a-page.png deleted file mode 100644 index 9af4e23a..00000000 Binary files a/docs/public-view-of-a-page.png and /dev/null differ diff --git a/documentation/debugging_dev_paas.md b/documentation/debugging_dev_paas.md deleted file mode 100644 index 9237d9b4..00000000 --- a/documentation/debugging_dev_paas.md +++ /dev/null @@ -1,87 +0,0 @@ -## Debugging in GovPaaS -There situations in the dev environment where it would be useful to see server logs, have database access, or rails console access. -This should not be used in other environments. - -### Setup -The following assumed you have the cloudfoundry CLI set up on your machine, and have logged in. -When you log in, you should select the dev space. Instructions can be found [here](https://docs.cloud.service.gov.uk/get_started.html#set-up-the-cloud-foundry-command-line) - -### View logs -To view logs, you will first need to know the service name. `cf a` will list services, but the service name will probably be `eyfs-dev`. - -To view recent logs: - -```cf logs --recent <app_name>``` - -To tail logs (view them as they are generated) - -```cf logs <app_name>``` - -### Get access to the database -You will need to have the `psql` command on your path for this to work. - -The first time you try this, you will need to install the conduit plugin: - -`cf install-plugin conduit` - -You can list the services with `cf s`, but the service name will generally be `eyfs-postgres-dev`. For interactive access, use: - -`cf conduit eyfs-postgres-dev -- psql` - -### Rails console -First, ssh into the host instance - -`cf ssh <app_name>` - -Then, - -`cd /app` - -and finally - -`/usr/local/bin/bundle exec rails console` - -### ssh connect to PaaS - -Make sure you have been added to the PasS services list for the app: - -Which you can do by messaging the channel #digital-tools-support and requesting access - -We are using docker for deployment not a standard build pack - -Install the cloud foundry CLI https://github.com/cloudfoundry/cli/wiki/V7-CLI-Installation-Guide - -On a Mac this is: - -`brew install cloudfoundry/tap/cf-cli@7` - -Connecting to test server - -`cf login` - -and enter the the following: - -- API endpoint: https://api.london.cloud.service.gov.uk -- Email: <youremailaddedtopaas> -- Password: <asecretthing> - -If you have access to multiple spaces, select one to be the target: - -e.g. - -1. eyfs-dev -1. eyfs-pre-prod -1. eyfs-test -1. eyfs-production - -To verify you have targeted the correct space: - -`cf target` - -Ssh connection: - -`cf ssh -i 0 <spacename>` - -To inspect logs - -`cf logs --recent <spacename>` diff --git a/documentation/deployments.md b/documentation/deployments.md deleted file mode 100644 index 93156a35..00000000 --- a/documentation/deployments.md +++ /dev/null @@ -1,134 +0,0 @@ -### Deployment - -Github workflow is used to deploy to environments on Gov.uk PaaS. - -Upon merging a PR to `main` a deployment to the development environment will be triggered. This will: - -1. Checkout the branch -1. Login to Docker Hub -1. Build docker image -1. Upload docker image to Docker Hub -1. Initialise Terraform -1. Run the Terraform plan -1. Apply the Terraform changes - -### PaaS - -Some useful things to know about PaaS... - -GOV.UK Platform as a Service (PaaS) is a cloud-hosting platform built by the Government Digital Service (GDS). GOV.UK PaaS manages the deployment of your apps, services and background tasks so you don’t need to hire people with specialist cloud skills. - -GOV.UK PaaS uses the open source Cloud Foundry project, and runs on Amazon Web Services. - -This repo has an organisation setup on PaaS. Speak to the org manager to authorise the [creation of a personal account](https://docs.cloud.service.gov.uk/get_started.html#get-started) - -The Cloud Coundry CLI can be used to manage apps hosted on PaaS - [Setup Cloud Foundry CLI](https://docs.cloud.service.gov.uk/get_started.html#set-up-the-cloud-foundry-command-line) - -### Environments - -This application runs through four environments: - -- dev -- test -- pre prod -- prod - -`dev` is deployed to automatically when a PR is merged into the `main` branch. - -`test`, `pre prod` and `prod` deployments are triggered manually from the Github workflow tab - -Each environment has a dedicated PaaS user account to run CI/CD jobs using Github workflows. - -To find out the user account details, contact the org manager. - - -### Github Actions - -Actions are standalone commands that are combined into steps to create a job. - -Workflows are made up of one or more jobs and can be scheduled or triggered by an event. The workflow is used to build, test, package, release, and deploy the application. - - -[This repo has the following actions](https://github.com/DFE-Digital/early-years-foundation-reform/actions): - -- Build: This builds the Docker image -- Test: Runs RSpec -- Rubocop: Runs Rubocop -- Deploy to Dev: Automatically triggers the 'Deploy to Environment' workflow when a PR is merged to `main` -- Deploy to Test: Manual deployment trigger. Choose a a branch and that will trigger the 'Deploy to Environment' workflow -- Deploy to Pre Prod: Manual deployment trigger. Choose a a branch and that will trigger the 'Deploy to Environment' workflow -- Deploy to Production: Manual deployment trigger. Choose a a branch and that will trigger the 'Deploy to Environment' workflow -- Deploy to Environment: Triggered by one of the above workflows. This is a generic workflow that accepts a target environment and git ref to checkout the code, build the docker image and deploy to the target environment. - - -### Seed data - -Seed is no longer run (../db/seeds.rb) - -`prod` does not get seeded with data automatically. - -### Environment variables - -The application requires the following environment variables to deploy to an environment: - -- TF_VAR_paas_app_docker_image -- TF_VAR_paas_user -- TF_VAR_paas_password -- AWS_ACCESS_KEY_ID -- AWS_SECRET_ACCESS_KEY - -They are stored in github secrets and consumed by the deploy jobs. - -### Databases - -The application is backed by a [PostgreSQL database hosted on PaaS](https://docs.cloud.service.gov.uk/deploying_services/postgresql/#postgresql). - -The Conduit plugin on Cloud Foundry can be used [to connect to a PostgreSQL database from your local machine](https://docs.cloud.service.gov.uk/deploying_services/postgresql/#connect-to-a-postgresql-service-from-your-local-machine) - -If you don't want to use Conduit, you can [connect to a backing service via an SSH tunnel from your local machine](https://docs.cloud.service.gov.uk/managing_apps.html#connecting-to-a-non-publicly-available-backing-service). You might want to do this is to access the Postgres via a GUI for example. - -### Managing apps - -PaaS hosted applications are run in a container. [Connecting using SSH](https://docs.cloud.service.gov.uk/managing_apps.html#connecting-with-ssh) gives you secure access to the applications container. - -### Some thigns to be aware of... querks - -1. Read only DB mapping to the website (FYI) - -The following command has been run on the CF CLI to restricts the website -app to read only permissions of the Postgres instance - -``` -cf bind-service eyfs-ENV eyfs-postgres-ENV -c '{"read_only": true}' -``` - -This has been set on each environment because it can not be done using Terraform. - -Note: When deploying to a new space or recreating the environment from scratch, this is a required -manual step - - -2. DNS remapping in production - -On deploy to production, the DNS mapping is lost, meaning to the domain will 404. -The the DNS route needs to be remapped to the domain again. -Running the following using CF CLI will set the domain again. - -``` -cf target -s eyfs-prod -cf map-route eyfs-prod education.gov.uk --hostname help-for-early-years-providers -``` - -After deployment to production, this is run as part of the deploy task, no manual intervention required. - -### Documentation cross reference - -Lots of how the infrastructure is created for this project has been made ontop of the shoulders of the Become a teacher team (BAT) -They have more comprehensive documentation that shouldn't be repeated but referenced for completness - -- [BAT Gov.uk PaaS](https://dfedigital.atlassian.net/wiki/spaces/BaT/pages/1905066044/Gov.uk+PaaS) -- [BAT Github Actions](https://dfedigital.atlassian.net/wiki/spaces/BaT/pages/1649672271/Github+Actions) -- [DockerHub](https://dfedigital.atlassian.net/wiki/spaces/BaT/pages/1602650124/DockerHub) -- [DNS](https://dfedigital.atlassian.net/wiki/spaces/BaT/pages/1905262678/DNS) -- [Custom Domain setup](https://dfedigital.atlassian.net/wiki/spaces/BaT/pages/2012938241/Create+a+custom+domain) -- [Terraform](https://dfedigital.atlassian.net/wiki/spaces/BaT/pages/1935179870/Terraform) diff --git a/documentation/manual_backup.md b/documentation/manual_backup.md deleted file mode 100644 index d6be4f61..00000000 --- a/documentation/manual_backup.md +++ /dev/null @@ -1,45 +0,0 @@ -# Manual Backup - -The manual process to get a dump of Postgres is as follows. (The matching process of loading the dump file is covered afterwards) -It assumes - -i) you have a development laptop - -ii) with Cloud Foundary CLI installed - -iii) installed Postgres on this machine so that the pg_dump command is in the path and can be run - -Log in to cloud foundry in a terminal with the cf command and your password - -`cf login` - -Select the eyfs-space - -# The credentials are shown with this. You will need the The USER, PASSWORD and DATABASE_NAME shown by running this - -`cf service-key eyfs-postgres-prod EXTERNAL-ACCESS-KEY` - -# Set up the tunnel. I use port 5436 so I don’t have to stop local Postgres server - -`cf ssh -L 5436:<HOST FROM ABOVE>:5432 eyfs-prod` - -Dump the data to a text file, using USER, PASSWORD and DATABASE_NAME from the service key step above - -`pg_dump --data-only postgres://<USER><PASSWORD>@localhost:5436/DATABASE_NAME > dd-mm-yyyy-prod.sql` - -Note, pg_dump needs to be in the path -Store the file dd-mm-yyyy-prod.sql somewhere. - -# Restoring the backup - -If you only want table data for pages and pictures, you can load the backup into a local database, open it in a desktop client, open another pointing to the production database (using the ssh tunnel) and then cut and paste the records in the GUI. - -Or you can use the psql command line tool to read the whole file and run it. - -Questions - -i) Who will be responsible for doing this ? - -ii) Have they have a got laptop with Postgres and Cloud Foundry ? - -iii) Where will the SQL dumps be stored ? \ No newline at end of file diff --git a/documentation/terraform.md b/documentation/terraform.md deleted file mode 100644 index 7bc11b05..00000000 --- a/documentation/terraform.md +++ /dev/null @@ -1,27 +0,0 @@ -### Terraform setup -Instruction on setting up the Terraform CLI can be found on [their website](https://www.terraform.io/downloads.html) - -### Creating a new Terraform environment -If we want to create a new long term environment, we need to create a new backing store for state. - -We are using S3 buckets created through GovPaaS & Cloudfoundry to store terraform state. -In order to create a new bucket, you need to have the cloudfoundry cli installed and logged in to the GovPaaS account. - -To create a new S3 bucket, run - -```cf create-service aws-s3-bucket default dfe-eyfs-terraform-state-<env>``` - -To create the access key, run - -```cf create-service-key dfe-eyfs-terraform-state-<env> terraform-state-key-<env> -c '{"allow_external_access": true}'``` - -To view the access key: - -```cf service-key dfe-eyfs-terraform-state-<env> terraform-state-key-<env>``` - -You should be able to see the bucket_name, aws_access_key_id and aws_secret_access_key. With these values, run - -```terraform init -backend-config="bucket=<bucket_name>" -backend-config="access_key=<aws_access_key_id>" -backend-config="secret_key=<aws_secret_access_key>"``` - -### Running Terraform apply -```terraform apply --var-file=... -var='secret_paas_app_env_values={"RAILS_MASTER_KEY":"..."}' -var='paas_user=...' -var='paas_password=...' -var='paas_app_docker_image=...'``` \ No newline at end of file diff --git a/e2etests/features/step_definitions/common.rb b/e2etests/features/step_definitions/common.rb index 0df5434d..ea04aa0a 100644 --- a/e2etests/features/step_definitions/common.rb +++ b/e2etests/features/step_definitions/common.rb @@ -3,11 +3,11 @@ end When(/^user proceeds to "([^"]*)" page$/) do |page| - proceed_to(page, "") + proceed_to(page, '') end Then(/^page has heading "([^"]*)"$/) do |page| - check_page_heading("h1", page) + check_page_heading('h1', page) end And(/^page has "([^"]*)" heading "([^"]*)"$/) do |type, page| diff --git a/e2etests/features/support/common.rb b/e2etests/features/support/common.rb index 05231052..2c493c9b 100644 --- a/e2etests/features/support/common.rb +++ b/e2etests/features/support/common.rb @@ -1,31 +1,31 @@ def user_access(user) - env = if user.downcase.index("cms") - ENV["CMS_URL"] + env = if user.downcase.index('cms') + ENV['CMS_URL'] else - ENV["SERVICE_URL"] + ENV['SERVICE_URL'] end open_app(env) end def proceed_to(page, func) link = page - page_name = if func == "" + page_name = if func == '' page.downcase else func.downcase end case page_name - when "landing", "help for early years providers", "7 areas of learning blocks" + when 'landing', 'help for early years providers', '7 areas of learning blocks' list_items(page_name) - when "communication and language", "physical development", "personal, social and emotional development", "literacy", "mathematics", "understanding the world", "expressive arts and design" + when 'communication and language', 'physical development', 'personal, social and emotional development', 'literacy', 'mathematics', 'understanding the world', 'expressive arts and design' click_on link - list_items("learning areas") - when "left-menu sub-areas" + list_items('learning areas') + when 'left-menu sub-areas' click_on link - list_items("sub-areas") - when "mobile menu learning areas", "mobile menu" + list_items('sub-areas') + when 'mobile menu learning areas', 'mobile menu' mobile_menu(link, page_name) - when "add user", "add user details and cancel", "add user, edit and delete", "add user with invalid passwords", "edit user with invalid passwords" + when 'add user', 'add user details and cancel', 'add user, edit and delete', 'add user with invalid passwords', 'edit user with invalid passwords' add_cms_user(page_name) else raise("Case statement required: #{page_name}") @@ -34,10 +34,10 @@ def proceed_to(page, func) def open_app(env) visit(env) - if page.text.match("Log in") - enter("user_email", ENV["USER_ADMIN"]) - enter("user_password", ENV["USER_ADMNP"]) - click_on "commit" + if page.text.match?('Log in') + enter('user_email', ENV['USER_ADMIN']) + enter('user_password', ENV['USER_ADMNP']) + click_on 'commit' end end @@ -63,27 +63,27 @@ def check_page_heading(type, header) def list_items(page_name) case page_name - when "help for early years providers", "7 areas of learning blocks" + when 'help for early years providers', '7 areas of learning blocks' search(HELP_FOR_EARLY_YEARS_PROVIDERS, LI_VALUES) - when "learning areas" + when 'learning areas' search(LEFT_PANE_MENU, LP_LEARNING_AREAS) - when "sub-areas" + when 'sub-areas' search(LEFT_PANE_MENU, LI_VALUES) - when "mobile menu learning areas" + when 'mobile menu learning areas' search(MOBILE_MENU, LP_LEARNING_AREAS) - when "mobile menu" + when 'mobile menu' search(MOBILE_MENU, UL_VALUES) else - @ul = "" + @ul = '' end - if @ul != "" + if @ul != '' @menu = @ul.collect(&:text) end end def check_page_obj(type, tbl) case type.downcase - when "links" + when 'links' expect_links(tbl) else raise ArgumentError, "Argument not known: '#{type}'" @@ -105,7 +105,7 @@ def expect_links(tbl) def clk(obj) case obj.downcase - when "btn" + when 'btn' click_button obj else first(:link, obj, visible: true).click @@ -121,7 +121,7 @@ def search(parameter, values) def process_func(func, table) tbl = table.raw case func - when "displayed" + when 'displayed' tbl.each do |text| display_check(text[0]) end @@ -137,9 +137,9 @@ def display_check(text) def lnk_string(lnk) @lnk = lnk @lnk_count = 1 - if lnk.index("[") - @lnk_count = lnk[lnk.index("[")..lnk.index("]")].gsub("[", "").gsub(" times]", "") - @lnk = lnk[0..lnk.index("[") - 1] + if lnk.index('[') + @lnk_count = lnk[lnk.index('[')..lnk.index(']')].delete('[').gsub(' times]', '') + @lnk = lnk[0..lnk.index('[') - 1] end end @@ -155,13 +155,13 @@ def tab_click(obj, tab_cnt) def check_value(actual, expected) if actual != expected puts "FAIL Expected: '#{actual}' Actual: '#{expected}'" - @excep = "e" + @excep = 'e' end end def check_value_proc(obj, value) - @excep = "" - actual = find(Object.const_get(obj.upcase.gsub!(" ", "_"))).text + @excep = '' + actual = find(Object.const_get(obj.upcase.tr!(' ', '_'))).text check_value(value, actual) exception_call("'#{obj}' #{__method__}") end @@ -169,25 +169,25 @@ def check_value_proc(obj, value) def check_item(pos, desc) if @menu[pos - 1] != desc puts "FAIL Expected: '#{desc}' at position '#{pos}' Actual: '#{@menu[pos - 1]}'" - @excep = "e" + @excep = 'e' end end def check_one_item(list, pos, desc) - @excep = "" + @excep = '' check_item(pos.to_i, desc) exception_call("#{list.downcase} #{__method__}") end def exception_call(called_by) - if @excep != "" + if @excep != '' raise("#{called_by} not as Expected. See 'FAIL(s)'") end end def click_value_proc(obj, value) - find(Object.const_get(obj.upcase.gsub!(" ", "_"))).click - check_page_heading("h1", value) + find(Object.const_get(obj.upcase.tr!(' ', '_'))).click + check_page_heading('h1', value) end def resize_display(width, height) @@ -201,13 +201,13 @@ def click_btn(btn) def add_user_details date_time @user = "A0User#{@time}" - @user_p = "0-Ab0-Ba" - enter_fields({ "user-first-name-field": "Admin", + @user_p = '0-Ab0-Ba' + enter_fields({ "user-first-name-field": 'Admin', "user-last-name-field": @user, "user-email-field": "#{@user}@education.gov.uk", "user-password-field": @user_p, "user-password-confirmation-field": @user_p }) - radio_btn("user-role-admin-field", "false") + radio_btn('user-role-admin-field', 'false') end def date_time @@ -228,22 +228,22 @@ def mobile_menu(link, page_name) end def add_cms_user(page_name) - click_on "Admin" - click_on "Add user" - return unless page_name != "add user" + click_on 'Admin' + click_on 'Add user' + return unless page_name != 'add user' case page_name - when "add user details and cancel" + when 'add user details and cancel' add_user_details - click_on "Cancel" - when "add user, edit and delete" + click_on 'Cancel' + when 'add user, edit and delete' add_user_details - click_on "Save" + click_on 'Save' edit_user delete_user - when "add user with invalid passwords" + when 'add user with invalid passwords' add_user_details - when "edit user with invalid passwords" + when 'edit user with invalid passwords' edit_user_invalid_password else raise("Case statement required: #{page_name}") @@ -265,14 +265,14 @@ def check_fields(obj) end def edit_user - find(:id, "add-user").send_keys(:tab, :enter) - check_page_heading("h1", "Edit user") - check_fields({ "First name": "Admin", + find(:id, 'add-user').send_keys(:tab, :enter) + check_page_heading('h1', 'Edit user') + check_fields({ "First name": 'Admin', "Last name": @user }) end def delete_user - click_on "Delete" + click_on 'Delete' # TODO: refactor sleep sleep 2 alert = page.driver.browser.switch_to.alert @@ -281,8 +281,8 @@ def delete_user end def edit_user_invalid_password - click_on "Cancel" - find(:id, "add-user").send_keys(:tab, :enter) - enter("user-password-field", ENV["USER_ADMNP"]) - click_on "Save" + click_on 'Cancel' + find(:id, 'add-user').send_keys(:tab, :enter) + enter('user-password-field', ENV['USER_ADMNP']) + click_on 'Save' end diff --git a/e2etests/features/support/env.rb b/e2etests/features/support/env.rb index 21c9fa07..e7dcf4a8 100644 --- a/e2etests/features/support/env.rb +++ b/e2etests/features/support/env.rb @@ -1,13 +1,13 @@ # frozen_string_literal:true -require "capybara/cucumber" -require "selenium-webdriver" -require "axe/cucumber/step_definitions" -require "webdrivers/chromedriver" +require 'capybara/cucumber' +require 'selenium-webdriver' +require 'axe/cucumber/step_definitions' +require 'webdrivers/chromedriver' -ENV_URL = "http://help-for-early-years-providers.education.gov.uk/" +ENV_URL = 'http://help-for-early-years-providers.education.gov.uk/' -if ENV["headless"] +if ENV['headless'] Capybara.default_driver = :poltergeist else Capybara.default_driver = :selenium @@ -19,12 +19,12 @@ ATTEMPTS = 5 -HELP_FOR_EARLY_YEARS_PROVIDERS = "#main-content > div.landing-page__section--grey > div > ul" -LI_VALUES = "li" -LEFT_PANE_MENU = "body > div > main > div > div.govuk-grid-column-one-third.desktop-menu" -LP_LEARNING_AREAS = "p" -MENU = "Menu" -MOBILE_MENU = "#mobile-menu-nav" -UL_VALUES = "ul" -PREVIOUS_PAGE = "li.gem-c-pagination__item.gem-c-pagination__item--previous > a > span.gem-c-pagination__link-label" -NEXT_PAGE = "li.gem-c-pagination__item.gem-c-pagination__item--next > a > span.gem-c-pagination__link-label" +HELP_FOR_EARLY_YEARS_PROVIDERS = '#main-content > div.landing-page__section--grey > div > ul' +LI_VALUES = 'li' +LEFT_PANE_MENU = 'body > div > main > div > div.govuk-grid-column-one-third.desktop-menu' +LP_LEARNING_AREAS = 'p' +MENU = 'Menu' +MOBILE_MENU = '#mobile-menu-nav' +UL_VALUES = 'ul' +PREVIOUS_PAGE = 'li.gem-c-pagination__item.gem-c-pagination__item--previous > a > span.gem-c-pagination__link-label' +NEXT_PAGE = 'li.gem-c-pagination__item.gem-c-pagination__item--next > a > span.gem-c-pagination__link-label' diff --git a/e2etests/features/support/hooks.rb b/e2etests/features/support/hooks.rb index 6a71d47a..4044bc56 100644 --- a/e2etests/features/support/hooks.rb +++ b/e2etests/features/support/hooks.rb @@ -1,11 +1,11 @@ # frozen_string_literal:true After do |scenario| - if scenario.name.downcase.include?("accessibility") - puts "" - puts "- - - - - - - - - - - - -" + if scenario.name.downcase.include?('accessibility') + puts '' + puts '- - - - - - - - - - - - -' puts "Scenario: #{scenario.name}" steps %(Then the page should be accessible) - puts "- - - - - - - - - - - - -" + puts '- - - - - - - - - - - - -' end end diff --git a/lib/rack/reject_trace.rb b/lib/rack/reject_trace.rb index f10da4d8..e57b514c 100644 --- a/lib/rack/reject_trace.rb +++ b/lib/rack/reject_trace.rb @@ -7,7 +7,7 @@ def initialize(app) end def call(env) - return @app.call(env) unless env["REQUEST_METHOD"] == "TRACE" + return @app.call(env) unless env['REQUEST_METHOD'] == 'TRACE' [405, {}, []] end diff --git a/lib/tasks/govuk_lint.rake b/lib/tasks/govuk_lint.rake index 6b987ec7..cda26dca 100644 --- a/lib/tasks/govuk_lint.rake +++ b/lib/tasks/govuk_lint.rake @@ -1,14 +1,14 @@ -desc "Lint ruby code" +desc 'Lint ruby code' namespace :lint do - desc "Lint Ruby with Rubocop" + desc 'Lint Ruby with Rubocop' task ruby: :environment do - puts "Linting ruby..." - system "bundle exec rubocop --format clang -a" + puts 'Linting ruby...' + system 'bundle exec rubocop --format clang -a' end - desc "Lint SCSS with scss_lint" + desc 'Lint SCSS with scss_lint' task scss: :environment do - puts "Linting scss..." - system "bundle exec scss-lint app/webpacker/styles" + puts 'Linting scss...' + system 'bundle exec scss-lint app/webpacker/styles' end end diff --git a/lib/tasks/load.rake b/lib/tasks/load.rake index d3dfd437..fc191eb7 100644 --- a/lib/tasks/load.rake +++ b/lib/tasks/load.rake @@ -1,13 +1,13 @@ -desc "Load new content to database" +desc 'Load new content to database' namespace :load do - desc "Safeguarding and welfare" + desc 'Safeguarding and welfare' task safeguarding: :environment do |_, _args| - attrs = I18n.t("content.safeguarding") + attrs = I18n.t('content.safeguarding') ContentPage.new(attrs) do |parent_page| puts "Update #{parent_page.inspect}" parent_page.save! puts "Updated #{parent_page.reload.inspect}" - { oral_health: "Oral health", food_safety: "Food safety" }.each do |key, title| + { oral_health: 'Oral health', food_safety: 'Food safety' }.each do |key, title| ContentPage.new(title: title, parent_id: parent_page.id) do |child_page| attrs = I18n.t("content.#{key}") puts "Update #{child_page.inspect}" @@ -20,7 +20,7 @@ namespace :load do end end - desc "Load content blocks" + desc 'Load content blocks' task blocks: :environment do |_, _args| %w[landing_page_introduction other_useful_resources child_development_training].each do |content_block_name| unless ContentBlock.exists?(name: content_block_name) diff --git a/lib/upload.rb b/lib/upload.rb index 8a8ea9ab..44dd6a88 100644 --- a/lib/upload.rb +++ b/lib/upload.rb @@ -7,7 +7,7 @@ class Upload extend Dry::Initializer - FEATURED_PAGE_TITLES = ["Get help to improve your practice", "Safeguarding and welfare"].freeze + FEATURED_PAGE_TITLES = ['Get help to improve your practice', 'Safeguarding and welfare'].freeze option :config, default: proc { ContentfulRails.configuration } option :client, default: proc { Contentful::Management::Client.new(config.management_token) } diff --git a/package.json b/package.json index e9050ba7..26b5aecb 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,7 @@ "packageManager": "yarn@4.0.2", "scripts": { "build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets", - "build:css": "npm-run-all --parallel \"build:css:* {@}\" --", - "build:css:beta": "sass ./app/assets/stylesheets/application.sass.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules", - "build:css:dfe": "sass ./app/assets/stylesheets/main.sass.scss:./app/assets/builds/main.css --no-source-map --load-path=node_modules", + "build:css": "sass ./app/assets/stylesheets/application.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules --quiet-deps", "preinstall": "mkdir -p app/assets/builds", "postinstall": "cp -R node_modules/govuk-frontend/govuk/assets/fonts/. app/assets/builds/fonts && cp -R node_modules/govuk-frontend/govuk/assets/images/. app/assets/builds/images" }, diff --git a/script/cucumber b/script/cucumber deleted file mode 100755 index 51b721ca..00000000 --- a/script/cucumber +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby - -vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first -if vendored_cucumber_bin - load File.expand_path(vendored_cucumber_bin) -else - require "rubygems" unless ENV["NO_RUBYGEMS"] - require "cucumber" - load Cucumber::BINARY -end diff --git a/script/network-policies b/script/network-policies deleted file mode 100755 index 771cd6a5..00000000 --- a/script/network-policies +++ /dev/null @@ -1,6 +0,0 @@ -cf target -s eyfs-dev -cf add-network-policy eyfs-cms-dev eyfs-clamav-rest-private -s eyfs-prod --protocol tcp --port 9000 -#cf add-network-policy eyfs-cms-review-pr-478 eyfs-clamav-rest-private -s eyfs-prod --protocol tcp --port 9000 -cf target -s eyfs-pre-prod -cf add-network-policy eyfs-cms-preprod eyfs-clamav-rest-private -s eyfs-prod --protocol tcp --port 9000 - diff --git a/spec/components/footer_component_spec.rb b/spec/components/footer_component_spec.rb index c8ee2c68..00776828 100644 --- a/spec/components/footer_component_spec.rb +++ b/spec/components/footer_component_spec.rb @@ -1,65 +1,65 @@ # frozen_string_literal: true -require "rails_helper" +require 'rails_helper' RSpec.xdescribe FooterComponent, type: :component do - let(:footer_meta) { "div.govuk-footer__meta" } - let(:footer_navigation) { "div.govuk-footer__navigation" } + let(:footer_meta) { 'div.govuk-footer__meta' } + let(:footer_navigation) { 'div.govuk-footer__navigation' } - context "with no items" do - it "renders no navigation section" do + context 'with no items' do + it 'renders no navigation section' do expect( render_inline(described_class.new), ).not_to have_selector(footer_navigation) end - it "renders the rest of the footer" do + it 'renders the rest of the footer' do expect( render_inline(described_class.new), ).to have_selector(footer_meta) end end - context "with one item" do + context 'with one item' do before do render_inline( described_class.new( items: [ - { text: "First navigation item", href: "#" }, + { text: 'First navigation item', href: '#' }, ], ), ) end - context "when looking at the navigation list" do + context 'when looking at the navigation list' do subject(:navigation_list) { page.find("#{footer_navigation} ul.govuk-footer__list") } - it "renders one item" do - expect(navigation_list).to have_selector("li.govuk-footer__list-item", count: 1) - expect(navigation_list).to have_selector("li.govuk-footer__list-item:nth-child(1) a[href='#']", text: "First navigation item") + it 'renders one item' do + expect(navigation_list).to have_selector('li.govuk-footer__list-item', count: 1) + expect(navigation_list).to have_selector("li.govuk-footer__list-item:nth-child(1) a[href='#']", text: 'First navigation item') end end end - context "with multiple items" do + context 'with multiple items' do before do render_inline( described_class.new( items: [ - { text: "First navigation item", href: "#" }, - { text: "Second navigation item", href: "#" }, + { text: 'First navigation item', href: '#' }, + { text: 'Second navigation item', href: '#' }, ], ), ) end - context "when looking at the navigation list" do + context 'when looking at the navigation list' do subject(:navigation_list) { page.find("#{footer_navigation} ul.govuk-footer__list") } - it "renders multiple items" do - expect(navigation_list).to have_selector("li.govuk-footer__list-item", count: 2) - expect(navigation_list).to have_selector("li.govuk-footer__list-item:nth-child(1) a[href='#']", text: "First navigation item") - expect(navigation_list).to have_selector("li.govuk-footer__list-item:nth-child(2) a[href='#']", text: "Second navigation item") + it 'renders multiple items' do + expect(navigation_list).to have_selector('li.govuk-footer__list-item', count: 2) + expect(navigation_list).to have_selector("li.govuk-footer__list-item:nth-child(1) a[href='#']", text: 'First navigation item') + expect(navigation_list).to have_selector("li.govuk-footer__list-item:nth-child(2) a[href='#']", text: 'Second navigation item') end end end diff --git a/spec/controllers/errors_controller_spec.rb b/spec/controllers/errors_controller_spec.rb index 9053befd..30625a47 100644 --- a/spec/controllers/errors_controller_spec.rb +++ b/spec/controllers/errors_controller_spec.rb @@ -1,29 +1,29 @@ -require "rails_helper" +require 'rails_helper' RSpec.describe ErrorsController, type: :controller do - describe "GET #not_found" do - it "returns not found" do + describe 'GET #not_found' do + it 'returns not found' do get :not_found expect(response).to have_http_status(:not_found) end end - describe "GET #internal_server_error" do - it "returns internal_server_error" do + describe 'GET #internal_server_error' do + it 'returns internal_server_error' do get :internal_server_error expect(response).to have_http_status(:internal_server_error) end end - describe "GET #unprocessable_entity" do - it "returns unprocessable_entity" do + describe 'GET #unprocessable_entity' do + it 'returns unprocessable_entity' do get :unprocessable_entity expect(response).to have_http_status(:unprocessable_entity) end end - describe "GET #service_unavailable" do - it "returns service_unavailable" do + describe 'GET #service_unavailable' do + it 'returns service_unavailable' do get :service_unavailable expect(response).to have_http_status(:service_unavailable) end diff --git a/spec/factories/content_blocks.rb b/spec/factories/content_blocks.rb deleted file mode 100644 index 1681d809..00000000 --- a/spec/factories/content_blocks.rb +++ /dev/null @@ -1,10 +0,0 @@ -# spec/factories/content_blocks.rb -require "faker" - -FactoryBot.define do - factory :content_block do - name { Faker::Lorem.word } - description { Faker::Lorem.sentence(word_count: 10).to_s } - markdown { "Fake title - #{Faker::Lorem.word}" } - end -end diff --git a/spec/factories/content_page_versions.rb b/spec/factories/content_page_versions.rb deleted file mode 100644 index 0343195a..00000000 --- a/spec/factories/content_page_versions.rb +++ /dev/null @@ -1,14 +0,0 @@ -FactoryBot.define do - factory :content_page_version do - content_page # Note that another content page version will be created on creating this content page - title { Faker::Commerce.product_name } - content_list { Faker::Lorem.paragraph } - markdown { Faker::Lorem.paragraph } - author { Faker::Name.name } - description { Faker::Lorem.paragraph } - end - - trait :content_list_empty do - content_list { nil } - end -end diff --git a/spec/factories/content_pages.rb b/spec/factories/content_pages.rb deleted file mode 100644 index 200873c5..00000000 --- a/spec/factories/content_pages.rb +++ /dev/null @@ -1,59 +0,0 @@ -# spec/factories/content_pages.rb - -require "faker" - -def sentence_without_puncutation - "#{Faker::Lorem.words(number: 4).join(' ')}#{rand(1000)}" -end - -FactoryBot.define do - factory :content_page do - title { sentence_without_puncutation } - intro { Faker::Lorem.paragraph } - content_list { Faker::Lorem.paragraph } - markdown { "# Fake title - #{Faker::Lorem.word}" } - parent_id { nil } - position { ContentPage.maximum("position").nil? ? 1 : ContentPage.maximum("position") + 1 } - description { Faker::Lorem.paragraph } - end - - trait :with_special_chars_in_title do - title { "#{Faker::Lorem.sentence(word_count: 4)}$" } - end - - trait :published do - is_published { true } - end - - trait :top_level do - parent_id { nil } - end - - trait :hyphen_in_title do - title { "#{Faker::Lorem.word}-#{Faker::Lorem.word}" } - end - - trait :comma_in_title do - title { "#{Faker::Lorem.word},#{Faker::Lorem.word}" } - end - - trait :colon_in_title do - title { "#{Faker::Lorem.word}:#{Faker::Lorem.word}" } - end - - trait :round_braces_in_title do - title { "#{Faker::Lorem.word}(#{Faker::Lorem.word})" } - end - - trait :two_hyphens_and_a_space_in_title do - title { "#{Faker::Lorem.word}-#{Faker::Lorem.word} #{Faker::Lorem.word}-#{Faker::Lorem.word}" } - end - - trait :invalid_title do - title { "Invalid!" } - end - - trait :content_list_nil do - content_list { nil } - end -end diff --git a/spec/factories/user.rb b/spec/factories/user.rb index a6014c10..cd731811 100644 --- a/spec/factories/user.rb +++ b/spec/factories/user.rb @@ -1,23 +1,23 @@ -require "faker" +require 'faker' FactoryBot.define do factory :user do - email { [Faker::Internet.user_name, %w[@digital.education.gov.uk @education.gov.uk].sample].join("") } - password { "TestPassword!@12345" } - role { "reader" } + email { [Faker::Internet.user_name, %w[@digital.education.gov.uk @education.gov.uk].sample].join('') } + password { 'TestPassword!@12345' } + role { 'reader' } first_name { Faker::Name.first_name } last_name { Faker::Name.last_name } factory :admin do - role { "admin" } + role { 'admin' } end factory :editor do - role { "editor" } + role { 'editor' } end factory :reader do - role { "reader" } + role { 'reader' } end end end diff --git a/spec/features/admin/user_admin_page_spec.rb b/spec/features/admin/user_admin_page_spec.rb deleted file mode 100644 index 87a641ea..00000000 --- a/spec/features/admin/user_admin_page_spec.rb +++ /dev/null @@ -1,76 +0,0 @@ -require "rails_helper" - -RSpec.describe "User administration", type: :feature do - before do - create :admin, first_name: "Barbara", last_name: "Gordon", email: "birdsofprey@education.gov.uk" - create :editor, first_name: "Perry", last_name: "White", email: "pwhite@education.gov.uk" - create :editor, first_name: "J Jonah", last_name: "Jameson", email: "jjj@education.gov.uk" - end - - context "without session" do - scenario "go to user administration page" do - visit "/admin" - expect(current_path).to eq("/users/sign_in") - end - end - - context "with session" do - let(:barbara) { User.find_by(email: "birdsofprey@education.gov.uk") } - scenario "visits admin root" do - login_as(barbara) - visit "/admin" - expect(current_path).to eq(admin_root_path) - active_nav = page.find_by_id("navigation").first("li.govuk-header__navigation-item--active") - title = page.find("h1") - expect(active_nav).to have_css("a[href='/admin/users']", visible: true, text: "Admin") - expect(title).to have_text("User administration") - - expect(page).to have_link(href: "/admin/users/new", visible: true, text: "Add user") - - expect(page).to have_css("th", text: "Name") - expect(page).to have_css("th", text: "Email") - expect(page).to have_css("th", text: "Role (CMS)") - - expect(page).to have_css("td", text: "Barbara Gordon") - expect(page).to have_css("td", text: "Perry White") - expect(page).to have_css("td", text: "J Jonah Jameson") - end - - scenario "a user with admin role should not be able to assign herself to another role" do - login_as(barbara) - visit edit_admin_user_path(barbara) - - expect(page).to have_text("Your role is admin and you cannot change it") - end - - scenario "An admin user should not be able to create a new user without providing a first name" do - login_as(barbara) - visit new_admin_user_path(barbara) - - fill_in "user-last-name-field", with: Faker::Name.last_name - fill_in "user-password-field", with: "WordyWord2021%%" - fill_in "user-password-confirmation-field", with: "WordyWord2021%%" - choose("user-role-editor-field", visible: false) - fill_in "user-email-field", with: "buzzard@education.gov.uk" - - click_button "Save" - - expect(page).to have_text("First name must not be blank") - end - - scenario "An admin user should not be able to create a new user without providing a last name" do - login_as(barbara) - visit new_admin_user_path(barbara) - - fill_in "user-first-name-field", with: Faker::Name.first_name - fill_in "user-password-field", with: "WordyWord2021%%" - fill_in "user-password-confirmation-field", with: "WordyWord2021%%" - choose("user-role-editor-field", visible: false) - fill_in "user-email-field", with: "moggy@education.gov.uk" - - click_button "Save" - - expect(page).to have_text("Last name must not be blank") - end - end -end diff --git a/spec/features/admin_content_pages_spec.rb b/spec/features/admin_content_pages_spec.rb deleted file mode 100644 index f4435494..00000000 --- a/spec/features/admin_content_pages_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require "rails_helper" - -RSpec.feature "Admin Content Pages", type: :feature do - context "without session" do - scenario "go to content pages page" do - visit admin_content_pages_path - expect(current_path).to eq("/users/sign_in") - end - end - - context "with session" do - scenario "should get index page" do - login_as(FactoryBot.create(:user)) - visit admin_content_pages_path - expect(current_path).to eq(admin_content_pages_path) - end - scenario "with logout button visible" do - pending 'update to turbo-rails for devise' - login_as(FactoryBot.create(:user)) - visit admin_content_pages_path - expect(page).to have_css("a[href='/users/sign_out']", visible: true) - find("a[href='/users/sign_out']").click - expect(current_path).to eq("/users/sign_in") - end - end -end diff --git a/spec/features/content_block_spec.rb b/spec/features/content_block_spec.rb deleted file mode 100644 index ba379540..00000000 --- a/spec/features/content_block_spec.rb +++ /dev/null @@ -1,89 +0,0 @@ -require "rails_helper" - -RSpec.feature "View content blocks", type: :feature do - let(:valid_attributes) do - FactoryBot.attributes_for(:content_block) - end - - describe "A user with role of Admin can " do - scenario "Navigate to the Content Blocks admin page" do - sign_in FactoryBot.create(:user, role: User::ADMIN) - block = FactoryBot.create(:content_block) - visit admin_content_blocks_path - - expect(page).to have_text("Blocks") - expect(page).to have_text(block.description) - end - - scenario "The content block index page should not have any accessibility errors" do - sign_in FactoryBot.create(:user, role: User::ADMIN) - visit admin_content_blocks_path - - expect(page).to be_axe_clean - end - - scenario "An admin user can change the markdown and description of an existing content block" do - sign_in FactoryBot.create(:user, role: User::ADMIN) - block1 = FactoryBot.create(:content_block) - - visit edit_admin_content_block_path(block1) - page.find_field("content_block[markdown]").set("Brand new markdown") - page.find_field("content_block[description]").set("A new description") - - page.click_button("Save") - - changed_block = ContentBlock.find block1.id - - expect(changed_block.markdown).to include("Brand new markdown") - expect(changed_block.description).to include("A new description") - end - - scenario "An admin user can create a content block" do - sign_in FactoryBot.create(:user, role: User::ADMIN) - - visit new_admin_content_block_path - page.find_field("content_block[name]").set(valid_attributes[:name]) - page.find_field("content_block[description]").set(valid_attributes[:description]) - page.find_field("content_block[markdown]").set(valid_attributes[:markdown]) - - page.click_button("Save") - - changed_block = ContentBlock.find_by_name valid_attributes[:name] - - expect(changed_block.markdown).to include(valid_attributes[:markdown]) - end - - scenario "An admin user cannot change the name of an existing content block" do - pending "Intermittently failing !" - - sign_in FactoryBot.create(:user, role: User::ADMIN) - block1 = FactoryBot.create(:content_block) - - visit edit_admin_content_block_path(block1) - - expect(page.find_field("content-block-name-field", visible: :all).value).to eq(block1.name) - end - - scenario "The Accessibility page can be produced using a Content Block called 'accessibility'" do - sign_in FactoryBot.create(:user, role: User::ADMIN) - - ContentBlock.destroy_all - ContentBlock.create!(name: "accessibility", - description: "For the accessibility page", - markdown: valid_attributes[:markdown]) - - visit("accessibility-statement") - - expect(page.body).to include(valid_attributes[:markdown]) - end - end - - describe "editors cannot access Content Block functionality" do - scenario "The Blocks menu is hidden from editors" do - sign_in FactoryBot.create(:user, role: User::EDITOR) - - # This does throw the exception, but puma catches it - # expect { visit "cms/blocks" }.to raise_error( Pundit::NotAuthorizedError ) - end - end -end diff --git a/spec/features/content_page_versions_spec.rb b/spec/features/content_page_versions_spec.rb deleted file mode 100644 index 1229abbb..00000000 --- a/spec/features/content_page_versions_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require "rails_helper" - -RSpec.feature "View pages", type: :feature do - before do - skip 'WIP' if Rails.application.cms? - end - - given(:parent_page) { FactoryBot.create(:content_page, :published, :top_level) } - given(:content_page_version) { FactoryBot.create(:content_page_version) } - - scenario "Navigate to a preview of draft page and check that 2 print buttons are rendered on the page" do - sign_in FactoryBot.create(:user) - visit "/admin/pages/#{parent_page.id}/content_page_versions/#{content_page_version.id}/preview_of_draft" - page.find("p", text: "Contents", id: "contents-list-heading") - - expect(page.body).to have_button("Print this page").twice - end - - scenario "Navigate to a preview of draft page and check that 1 print button is on the page" do - page_version = FactoryBot.create(:content_page_version, :content_list_empty) - sign_in FactoryBot.create(:user) - visit "/admin/pages/#{parent_page.id}/content_page_versions/#{page_version.id}/preview_of_draft" - - expect(page.body).to have_button("Print this page").once - end -end diff --git a/spec/features/content_pages_spec.rb b/spec/features/content_pages_spec.rb deleted file mode 100644 index 4ef3d000..00000000 --- a/spec/features/content_pages_spec.rb +++ /dev/null @@ -1,140 +0,0 @@ -require "rails_helper" - -RSpec.feature "View pages", type: :feature do - before { skip 'WIP' if Rails.application.cms? } - - given(:parent_page) { FactoryBot.create(:content_page, :published, :top_level) } - given(:child_page) { FactoryBot.create(:content_page, :published, parent_id: parent_page.id) } - given(:content_page_version) { FactoryBot.create(:content_page_version) } - - scenario "Navigate to Content Pages" do - sign_in FactoryBot.create(:user) - visit "/admin/pages" - - expect(page).to have_text("Pages") - end - - scenario "The CMS index page should not have any accessibility errors" do - sign_in FactoryBot.create(:user) - visit "/admin/pages" - - expect(page).to be_axe_clean - end - - scenario "Navigate to a top level page and see the title can't be edited" do - sign_in FactoryBot.create(:user) - visit "/admin/pages/#{parent_page.id}/edit" - page.find_field("content_page[title]", disabled: true) - end - - scenario "Navigate to a child page and see the title can be edited" do - sign_in FactoryBot.create(:user) - visit "/admin/pages/#{child_page.id}/edit" - - page.find_field("content_page[title]", disabled: false) - end - - scenario "Navigate to a child page and see the intro can be edited" do - sign_in FactoryBot.create(:user) - visit "/admin/pages/#{child_page.id}/edit" - - page.find_field("content_page[intro]", disabled: false) - end - - scenario "The CMS edit page should not have any accessibility errors" do - sign_in FactoryBot.create(:user) - visit "/admin/pages/#{parent_page.id}/edit" - - expect(page).to be_axe_clean - end - - scenario "A user with the role of editor should be able to edit pages in the CMS" do - sign_in FactoryBot.create(:user, :editor) - - visit "/admin/pages/#{child_page.id}/edit" - - page.find_field("content_page[markdown]").set("some text") - - page.click_button("Save") - saved_page = ContentPage.find child_page.id - expect(saved_page.content_page_versions.last.markdown).to eq("some text") - end - - scenario "A user with the role of reader should not be able to edit pages in the CMS" do - sign_in FactoryBot.create(:user, :reader) - attributes = FactoryBot.attributes_for :content_page - - visit "/admin/pages/#{child_page.id}/edit" - - page.find_field("content_page[title]").set(attributes[:title]) - page.find_field("content_page[markdown]").set(attributes[:markdown]) - page.find_field("content_page[position]").set(rand(10_000)) - - page.click_button("Save") - - expect(page.body).to include("You don't have permission to change pages") - end - - describe "A user with the role of editor should be able to create pages in the CMS" do - it "should be able to create pages in the CMS" do - sign_in FactoryBot.create(:user, :editor) - attributes = FactoryBot.attributes_for :content_page - - visit "/admin/pages/new?parent_id=#{parent_page.id}" - - page.find_field("content_page[title]").set(attributes[:title]) - page.find_field("content_page[intro]").set(attributes[:intro]) - page.find_field("content_page[content_list]").set(attributes[:content_list]) - page.find_field("content_page[markdown]").set(attributes[:markdown]) - page.find_field("content_page[position]").set(rand(10_000)) - page.find_field("content_page[description]").set(attributes[:description]) - - page.click_button("Save") - - saved_page = ContentPage.find_by_title attributes[:title] - - expect(saved_page.markdown).to eq(attributes[:markdown]) - expect(saved_page.content_list).to eq(attributes[:content_list]) - expect(saved_page.description).to eq(attributes[:description]) - end - end - - scenario "The CMS create page page should not have any accessibility errors" do - sign_in FactoryBot.create(:editor) - - visit "/admin/pages/new?parent_id=#{child_page.id}" - - expect(page).to be_axe_clean - end - - scenario "A user with the role of reader should NOT be able to create pages in the CMS" do - sign_in FactoryBot.create(:reader) - attributes = FactoryBot.attributes_for :content_page - - visit "/admin/pages/new?parent_id=#{child_page.id}" - - page.find_field("content_page[title]").set(attributes[:title]) - page.find_field("content_page[content_list]").set(attributes[:content_list]) - page.find_field("content_page[markdown]").set(attributes[:markdown]) - page.find_field("content_page[position]").set(rand(10_000)) - page.click_button("Save") - - expect(page.body).to include("You don't have permission to create pages") - end - - scenario "Navigate to a preview of live page and check that 2 print buttons are rendered on the page" do - sign_in FactoryBot.create(:user) - visit "/admin/pages/#{child_page.id}/preview_of_live" - page.find("p", text: "Contents", id: "contents-list-heading") - - expect(page.body).to have_button("Print this page").twice - end - - scenario "Navigate to a preview of live page and check that 1 print button is on the page" do - content_page = FactoryBot.create(:content_page, :published, :top_level, :content_list_nil) - sign_in FactoryBot.create(:user) - visit "/admin/pages/#{content_page.id}/preview_of_live" - - expect(page.body).to have_button("Print this page").once - end -end diff --git a/spec/features/content_spec.rb b/spec/features/content_spec.rb deleted file mode 100644 index eed225c9..00000000 --- a/spec/features/content_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -require "rails_helper" - -RSpec.feature "Public Content", type: :feature do - before do - skip 'WIP' if Rails.application.cms? - end - - given(:parent_page) { FactoryBot.create(:content_page, :published, :top_level) } - given(:child_page) { FactoryBot.create(:content_page, :published, parent_id: parent_page.id) } - - scenario "Navigate to the landing page" do - sign_in FactoryBot.create(:user) - visit "/" - - expect(page).to be_axe_clean - end - - scenario "Navigate to a top level page" do - sign_in FactoryBot.create(:user) - visit "/#{parent_page.slug}" - - expect(page).to be_axe_clean - end - - scenario "Navigate to a child page" do - sign_in FactoryBot.create(:user) - visit "/#{parent_page.slug}/#{child_page.slug}" - - expect(page).to be_axe_clean - end -end diff --git a/spec/features/drafting_and_publishing_spec.rb b/spec/features/drafting_and_publishing_spec.rb deleted file mode 100644 index ed0e0c3f..00000000 --- a/spec/features/drafting_and_publishing_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require "rails_helper" - -RSpec.feature "Drafting and publishing pages", type: :feature do - describe "The life cycle of a page" do - it "should create a new page as an unpublished draft" do - sign_in FactoryBot.create(:user, :editor) - attributes = FactoryBot.attributes_for :content_page - parent_page = FactoryBot.create(:content_page, :top_level) - - visit "/admin/pages/new?parent_id=#{parent_page.id}" - - page.find_field("content_page[title]").set(attributes[:title]) - page.find_field("content_page[content_list]").set(attributes[:content_list]) - page.find_field("content_page[markdown]").set(attributes[:markdown]) - page.find_field("content_page[position]").set(rand(10_000)) - - page.click_button("Save") - - saved_page = ContentPage.find_by_title attributes[:title] - - expect(saved_page.title).to eq(attributes[:title]) - expect(saved_page.is_published).to eq(false) - expect(saved_page.content_page_versions.count).to eq(1) - end - end -end diff --git a/spec/features/feedback_spec.rb b/spec/features/feedback_spec.rb deleted file mode 100644 index f927db94..00000000 --- a/spec/features/feedback_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -require "rails_helper" - -RSpec.feature "Feedback", type: :feature do - before do - skip 'WIP' if Rails.application.cms? - end - - scenario "Page with feedback options" do - visit "/" - - expect(page).to have_text("Is this page useful?") - expect(page).to be_axe_clean - end - - scenario "User gives positive feedback" do - visit "/" - - within "#feedback" do - page.click_button("Yes") - end - expect(page).not_to have_text("Is this page useful?") - expect(page).to have_text("Thank you for your feedback") - expect(page).to be_axe_clean - end - - scenario "User gives negative feedback and closes dialogue" do - visit "/" - - within "#feedback" do - page.click_button("No") - end - expect(page).not_to have_text("Is this page useful?") - expect(page).to have_text("Help us improve Help for early years providers") - expect(page).to be_axe_clean - - within "#feedback" do - page.click_button("Close") - end - - expect(page).to have_text("Is this page useful?") - end -end diff --git a/spec/fixtures/files/sample.jpeg b/spec/fixtures/files/sample.jpeg deleted file mode 100644 index fe678e93..00000000 Binary files a/spec/fixtures/files/sample.jpeg and /dev/null differ diff --git a/spec/fixtures/files/sample.txt b/spec/fixtures/files/sample.txt deleted file mode 100644 index 42c774d0..00000000 --- a/spec/fixtures/files/sample.txt +++ /dev/null @@ -1,2 +0,0 @@ -The Department for Education is responsible for children’s services and education, including early years, schools, -higher and further education policy, apprenticeships and wider skills in England. diff --git a/spec/helpers/content_helper_spec.rb b/spec/helpers/content_helper_spec.rb index 473b4387..7a712041 100644 --- a/spec/helpers/content_helper_spec.rb +++ b/spec/helpers/content_helper_spec.rb @@ -1,20 +1,12 @@ -require "rails_helper" - -# Specs in this file have access to a helper object that includes -# the ContentHelper. +require 'rails_helper' RSpec.describe ContentHelper, type: :helper do - let(:child) do - parent = FactoryBot.create(:content_page) - FactoryBot.create(:content_page, parent_id: parent.id) - end - - describe "paths for content" do - it "returns the correct path for a top level page" do + xdescribe 'paths for content' do + it 'returns the correct path for a top level page' do expect(path_for_this_page(child.parent)).to eq("/#{child.parent.slug}") end - it "returns the correct path for a child level page" do + it 'returns the correct path for a child level page' do expect(path_for_this_page(child)).to eq("/#{child.parent.slug}/#{child.slug}") end end diff --git a/spec/lib/rack/reject_trace_spec.rb b/spec/lib/rack/reject_trace_spec.rb index de28b9d1..81eb5e64 100644 --- a/spec/lib/rack/reject_trace_spec.rb +++ b/spec/lib/rack/reject_trace_spec.rb @@ -1,20 +1,20 @@ -require "rails_helper" +require 'rails_helper' RSpec.describe Rack::RejectTrace do - describe "#call" do - let(:app) { double("app") } + describe '#call' do + let(:app) { double('app') } let(:env) { {} } let(:reject_trace) { described_class.new(app) } - it "calls app" do + it 'calls app' do expect(app).to receive(:call).with(env).and_return(true) expect(reject_trace.call(env)).to be(true) end - context "when request method trace" do - let(:env) { { "REQUEST_METHOD" => "TRACE" } } + context 'when request method trace' do + let(:env) { { 'REQUEST_METHOD' => 'TRACE' } } - it "returns set values" do + it 'returns set values' do expect(app).not_to receive(:call) expect(reject_trace.call(env)).to eq([405, {}, []]) end diff --git a/spec/models/content_page_spec.rb b/spec/models/content_page_spec.rb deleted file mode 100644 index bd15af57..00000000 --- a/spec/models/content_page_spec.rb +++ /dev/null @@ -1,131 +0,0 @@ -require "rails_helper" - -RSpec.describe ContentPage, type: :model do - let(:expected_exception_message) do - /#{ContentPage::TITLE_FORMAT_ERROR_MESSAGE}/ - end - - it "only allows alphanumeric and spaces in the title" do - attributes_for_page = FactoryBot.attributes_for(:content_page, :with_special_chars_in_title) - - page = ContentPage.new(attributes_for_page) - expect { page.save! }.to raise_exception(expected_exception_message) - end - - it "sets the slug from the title, converting spaces to hyphens" do - page = FactoryBot.create(:content_page) - - expect { page.save! }.to_not raise_error - end - - it "sets the slug from the title, removing commas" do - page = FactoryBot.create(:content_page, :comma_in_title) - - expect { page.save! }.to_not raise_error - end - - it "sets the slug from the title, removing round braces" do - page = FactoryBot.create(:content_page, :round_braces_in_title) - - expect { page.save! }.to_not raise_error - end - - it "sets the slug from the title, removing colons" do - page = FactoryBot.create(:content_page, :colon_in_title) - - expect { page.save! }.to_not raise_error - - saved_page = ContentPage.find_by_title page.title - expect(saved_page.slug.count(":")).to be(0) - expect(saved_page.title.count(":")).to be(1) - end - - it "sets the slug from the title, preserving hyphens" do - page = FactoryBot.create(:content_page, :two_hyphens_and_a_space_in_title) - - expect { page.save! }.to_not raise_error - - saved_page = ContentPage.find_by_title page.title - expect(saved_page.slug.count("-")).to be(3) - expect(saved_page.title.count("-")).to be(2) - end - - it "Generates the correct full path for a top level ContentPage" do - parent = FactoryBot.create(:content_page, title: "An Expected Title") - - expect(parent.full_path).to eq("/an-expected-title") - end - - it "Generates the correct full path for a child ContentPage" do - parent = FactoryBot.create(:content_page) - child = FactoryBot.create(:content_page, parent_id: parent.id) - - expect(child.full_path).to eq("/#{parent.slug}/#{child.slug}") - end - - # The order is a depth first search - context "Next and Previous pages" do - before(:each) do - ContentPage.destroy_all # Otherwise the pages created above spoil this test - - @top_level1 = FactoryBot.create(:content_page, :published, title: "TL1", position: 1) - @top_level2 = FactoryBot.create(:content_page, :published, title: "TL2", position: 10) - - @child1_of_top_level1 = FactoryBot.create(:content_page, :published, title: "C1TL1", position: 1, parent_id: @top_level1.id) - @child2_of_top_level1 = FactoryBot.create(:content_page, :published, title: "C2TL1", position: 2, parent_id: @top_level1.id) - - @child1_of_top_level2 = FactoryBot.create(:content_page, :published, title: "C1TL2", position: 1, parent_id: @top_level2.id) - @child2_of_top_level2 = FactoryBot.create(:content_page, :published, title: "C2TL2", position: 2, parent_id: @top_level2.id) - - # The reordering happens after_create, so need to refetch these - # to get their updated next/previous state - @top_level1 = ContentPage.find @top_level1.id - @top_level2 = ContentPage.find @top_level2.id - @child1_of_top_level1 = ContentPage.find @child1_of_top_level1.id - @child2_of_top_level1 = ContentPage.find @child2_of_top_level1.id - @child1_of_top_level2 = ContentPage.find @child1_of_top_level2.id - @child2_of_top_level2 = ContentPage.find @child2_of_top_level2.id - end - - context "Navigating to the Next page" do - it "The next_page should return the first child page when called on a parent" do - expect(@top_level1.next_page).to eq(@child1_of_top_level1) - expect(@top_level1.next_page.full_path).to eq "/tl1/c1tl1" - end - - it "The next_page should return the parents next sibling when called on the last child page" do - expect(@child2_of_top_level1.next_page).to eq(@top_level2) - expect(@child2_of_top_level1.next_page.full_path).to eq "/tl2" - end - - it "There should be no next_page when on the last page" do - expect(@child2_of_top_level2.next_page).to eq(nil) - end - end - - context "Navigating to the Previous page" do - it "There should be no previous_page when on the first page" do - expect(@top_level1.previous_page).to eq(nil) - end - - it "The previous_page should return the previous sibling of a child if a sibling exists" do - expect(@child2_of_top_level1.previous_page).to eq(@child1_of_top_level1) - expect(@child2_of_top_level1.previous_page.full_path).to eq "/tl1/c1tl1" - end - - it "The next page of the last child page in a section should return the top level of the next section" do - expect(@child2_of_top_level1.next_page).to eq(@top_level2) - expect(@child2_of_top_level1.next_page.full_path).to eq "/tl2" - end - - it "Should reorder the pages when a page is changed" do - @page_in_the_middle = FactoryBot.create(:content_page, :published, title: "Top Level Middle", position: 5) - # The reordering happens after_create, so need to refetch these - @page_in_the_middle = ContentPage.find @page_in_the_middle.id - @child2_of_top_level1 = ContentPage.find @child2_of_top_level1.id - expect(@child2_of_top_level1.next_page).to eq(@page_in_the_middle) - expect(@child2_of_top_level1.next_page.full_path).to eq "/top-level-middle" - end - end - end -end diff --git a/spec/models/content_page_version_spec.rb b/spec/models/content_page_version_spec.rb deleted file mode 100644 index a5694d73..00000000 --- a/spec/models/content_page_version_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require "rails_helper" - -RSpec.describe ContentPageVersion, type: :model do - let(:content_page_version) { create :content_page_version } - - describe "#navigation" do - it "returns true" do - expect(content_page_version.navigation).to be(true) - end - end -end diff --git a/spec/models/govspeak_decorator_spec.rb b/spec/models/govspeak_decorator_spec.rb deleted file mode 100644 index 7617958e..00000000 --- a/spec/models/govspeak_decorator_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -require "rails_helper" - -RSpec.describe GovspeakDecorator do - it "passes a simple smoke test" do - rendered = described_class.translate_markdown("*this is markdown*") - expect(rendered).to eq "<p><em>this is markdown</em></p>\n" - end - - it "embeds YouTube as iframe" do - govspeak_md = "$YoutubeVideo(https://www.youtube.com/watch?v=ABCDEFGHIJ)$EndYoutubeVideo" - expected_html = %(<div class="govspeak-embed-container"><iframe class="govspeak-embed-video" src="https://www.youtube.com/embed/ABCDEFGHIJ?enablejsapi=1&origin=https://help-for-early-years-providers.education.gov.uk" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>\n) - rendered = described_class.translate_markdown(govspeak_md) - expect(rendered).to eq(expected_html) - end - - it "Youtube Embedding with title" do - govspeak_md = "$YoutubeVideo[Test title](https://www.youtube.com/watch?v=EpjSlCJtPLo&list=PL4IuMlmijgAfTwwEiZmMp28Eaf66S3a1R&index=2&t=0s)$EndYoutubeVideo" - expected_html = %(<div class="govspeak-embed-container"><iframe class="govspeak-embed-video" src="https://www.youtube.com/embed/EpjSlCJtPLo?enablejsapi=1&origin=https://help-for-early-years-providers.education.gov.uk" title="Test title" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>\n) - rendered = described_class.translate_markdown(govspeak_md) - expect(rendered).to eq(expected_html) - end - - it "Youtube Embedding without title" do - govspeak_md = "$YoutubeVideo(https://www.youtube.com/watch?v=EpjSlCJtPLo&list=PL4IuMlmijgAfTwwEiZmMp28Eaf66S3a1R&index=2&t=0s)$EndYoutubeVideo" - expected_html = %(<div class="govspeak-embed-container"><iframe class="govspeak-embed-video" src="https://www.youtube.com/embed/EpjSlCJtPLo?enablejsapi=1&origin=https://help-for-early-years-providers.education.gov.uk" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>\n) - rendered = described_class.translate_markdown(govspeak_md) - expect(rendered).to eq(expected_html) - end - - it "returns kramdown doc if sanitize false" do - govspeak_md = "$YoutubeVideo(https://www.youtube.com/watch?v=EpjSlCJtPLo&list=PL4IuMlmijgAfTwwEiZmMp28Eaf66S3a1R&index=2&t=0s)$EndYoutubeVideo" - expected_html = %(<div class="govspeak-embed-container"><iframe class="govspeak-embed-video" src="https://www.youtube.com/embed/EpjSlCJtPLo?enablejsapi=1&origin=https://help-for-early-years-providers.education.gov.uk" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>\n) - rendered = described_class.translate_markdown(govspeak_md, sanitize: false) - expect(rendered).to eq(expected_html) - end -end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 1fdaad35..23cf1082 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,38 +1,38 @@ -require "rails_helper" +require 'rails_helper' RSpec.describe User, type: :model do specify { expect(create(:user)).to be_valid } - context "validation" do - specify { expect { create(:editor, email: "") }.to raise_error(ActiveRecord::RecordInvalid) } - specify { expect { create(:editor, email: "@") }.to raise_error(ActiveRecord::RecordInvalid) } - specify { expect { create(:editor, email: "1@2") }.to raise_error(ActiveRecord::RecordInvalid) } - specify { expect { create(:editor, email: "!£$%") }.to raise_error(ActiveRecord::RecordInvalid) } + context 'validation' do + specify { expect { create(:editor, email: '') }.to raise_error(ActiveRecord::RecordInvalid) } + specify { expect { create(:editor, email: '@') }.to raise_error(ActiveRecord::RecordInvalid) } + specify { expect { create(:editor, email: '1@2') }.to raise_error(ActiveRecord::RecordInvalid) } + specify { expect { create(:editor, email: '!£$%') }.to raise_error(ActiveRecord::RecordInvalid) } end - describe "#reset_password" do + describe '#reset_password' do let!(:user) { create :user } - let(:password) { "FooBar123!!" } + let(:password) { 'FooBar123!!' } - it "changes the password" do + it 'changes the password' do expect { user.reset_password(password, password) }.to(change { user.reload.encrypted_password }) end - it "raises an error if password blank" do - user.reset_password("", password) + it 'raises an error if password blank' do + user.reset_password('', password) expect(user.errors[:password]).to be_present end end # rubocop:disable Rails/SaveBang - specs need to use .update to check error behaviour - describe "#ensure_at_least_one_user_has_admin_role" do + describe '#ensure_at_least_one_user_has_admin_role' do let!(:user) { create :admin } - it "allows a admin to be removed if second present" do + it 'allows a admin to be removed if second present' do _second_admin = create :admin user.update(role: :editor) expect(user.errors[:role]).not_to be_present - expect(user.reload.role).to eq("editor") + expect(user.reload.role).to eq('editor') end end # rubocop:enable Rails/SaveBang diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index bdc6c93b..698a6a49 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,15 +1,15 @@ # This file is copied to spec/ when you run 'rails generate rspec:install' -require "spec_helper" +require 'spec_helper' -ENV["RAILS_ENV"] ||= "test" -require File.expand_path("../config/environment", __dir__) +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../config/environment', __dir__) # Prevent database truncation if the environment is production -abort("The Rails environment is running in production mode!") if Rails.env.production? -require "rspec/rails" -require "devise" -require "view_component/test_helpers" -require "view_component/system_test_helpers" -require "capybara/rspec" +abort('The Rails environment is running in production mode!') if Rails.env.production? +require 'rspec/rails' +require 'devise' +require 'view_component/test_helpers' +require 'view_component/system_test_helpers' +require 'capybara/rspec' # Add additional requires below this line. Rails is not loaded until this point! @@ -26,7 +26,7 @@ # directory. Alternatively, in the individual `*_spec.rb` files, manually # require only the support files necessary. # -Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f } +Dir[Rails.root.join('spec/support/**/*.rb')].sort.each { |f| require f } # Checks for pending migrations and applies them before tests are run. # If you are not using ActiveRecord, you can remove these lines. @@ -40,7 +40,7 @@ end RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" + config.fixture_path = Rails.root.join('spec/fixtures').to_s # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false diff --git a/spec/requests/admin/content_blocks_spec.rb b/spec/requests/admin/content_blocks_spec.rb deleted file mode 100644 index ab9a18cf..00000000 --- a/spec/requests/admin/content_blocks_spec.rb +++ /dev/null @@ -1,126 +0,0 @@ -require "rails_helper" - -RSpec.describe Admin::ContentBlocksController, type: :request do - before { sign_in create(:admin) } - - describe "GET /admin/blocks" do - it "renders page" do - get admin_content_blocks_path - expect(response).to be_successful - end - end - - describe "GET /admin/blocks/new" do - it "renders page" do - get new_admin_content_block_path - expect(response).to be_successful - end - end - - describe "GET /admin/blocks/:id/edit" do - let(:content_block) { create :content_block } - it "renders page" do - get edit_admin_content_block_path(content_block) - expect(response).to be_successful - end - end - - describe "POST /admin/blocks" do - let(:params) do - { content_block: attributes_for(:content_block) } - end - subject { post admin_content_blocks_path, params: params } - - it "creates a new content block" do - expect { subject }.to change(ContentBlock, :count).by(1) - end - - it "redirects to index" do - subject - expect(response).to redirect_to(admin_content_blocks_path) - end - - context "with invalid input" do - let(:params) do - { content_block: attributes_for(:content_block).slice(:description, :markdown) } - end - - it "does not create a new content block" do - expect { subject }.not_to change(ContentBlock, :count) - end - - it "renders form again" do - subject - expect(response).to be_successful - end - end - - context "with invalid user" do - before { sign_in create(:user) } - - it "does not create a new content block" do - expect { subject }.not_to change(ContentBlock, :count) - end - - it "renders form again" do - subject - expect(response).to be_successful - end - - it "displays message" do - subject - expect(unescaped_response_body).to include("You don't have permission") - end - end - end - - describe "PATCH /admin/blocks/:id" do - let(:content_block) { create :content_block } - let(:name) { Faker::Superhero.name.delete(" ") } - let(:params) do - { content_block: { name: name } } - end - subject { patch admin_content_block_path(content_block), params: params } - - it "updates the content block" do - original_name = content_block.name - expect { subject }.to(change { content_block.reload.name }.from(original_name).to(name)) - end - - it "redirects to index" do - subject - expect(response).to redirect_to(admin_content_blocks_path) - end - - context "with invalid input" do - let(:name) { "" } - - it "does not update the content block" do - expect { subject }.not_to(change { content_block.reload.name }) - end - - it "renders form again" do - subject - expect(response).to be_successful - end - end - - context "with invalid user" do - before { sign_in create(:user) } - - it "does not update the content block" do - expect { subject }.not_to(change { content_block.reload.name }) - end - - it "renders form again" do - subject - expect(response).to be_successful - end - - it "displays message" do - subject - expect(unescaped_response_body).to include("You don't have permission") - end - end - end -end diff --git a/spec/requests/admin/content_page_versions_spec.rb b/spec/requests/admin/content_page_versions_spec.rb deleted file mode 100644 index a3dc676e..00000000 --- a/spec/requests/admin/content_page_versions_spec.rb +++ /dev/null @@ -1,125 +0,0 @@ -require "rails_helper" - -RSpec.describe Admin::ContentPageVersionsController, type: :request do - let!(:content_page_version) { create :content_page_version } - let(:content_page) { content_page_version.content_page } - - before { sign_in create(:admin) } - - describe "GET /admin/pages/:content_page_id/content_page_versions/:id/preview_of_draft" do - it "renders successfully" do - get preview_of_draft_admin_content_page_content_page_version_path(content_page, content_page_version) - expect(response).to be_successful - end - end - - describe "POST /admin/pages/:content_page_id/content_page_versions/:id/publish" do - subject { post publish_admin_content_page_content_page_version_path(content_page, content_page_version) } - - it "deletes content page version" do - expect { subject }.to change(ContentPageVersion, :count).by(-1) - expect(ContentPageVersion.exists?(content_page_version.id)).to be(false) - end - - it "updates the content page with data from content page version" do - original_title = content_page.title - expect { subject }.to(change { content_page.reload.title }.from(original_title).to(content_page_version.title)) - expect(content_page.reload.content_list).to eq(content_page_version.content_list) - expect(content_page.reload.markdown).to eq(content_page_version.markdown) - expect(content_page.reload.description).to eq(content_page_version.description) - end - - it "set the content page as published" do - subject - expect(content_page.reload.is_published).to be(true) - end - - it "redirects to version content page" do - expect(subject).to redirect_to(versions_admin_content_page_path(content_page)) - end - end - - describe "GET /admin/pages/:content_page_id/content_page_versions/:id/edit" do - it "renders successfully" do - get edit_admin_content_page_content_page_version_path(content_page, content_page_version) - expect(response).to be_successful - end - end - - describe "PATCH /admin/pages/:content_page_id/content_page_versions/:id" do - let(:params) do - { - content_page_version: attributes_for(:content_page_version), - } - end - subject { patch admin_content_page_content_page_version_path(content_page, content_page_version), params: params } - - it "updates the content page version" do - subject - expect(content_page_version.reload.markdown).to eq(params.dig(:content_page_version, :markdown)) - end - - it "redirects to version content page" do - expect(subject).to redirect_to(versions_admin_content_page_path(content_page)) - end - - context "with invalid input" do - let(:params) { { content_page_version: { title: "Invalid!" } } } - it "renders the form again" do - subject - expect(response).to be_successful - end - - it "does not update the content page version" do - expect { subject }.not_to(change { content_page_version.reload.title }) - end - end - - context "with standard user" do - before { sign_in create(:user) } - - it "renders the form again" do - subject - expect(response).to be_successful - end - - it "displays a message" do - subject - expect(unescaped_response_body).to include("You don't have permission") - end - - it "does not update the content page version" do - expect { subject }.not_to(change { content_page_version.reload.title }) - end - end - end - - describe "DELETE /admin/pages/:content_page_id/content_page_versions/:id" do - before do - # Ensure only one content_page_version associated with content page - content_page.content_page_versions.first.destroy! if content_page.content_page_versions.count == 2 - end - - subject { delete admin_content_page_content_page_version_path(content_page, content_page_version) } - - it "deletes the content page version" do - expect { subject }.to change(ContentPageVersion, :count).by(-1) - end - - it "deletes the content page" do - expect { subject }.to change(ContentPage, :count).by(-1) - end - - context "when content page published" do - before { content_page.update is_published: true } - - it "deletes the content page version" do - expect { subject }.to change(ContentPageVersion, :count).by(-1) - end - - it "does not delete the content page" do - expect { subject }.not_to change(ContentPage, :count) - end - end - end -end diff --git a/spec/requests/admin/content_pages_spec.rb b/spec/requests/admin/content_pages_spec.rb deleted file mode 100644 index fe7f1a9b..00000000 --- a/spec/requests/admin/content_pages_spec.rb +++ /dev/null @@ -1,240 +0,0 @@ -require "rails_helper" - -RSpec.describe Admin::ContentPagesController, type: :request do - # ContentPage. As you add validations to ContentPage, be sure to - # adjust the attributes here as well. - - let(:valid_attributes) { attributes_for(:content_page) } - let(:other_valid_attributes) { attributes_for(:content_page) } - let(:invalid_attributes) { attributes_for(:content_page, :invalid_title) } - let(:editor) { create(:editor) } - - before(:each) do - sign_in editor - end - - describe "GET /index" do - it "renders a successful response" do - parent_page = create(:content_page) - child_page = create(:content_page) - - get admin_content_pages_path - expect(response).to be_successful - expect(response.body).to include(parent_page.title) - expect(response.body).to include(child_page.title) - end - end - - describe "GET /show" do - it "renders a successful response" do - content_page = create(:content_page, :published) - get admin_content_page_path(content_page) - expect(response).to be_successful - end - - context "with an unpublished content page" do - it "redirects to 404" do - content_page = create(:content_page) - get admin_content_page_path(content_page) - expect(response).to redirect_to("/404") - end - end - end - - describe "GET /new" do - it "renders a successful response" do - get new_admin_content_page_path - expect(response).to be_successful - end - end - - describe "GET /edit" do - it "render a successful response" do - content_page = ContentPage.create! valid_attributes - get edit_admin_content_page_path(content_page) - expect(response).to be_successful - end - end - - describe "POST /create" do - context "with valid parameters" do - subject { post admin_content_pages_path, params: { content_page: valid_attributes } } - it "creates a new ContentPage" do - expect { subject }.to change(ContentPage, :count).by(1) - end - - it "populates content page from input" do - subject - content_page = ContentPage.last - expect(content_page.title).to eq(valid_attributes[:title]) - expect(content_page.content_list).to eq(valid_attributes[:content_list]) - expect(content_page.markdown).to eq(valid_attributes[:markdown]) - expect(content_page.description).to eq(valid_attributes[:description]) - end - - it "creates a new content page version" do - expect { subject }.to change(ContentPageVersion, :count).by(1) - end - - it "populates content page version from input" do - subject - content_page_version = ContentPageVersion.last - expect(content_page_version.title).to eq(valid_attributes[:title]) - expect(content_page_version.content_list).to eq(valid_attributes[:content_list]) - expect(content_page_version.markdown).to eq(valid_attributes[:markdown]) - expect(content_page_version.description).to eq(valid_attributes[:description]) - end - - it "redirects to the created content_page" do - subject - expect(response).to redirect_to(versions_admin_content_page_path(::ContentPage.last)) - end - end - - context "with invalid parameters" do - it "does not create a new ContentPage" do - expect { - post admin_content_pages_path, params: { content_page: invalid_attributes } - }.not_to change(ContentPage, :count) - end - - it "renders a successful response (i.e. to display the 'new' template)" do - post admin_content_pages_path, params: { content_page: invalid_attributes } - expect(response).to be_successful - end - end - - context "with invalid user" do - before { sign_in create(:user) } - subject { post admin_content_pages_path, params: { content_page: valid_attributes } } - - it "renders form" do - subject - expect(response).to be_successful - end - - it "does not create content page" do - expect { subject }.not_to change(ContentPage, :count) - end - end - end - - describe "PATCH /update" do - let!(:content_page) { create :content_page } - context "with valid parameters" do - let(:params) do - { content_page: valid_attributes } - end - - it "creates a new content_page_version" do - expect { patch admin_content_page_path(content_page), params: params }.to change(ContentPageVersion, :count).by(1) - end - - it "populates content page version from input" do - patch admin_content_page_path(content_page), params: params - content_page_version = content_page.content_page_versions.last - expect(content_page_version.title).to eq(valid_attributes[:title]) - expect(content_page_version.content_list).to eq(valid_attributes[:content_list]) - expect(content_page_version.description).to eq(valid_attributes[:description]) - expect(content_page_version.markdown).to eq(valid_attributes[:markdown]) - expect(content_page_version.author).to eq(editor.name) - end - - it "redirects to the content_page versions" do - patch admin_content_page_path(content_page), params: params - expect(response).to redirect_to(versions_admin_content_page_path(content_page)) - end - end - - context "with invalid parameters" do - it "renders a successful response (i.e. to display the 'edit' template)" do - content_page = ContentPage.create! valid_attributes - patch admin_content_page_path(content_page), params: { content_page: invalid_attributes } - expect(response).to be_successful - end - end - - context "with invalid user" do - before { sign_in create(:user) } - - subject { patch admin_content_page_path(content_page), params: { content_page: valid_attributes } } - - it "renders form" do - subject - expect(response).to be_successful - end - - it "does not modify content page" do - expect { subject }.not_to(change { content_page.reload }) - end - end - end - - describe "DELETE /destroy" do - it "destroys the requested content_page" do - content_page = ContentPage.create! valid_attributes - expect { - delete admin_content_page_path(content_page) - }.to change(ContentPage, :count).by(-1) - end - - it "redirects to the content_pages list" do - content_page = ContentPage.create! valid_attributes - delete admin_content_page_path(content_page) - expect(response).to redirect_to(admin_content_pages_path) - end - end - - describe "Previewing markdown" do - let(:valid_params) do - { - markdown: "## Govspeak is magic!", - } - end - - context "without a valid session" do - it "redirects to login" do - Warden.test_reset! - post "/admin/preview_markdown", params: valid_params - expect(response).to redirect_to("/users/sign_in") - end - end - - context "with a valid session" do - it "renders a successful response" do - sign_in create(:editor) - post "/admin/preview_markdown", params: valid_params - expect(response.content_type).to eq "application/json; charset=utf-8" - expect(JSON.parse(response.body)).to have_key("html") - expect(response).to be_successful - end - - it "returns valid html" do - sign_in create(:editor) - post "/admin/preview_markdown", params: valid_params - expect(JSON.parse(response.body)["html"]).to include('<h2 id="govspeak-is-magic">Govspeak is magic!</h2>') - end - end - end - - describe "GET /admin/pages/:content_page_id/preview_of_live" do - it "renders successfully" do - content_page = create(:content_page, :published) - get preview_of_live_admin_content_page_path(content_page, id: content_page.id) - expect(response).to be_successful - end - end - - describe "POST /admin/pages/:id/unpublish" do - let!(:content_page) { create :content_page, :published } - subject { post unpublish_admin_content_page_path(content_page) } - - it "changes is published to false" do - expect { subject }.to(change { content_page.reload.is_published }.to(false)) - end - - it "creates a content page version" do - expect { subject }.to change(ContentPageVersion, :count).by(1) - end - end -end diff --git a/spec/requests/admin/user_request_spec.rb b/spec/requests/admin/user_request_spec.rb deleted file mode 100644 index 10c2a4ae..00000000 --- a/spec/requests/admin/user_request_spec.rb +++ /dev/null @@ -1,235 +0,0 @@ -require "rails_helper" - -RSpec.describe Admin::UsersController, type: :request do - let(:user) { create :user } - - describe "GET /admin/users" do - context "as admin" do - it "renders a successful response" do - sign_in create(:admin) - get admin_users_path - expect(response).to be_successful - end - end - - context "as editor" do - it "redirects to root" do - sign_in create(:editor) - get admin_users_path - expect(response).to redirect_to(admin_content_pages_path) - end - end - - context "user not signed in" do - it "redirects to user sign in" do - get admin_users_path - expect(response).to redirect_to(new_user_session_path) - end - end - end - - describe "GET /admin/users/new" do - it "renders successfully" do - sign_in create(:admin) - get new_admin_user_path - expect(response).to be_successful - end - end - - describe "POST /admin/users" do - let(:user_attributes) { attributes_for :user } - subject { post admin_users_path, params: { user: user_attributes } } - - context "as admin" do - before { sign_in create(:admin) } - - it "creates a new user" do - expect { subject }.to change(User, :count).by(1) - end - - it "redirects to index" do - subject - expect(response).to redirect_to(admin_users_path) - end - end - - context "as admin with invalid entry" do - let(:user_attributes) { attributes_for :user, email: "invalid" } - before { sign_in create(:admin) } - - it "creates a new user" do - expect { subject }.not_to change(User, :count) - end - - it "renders form" do - subject - expect(response).to be_successful - end - end - - context "as editor" do - before { sign_in create(:editor) } - - it "does not create a new user" do - expect { subject }.not_to change(User, :count) - end - - it "renders the form" do - subject - expect(response).to be_successful - end - - it "displays a message" do - subject - expect(unescaped_response_body).to include("You don't have permission to create a user") - end - end - end - - describe "GET /admin/users/:id/edit" do - it "renders successfully" do - sign_in create(:admin) - get edit_admin_user_path(user) - expect(response).to be_successful - end - end - - describe "PUT /admin/users/:id" do - let(:user_attributes) { attributes_for :user } - let(:user) { create :user } - - subject { put admin_user_path(user), params: { user: user_attributes } } - - context "with admin and blank password" do - let(:user_attributes) { attributes_for :user, password: "" } - before { sign_in create(:admin) } - - it "modifies the user" do - subject - expect(user.reload.first_name).to eq(user_attributes[:first_name]) - end - - it "does not modify the password" do - expect { subject }.not_to(change { user.reload.encrypted_password }) - end - - it "redirects to index" do - subject - expect(response).to redirect_to(admin_users_path) - end - end - - context "with admin, blank password, and invalid submission" do - let(:user_attributes) { attributes_for :user, password: "", email: "invalid" } - before { sign_in create(:admin) } - - it "modifies the user" do - subject - expect(user.reload.first_name).not_to eq(user_attributes[:first_name]) - end - - it "does not modify the password" do - expect { subject }.not_to(change { user.reload.encrypted_password }) - end - - it "renders the form" do - subject - expect(response).to be_successful - end - end - - context "with admin and matching passwords" do - let(:password) { "#{Faker::Lorem.word}!!12XX" } - let(:user_attributes) { attributes_for :user, password: password, password_confirmation: password } - before { sign_in create(:admin) } - - it "modifies the user" do - subject - expect(user.reload.first_name).to eq(user_attributes[:first_name]) - end - - it "modifies the password" do - expect { subject }.to(change { user.reload.encrypted_password }) - end - - it "redirects to index" do - subject - expect(response).to redirect_to(admin_users_path) - end - end - - context "with admin and miss-matching passwords" do - let(:user_attributes) { attributes_for :user, password_confirmation: Faker::Lorem.word } - before { sign_in create(:admin) } - - it "does not modify the user" do - subject - expect(user.reload.first_name).not_to eq(user_attributes[:first_name]) - end - - it "does not modify the password" do - expect { subject }.not_to(change { user.reload.encrypted_password }) - end - - it "renders the form" do - subject - expect(response).to be_successful - end - end - - context "as editor" do - before { sign_in create(:editor) } - - it "does not modify user" do - subject - expect(user.reload.first_name).not_to eq(user_attributes[:first_name]) - end - - it "renders the form" do - subject - expect(response).to be_successful - end - - it "displays a message" do - subject - expect(unescaped_response_body).to include("You don't have permission to update a user") - end - end - end - - describe "DELETE /admin/users/:id" do - let!(:user) { create :user } - subject { delete admin_user_path(user) } - - context "as admin" do - before { sign_in create(:admin) } - - it "deletes the user" do - expect { subject }.to change(User, :count).by(-1) - end - - it "redirects to index" do - subject - expect(response).to redirect_to(admin_users_path) - end - end - - context "as editor" do - before { sign_in create(:editor) } - - it "does not create a new user" do - expect { subject }.not_to change(User, :count) - end - - it "renders the form" do - subject - expect(response).to be_successful - end - - it "displays a message" do - subject - expect(unescaped_response_body).to include("You don't have permission to delete this user") - end - end - end -end diff --git a/spec/requests/application_spec.rb b/spec/requests/application_spec.rb index 5790d031..b90c05ee 100644 --- a/spec/requests/application_spec.rb +++ b/spec/requests/application_spec.rb @@ -1,19 +1,19 @@ -require "rails_helper" +require 'rails_helper' RSpec.describe ApplicationController, type: :request do let(:json) { JSON.parse(response.body, symbolize_names: true) } - describe "GET /check" do + describe 'GET /check' do before { get check_path } - it "renders successfully" do + it 'renders successfully' do expect(response).to be_successful end - it "returns JSON data" do - expect(json[:status]).to eq("OK") - expect(json[:version]).to eq("-") - expect(json[:environment]).to eq("test") + it 'returns JSON data' do + expect(json[:status]).to eq('OK') + expect(json[:version]).to eq('-') + expect(json[:environment]).to eq('test') expect(json[:sha]).to be_blank end end diff --git a/spec/requests/check_spec.rb b/spec/requests/check_spec.rb index fba6fd41..8a00010b 100644 --- a/spec/requests/check_spec.rb +++ b/spec/requests/check_spec.rb @@ -1,8 +1,8 @@ -require "rails_helper" +require 'rails_helper' -RSpec.describe "healthcheck endpoint", type: :request do - it "responds with 200 response" do - response = get "/check" +RSpec.describe 'healthcheck endpoint', type: :request do + it 'responds with 200 response' do + response = get '/check' expect(response).to eq(200) end end diff --git a/spec/requests/content_request_spec.rb b/spec/requests/content_request_spec.rb deleted file mode 100644 index 2b6709da..00000000 --- a/spec/requests/content_request_spec.rb +++ /dev/null @@ -1,81 +0,0 @@ -require "rails_helper" -require "axe-rspec" - -RSpec.describe "Contents", type: :request do - let(:a_page) do - parent = FactoryBot.create(:content_page, :published) - FactoryBot.create(:content_page, :published, parent_id: parent.id) - end - - before :all do - cookies[:track_analytics] = "true" - end - - describe "GET /show" do - before do - skip 'WIP' if Rails.application.cms? - end - - it "renders a page" do - get a_page.full_path - expect(response).to be_successful - end - - it "includes the content page description in a meta tag" do - get a_page.full_path - expect(html_document.at("meta[name='description']")).to be_present - expect(html_document.at("meta[name='description']")["content"]).to eq(a_page.description) - end - - it "does not contain a meta description is content page description blank" do - a_page.update!(description: "") - get a_page.full_path - expect(html_document.at("meta[name='description']")).to be_nil - end - - it "renders a 404 when the page is not found" do - without_detailed_exceptions do - get "#{a_page.full_path}rubbish" - expect(response).to have_http_status :not_found - end - end - end - - describe "GET /" do - it "renders the landing page / hub page" do - get "/" - expect(response).to be_successful - end - - it "renders the content pages with HTTP headers to allow caching" do - skip 'WIP' if Rails.application.cms? - get "/" - expect(response.headers["Cache-Control"]).to eq("max-age=3600, public") - end - end - - describe "Temporary authorisation on public site" do - context "With the environment variable AUTH_ON_EVERYTHING set" do - it "shows an auth dialog if the user is not already logged in" do - cached_env_var = ENV["AUTH_ON_EVERYTHING"] - ENV["AUTH_ON_EVERYTHING"] = "true" - - get "/" - expect(response.status).to eq(302) - - ENV["AUTH_ON_EVERYTHING"] = cached_env_var - end - - it "does not show an auth dialog if the user is already logged" do - cached_env_var = ENV["AUTH_ON_EVERYTHING"] = "true" - sign_in FactoryBot.create(:editor) - - get "/" - - expect(response.status).to eq(200) - - ENV["AUTH_ON_EVERYTHING"] = cached_env_var - end - end - end -end diff --git a/spec/requests/errors_page_request_spec.rb b/spec/requests/errors_page_request_spec.rb index 51e7681c..1c59e917 100644 --- a/spec/requests/errors_page_request_spec.rb +++ b/spec/requests/errors_page_request_spec.rb @@ -1,11 +1,11 @@ -require "rails_helper" +require 'rails_helper' -RSpec.describe "/404", type: :request do - describe "GET /404" do - it "renders the not found page" do - get "/404" - expect(response).to have_http_status(404) - expect(response.body).to include("Page not found") +RSpec.describe '/404', type: :request do + describe 'GET /404' do + it 'renders the not found page' do + get '/404' + expect(response).to have_http_status(:not_found) + expect(response.body).to include('Page not found') end end end diff --git a/spec/requests/feedbacks_spec.rb b/spec/requests/feedbacks_spec.rb deleted file mode 100644 index 4abf7e8c..00000000 --- a/spec/requests/feedbacks_spec.rb +++ /dev/null @@ -1,66 +0,0 @@ -require "rails_helper" - -RSpec.describe "/feedbacks", type: :request do - let(:valid_attributes) do - { page_useful: %w[yes no].sample } - end - - let(:invalid_attributes) do - { page_useful: "foo" } - end - let(:redirect_url) { contact_us_url } - - describe "POST /create" do - context "with valid parameters" do - subject { post feedbacks_url, params: { feedback: valid_attributes }, headers: { "HTTP_REFERER" => redirect_url } } - - it "redirects back to referring page with target feedback" do - subject - expect(response).to redirect_to("#{redirect_url}#feedback") - end - - it "sets cookie to input" do - subject - expect(cookies[:feedback_page_useful]).to eq(valid_attributes[:page_useful]) - end - end - - context "with invalid parameters" do - subject { post feedbacks_url, params: { feedback: invalid_attributes }, headers: { "HTTP_REFERER" => redirect_url } } - - it "redirects back to referring page with target feedback" do - subject - expect(response).to redirect_to("#{redirect_url}#feedback") - end - - it "clears cookie" do - subject - expect(cookies[:feedback_page_useful]).to be_blank - end - end - - context "without referer" do - subject { post feedbacks_url, params: { feedback: valid_attributes } } - - it "redirects back to root with target feedback" do - subject - expect(response).to redirect_to("#{root_path}#feedback") - end - end - - context "with invalid parameter and cookie set" do - before { cookies[:feedback_page_userful] = "yes" } - subject { post feedbacks_url, params: { feedback: invalid_attributes }, headers: { "HTTP_REFERER" => redirect_url } } - - it "clears cookie" do - subject - expect(cookies[:feedback_page_useful]).to be_blank - end - - it "redirects back to referring page with target feedback" do - subject - expect(response).to redirect_to("#{redirect_url}#feedback") - end - end - end -end diff --git a/spec/requests/static_pages_spec.rb b/spec/requests/static_pages_spec.rb deleted file mode 100644 index 3b83c722..00000000 --- a/spec/requests/static_pages_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require "rails_helper" - -RSpec.describe "renders a static page" do - it "accessibility-statement" do - skip 'WIP' if Rails.application.cms? - - get "/accessibility-statement" - expect(response).to be_successful - expect(response.body).to include("Accessibility statement for the Help for early years providers service") - end - - it "disclaimer" do - get "/disclaimer" - expect(response).to be_successful - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3b7870ec..439919cf 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,25 +1,25 @@ -require "simplecov" +require 'simplecov' +# SimpleCov.minimum_coverage 99 +SimpleCov.start 'rails' -require "capybara/rspec" -require "axe-rspec" -require "webdrivers/chromedriver" +require 'pry' +require 'capybara/rspec' +require 'axe-rspec' +require 'webdrivers/chromedriver' -SimpleCov.start - -# This configuration seems to work well in CI environments: Capybara.register_driver :chrome_headless do |app| - capabilities = Selenium::WebDriver::Remote::Capabilities.chrome - capabilities["goog:chromeOptions"] = { - args: %w[ + options = Selenium::WebDriver::Options.chrome( + accept_insecure_certs: true, + 'goog:chromeOptions': %w[ + disable-cache + disable-dev-shm-usage headless no-sandbox - disable-dev-shm-usage window-size=1400,1400 - disable-cache ], - } + ) - Capybara::Selenium::Driver.new(app, browser: :chrome, capabilities: capabilities) + Capybara::Selenium::Driver.new(app, browser: :chrome, options: options) end Capybara.javascript_driver = :chrome_headless diff --git a/spec/support/without_detailed_exceptions.rb b/spec/support/without_detailed_exceptions.rb index 0232100a..7b2b12f3 100644 --- a/spec/support/without_detailed_exceptions.rb +++ b/spec/support/without_detailed_exceptions.rb @@ -10,13 +10,13 @@ module WithoutDetailedExceptions def without_detailed_exceptions env_config = Rails.application.env_config - original_show_exceptions = env_config["action_dispatch.show_exceptions"] - original_show_detailed_exceptions = env_config["action_dispatch.show_detailed_exceptions"] - env_config["action_dispatch.show_exceptions"] = true - env_config["action_dispatch.show_detailed_exceptions"] = false + original_show_exceptions = env_config['action_dispatch.show_exceptions'] + original_show_detailed_exceptions = env_config['action_dispatch.show_detailed_exceptions'] + env_config['action_dispatch.show_exceptions'] = true + env_config['action_dispatch.show_detailed_exceptions'] = false yield ensure - env_config["action_dispatch.show_exceptions"] = original_show_exceptions - env_config["action_dispatch.show_detailed_exceptions"] = original_show_detailed_exceptions + env_config['action_dispatch.show_exceptions'] = original_show_exceptions + env_config['action_dispatch.show_detailed_exceptions'] = original_show_detailed_exceptions end end diff --git a/spec/views/admin/content_pages/edit.html.erb_spec.rb b/spec/views/admin/content_pages/edit.html.erb_spec.rb deleted file mode 100644 index 122685fc..00000000 --- a/spec/views/admin/content_pages/edit.html.erb_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require "rails_helper" - -RSpec.describe "admin/content_pages/edit", type: :view do - before(:each) do - @content_page = FactoryBot.create(:content_page) - end - - it "renders the edit content_page form" do - render - - assert_select "form[action=?][method=?]", admin_content_page_path(@content_page), "post" do - assert_select "input[name=?]", "content_page[title]" - - assert_select "textarea[name=?]", "content_page[markdown]" - end - end -end diff --git a/spec/views/admin/content_pages/index.html.erb_spec.rb b/spec/views/admin/content_pages/index.html.erb_spec.rb deleted file mode 100644 index feee1adb..00000000 --- a/spec/views/admin/content_pages/index.html.erb_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require "rails_helper" - -RSpec.describe "admin/content_pages/index", type: :view do - before(:each) do - @content_pages = [ - FactoryBot.create(:content_page), - FactoryBot.create(:content_page), - ] - end - - it "renders a list of content_pages" do - render - @content_pages.each do |funky_page| - rendered.include? funky_page.title - rendered.include? funky_page.markdown - end - end -end diff --git a/spec/views/admin/content_pages/new.html.erb_spec.rb b/spec/views/admin/content_pages/new.html.erb_spec.rb deleted file mode 100644 index 3393cf33..00000000 --- a/spec/views/admin/content_pages/new.html.erb_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "rails_helper" - -RSpec.describe "admin/content_pages/new", type: :view do - before(:each) do - assign(:content_page, ContentPage.new( - title: "MyString", - markdown: "MyString", - )) - end - - it "renders new content_page form" do - render - - assert_select "form[action=?][method=?]", admin_content_pages_path, "post" do - assert_select "input[name=?]", "content_page[title]" - - assert_select "textarea[name=?]", "content_page[markdown]" - end - end -end diff --git a/spec/views/admin/content_pages/show.html.erb_spec.rb b/spec/views/admin/content_pages/show.html.erb_spec.rb deleted file mode 100644 index b8993e70..00000000 --- a/spec/views/admin/content_pages/show.html.erb_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require "rails_helper" - -RSpec.describe "admin/content_pages/show", type: :view do - before(:each) do - @content_page = FactoryBot.create(:content_page) - end - - it "renders attributes in <p>" do - render - expect(rendered).to include(@content_page.title) - expect(rendered).to include(@content_page.markdown) - end -end diff --git a/spec/views/content/index.html.erb_spec.rb b/spec/views/content/index.html.erb_spec.rb deleted file mode 100644 index 6f3ab9dd..00000000 --- a/spec/views/content/index.html.erb_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require "rails_helper" - -RSpec.describe "content/index", type: :view do - before(:each) do - @content_pages = [ - FactoryBot.create(:content_page), - FactoryBot.create(:content_page), - ] - @featured_pages = [] - end - - it "renders a list of content" do - render - @content_pages.each do |content| - rendered.include? content.title - end - end - - it "should not contain the feedback section" do - render - expect(rendered).not_to include("Is this page useful?") - end -end diff --git a/terraform/app/modules/paas/data.tf b/terraform/app/modules/paas/data.tf deleted file mode 100644 index 35283c4f..00000000 --- a/terraform/app/modules/paas/data.tf +++ /dev/null @@ -1,17 +0,0 @@ -data cloudfoundry_org org { - name = "dfe" -} - -data cloudfoundry_space space { - name = var.space_name - org = data.cloudfoundry_org.org.id -} - -data cloudfoundry_domain cloudapps_digital { - name = "london.cloudapps.digital" -} - - -data cloudfoundry_service postgres { - name = "postgres" -} diff --git a/terraform/app/modules/paas/main.tf b/terraform/app/modules/paas/main.tf deleted file mode 100644 index 637fb9e1..00000000 --- a/terraform/app/modules/paas/main.tf +++ /dev/null @@ -1,74 +0,0 @@ -resource cloudfoundry_service_instance postgres_instance { - name = local.postgres_service_name - space = data.cloudfoundry_space.space.id - service_plan = data.cloudfoundry_service.postgres.service_plans[var.postgres_service_plan] - json_params = "{\"enable_extensions\": [\"pgcrypto\", \"fuzzystrmatch\", \"plpgsql\"]}" - timeouts { - create = var.postgres_create_timeout - } -} - -resource cloudfoundry_app web_app { - name = local.web_app_name - command = var.web_app_start_command - docker_image = var.app_docker_image - health_check_type = "http" - health_check_http_endpoint = "/check" - instances = var.web_app_instances - memory = var.web_app_memory - - space = data.cloudfoundry_space.space.id - stopped = var.app_stopped - strategy = var.web_app_deployment_strategy - timeout = var.app_start_timeout - dynamic "service_binding" { - for_each = local.app_service_bindings - content { - service_instance = service_binding.value - params_json = <<JSON - { "read_only": true } - JSON - } - } - routes { - route = cloudfoundry_route.web_app_route.id - } - environment = local.app_environment -} - -resource cloudfoundry_app cms_app { - name = local.cms_app_name - command = var.cms_app_start_command - docker_image = var.app_docker_image - health_check_type = "http" - health_check_http_endpoint = "/check" - instances = var.web_app_instances - memory = var.web_app_memory - - space = data.cloudfoundry_space.space.id - stopped = var.app_stopped - strategy = var.web_app_deployment_strategy - timeout = var.app_start_timeout - dynamic "service_binding" { - for_each = local.app_service_bindings - content { - service_instance = service_binding.value - } - } - routes { - route = cloudfoundry_route.cms_app_route.id - } - environment = local.app_environment -} - -resource cloudfoundry_route web_app_route { - domain = data.cloudfoundry_domain.cloudapps_digital.id - space = data.cloudfoundry_space.space.id - hostname = local.web_app_name -} - -resource cloudfoundry_route cms_app_route { - domain = data.cloudfoundry_domain.cloudapps_digital.id - space = data.cloudfoundry_space.space.id - hostname = local.cms_app_name -} diff --git a/terraform/app/modules/paas/outputs.tf b/terraform/app/modules/paas/outputs.tf deleted file mode 100644 index 56933e37..00000000 --- a/terraform/app/modules/paas/outputs.tf +++ /dev/null @@ -1,8 +0,0 @@ -output docker_image { - value = cloudfoundry_app.web_app.docker_image - description = "Docker image - repository:tag" -} - -output docker_tag { - value = regex(":(.*)$", cloudfoundry_app.web_app.docker_image)[0] -} diff --git a/terraform/app/modules/paas/variables.tf b/terraform/app/modules/paas/variables.tf deleted file mode 100644 index d0325d4f..00000000 --- a/terraform/app/modules/paas/variables.tf +++ /dev/null @@ -1,66 +0,0 @@ -variable environment { -} - -variable app_docker_image { -} - -variable app_env_values { -} - -variable app_start_timeout { - default = 300 -} - -variable app_stopped { - default = false -} - -variable postgres_create_timeout { - default = "15m" -} - -variable postgres_service_plan { -} - -variable service_name { -} -variable space_name { -} - -variable web_app_deployment_strategy { -} - -variable web_app_instances { - default = 1 -} - -variable web_app_memory { - default = 512 -} - -variable web_app_start_command { -} -variable cms_app_start_command { -} - -locals { - - app_env_domain = { - "DOMAIN" = "eyfs-${var.environment}.london.cloudapps.digital" - "GOVUK_APP_DOMAIN" = "eyfs-${var.environment}.london.cloudapps.digital" - "GOVUK_WEBSITE_ROOT" = "eyfs-${var.environment}.london.cloudapps.digital" - } - app_environment = merge( - local.app_env_domain, - var.app_env_values #Because of merge order, if present, the value of DOMAIN in .tfvars will overwrite app_env_domain - ) - app_cloudfoundry_service_instances = [ - cloudfoundry_service_instance.postgres_instance.id, - ] - app_service_bindings = concat( - local.app_cloudfoundry_service_instances, - ) - postgres_service_name = "${var.service_name}-postgres-${var.environment}" - web_app_name = "${var.service_name}-${var.environment}" - cms_app_name = "${var.service_name}-cms-${var.environment}" -} diff --git a/terraform/app/modules/paas/versions.tf b/terraform/app/modules/paas/versions.tf deleted file mode 100644 index 052f5a94..00000000 --- a/terraform/app/modules/paas/versions.tf +++ /dev/null @@ -1,9 +0,0 @@ -terraform { - required_version = ">= 0.14.0" - required_providers { - cloudfoundry = { - source = "cloudfoundry-community/cloudfoundry" - version = ">= 0.14.2" - } - } -} diff --git a/terraform/app/output.tf b/terraform/app/output.tf deleted file mode 100644 index 72b2b586..00000000 --- a/terraform/app/output.tf +++ /dev/null @@ -1,14 +0,0 @@ -output docker_image { - value = module.paas.docker_image - description = "Docker image - repository:tag" -} - -output docker_tag { - value = module.paas.docker_tag - description = "Docker tag" -} - - -output workspace { - value = terraform.workspace -} diff --git a/terraform/app/terraform.tf b/terraform/app/terraform.tf deleted file mode 100644 index f82bb61b..00000000 --- a/terraform/app/terraform.tf +++ /dev/null @@ -1,49 +0,0 @@ -/* -For username / password authentication: -- user -- password -For SSO authentication -- sso_passcode -- store_tokens_path = /path/to/local/file -*/ - -provider cloudfoundry { - api_url = var.paas_api_url - password = var.paas_password != "" ? var.paas_password : null - sso_passcode = var.paas_sso_passcode != "" ? var.paas_sso_passcode : null - store_tokens_path = "./tokens" - user = var.paas_user != "" ? var.paas_user : null - -} - -/* -Store infrastructure state in a remote store (instead of local machine): -https://www.terraform.io/docs/state/purpose.html -*/ -terraform { - - backend "s3" { - key = "terraform.tfstate" - region = "eu-west-2" - encrypt = "true" - } -} - -module paas { - source = "./modules/paas" - - environment = var.environment - app_docker_image = var.paas_app_docker_image - app_env_values = local.paas_app_env_values - app_start_timeout = var.paas_app_start_timeout - app_stopped = var.paas_app_stopped - service_name = local.service_name - postgres_create_timeout = var.paas_postgres_create_timeout - postgres_service_plan = var.paas_postgres_service_plan - space_name = var.paas_space_name - web_app_deployment_strategy = var.paas_web_app_deployment_strategy - web_app_instances = var.paas_web_app_instances - web_app_memory = var.paas_web_app_memory - web_app_start_command = var.paas_web_app_start_command - cms_app_start_command = var.paas_cms_app_start_command -} diff --git a/terraform/app/variables.tf b/terraform/app/variables.tf deleted file mode 100644 index 3ddb7b33..00000000 --- a/terraform/app/variables.tf +++ /dev/null @@ -1,100 +0,0 @@ -variable environment {} - - -# Gov.UK PaaS -variable paas_api_url { -} - -variable paas_password { - default = "" -} - -variable paas_app_docker_image { - default = "" -} - -variable paas_app_start_timeout { - default = 300 -} - -variable paas_app_stopped { - default = false -} - -variable app_environment { - default = "dev" -} - -variable paas_postgres_create_timeout { - default = "15m" -} - -variable paas_postgres_service_plan { - default = "tiny-unencrypted-11" -} - -variable paas_redis_service_plan { - default = "tiny-4_x" -} - -variable paas_space_name { -} - -variable paas_sso_passcode { - default = "" -} - -variable paas_store_tokens_path { - default = "" -} - -variable paas_user { - default = "" -} - -variable paas_web_app_deployment_strategy { - default = "blue-green" -} - -variable paas_web_app_instances { - default = 1 -} - -variable paas_web_app_memory { - default = 512 -} - -variable paas_web_app_start_command { - default = "bundle exec rails s -b 0.0.0.0" -} - -variable paas_cms_app_start_command { - default = "bundle exec rake db:prepare && bundle exec rails s -b 0.0.0.0" -} - -variable paas_worker_app_deployment_strategy { - default = "blue-green" -} - -variable paas_worker_app_instances { - default = 1 -} - -variable paas_worker_app_memory { - default = 512 -} - -variable secret_paas_app_env_values { - default = {} - type = map(string) -} - -locals { - paas_app_env_yml_values = yamldecode(file("${path.module}/../workspace-variables/${var.app_environment}_app_env.yml")) - paas_app_env_values = merge( - local.paas_app_env_yml_values, - var.secret_paas_app_env_values - ) - is_production = var.environment == "production" - service_name = "eyfs" -} diff --git a/terraform/app/versions.tf b/terraform/app/versions.tf deleted file mode 100644 index 052f5a94..00000000 --- a/terraform/app/versions.tf +++ /dev/null @@ -1,9 +0,0 @@ -terraform { - required_version = ">= 0.14.0" - required_providers { - cloudfoundry = { - source = "cloudfoundry-community/cloudfoundry" - version = ">= 0.14.2" - } - } -} diff --git a/terraform/workspace-variables/dev.tfvars b/terraform/workspace-variables/dev.tfvars deleted file mode 100644 index d3527569..00000000 --- a/terraform/workspace-variables/dev.tfvars +++ /dev/null @@ -1,13 +0,0 @@ -# Platform -environment = "dev" -app_environment = "dev" - -# Gov.UK PaaS -paas_api_url = "https://api.london.cloud.service.gov.uk" -paas_space_name = "eyfs-dev" -paas_postgres_service_plan = "tiny-unencrypted-11" -paas_app_start_timeout = "360" -paas_app_stopped = false -paas_web_app_deployment_strategy = "blue-green" -paas_web_app_instances = 1 -paas_web_app_memory = 1024 \ No newline at end of file diff --git a/terraform/workspace-variables/dev_app_env.yml b/terraform/workspace-variables/dev_app_env.yml deleted file mode 100644 index 3d5c4c67..00000000 --- a/terraform/workspace-variables/dev_app_env.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -RACK_ENV: production -RAILS_ENV: deployed_development -NODE_ENV: production -RAILS_LOG_TO_STDOUT: true -RAILS_MAX_THREADS: 5 -RAILS_SERVE_STATIC_FILES: true -SERVICE_TYPE: web -DATABASE_URL: postgres://postgres@localhost:5432 -FEEDBACK_URL: https://forms.office.com/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-e5vHvNwH1tNvj-UhV9eyZZUM1pQNEtCN0YyVVdFVkpOUVNXNUlZNTdOUC4u -SIGNUP_URL: https://forms.office.com.mcas.ms/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-e5vHvNwH1tNvj-UhV9eyZZUQlg3SlFPTVZIRlFaVDY5MzJQQUxQTk0yQy4u diff --git a/terraform/workspace-variables/preprod.tfvars b/terraform/workspace-variables/preprod.tfvars deleted file mode 100644 index 33466754..00000000 --- a/terraform/workspace-variables/preprod.tfvars +++ /dev/null @@ -1,14 +0,0 @@ -# Platform -environment = "preprod" -app_environment = "preprod" - -# Gov.UK PaaS -paas_api_url = "https://api.london.cloud.service.gov.uk" -paas_space_name = "eyfs-pre-prod" -paas_postgres_service_plan = "small-ha-11" -paas_app_start_timeout = "180" -paas_app_stopped = false -paas_postgres_create_timeout = "30m" -paas_web_app_deployment_strategy = "blue-green" -paas_web_app_instances = 1 -paas_web_app_memory = 512 \ No newline at end of file diff --git a/terraform/workspace-variables/preprod_app_env.yml b/terraform/workspace-variables/preprod_app_env.yml deleted file mode 100644 index 29cdcbc4..00000000 --- a/terraform/workspace-variables/preprod_app_env.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -RACK_ENV: production -RAILS_ENV: staging -NODE_ENV: production -RAILS_LOG_TO_STDOUT: true -RAILS_MAX_THREADS: 5 -RAILS_SERVE_STATIC_FILES: true -SERVICE_TYPE: web -DATABASE_URL: postgres://postgres@localhost:5432 -DATABASE_NAME: eyfs-preprod-database -FEEDBACK_URL: https://forms.office.com/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-e5vHvNwH1tNvj-UhV9eyZZUM1pQNEtCN0YyVVdFVkpOUVNXNUlZNTdOUC4u -SIGNUP_URL: https://forms.office.com.mcas.ms/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-e5vHvNwH1tNvj-UhV9eyZZUQlg3SlFPTVZIRlFaVDY5MzJQQUxQTk0yQy4u diff --git a/terraform/workspace-variables/prod.tfvars b/terraform/workspace-variables/prod.tfvars deleted file mode 100644 index b168c9ba..00000000 --- a/terraform/workspace-variables/prod.tfvars +++ /dev/null @@ -1,15 +0,0 @@ -# Platform -environment = "prod" -app_environment = "prod" - -# Gov.UK PaaS -paas_api_url = "https://api.london.cloud.service.gov.uk" -paas_space_name = "eyfs-prod" -paas_postgres_service_plan = "small-ha-11" -paas_app_start_timeout = "500" -paas_app_stopped = false -paas_postgres_create_timeout = "30m" -paas_web_app_deployment_strategy = "blue-green" -paas_web_app_instances = 3 -paas_web_app_memory = 512 -paas_cms_app_start_command = "bundle exec rake db:prepare && bundle exec rails s -b 0.0.0.0" \ No newline at end of file diff --git a/terraform/workspace-variables/prod_app_env.yml b/terraform/workspace-variables/prod_app_env.yml deleted file mode 100644 index 379e854d..00000000 --- a/terraform/workspace-variables/prod_app_env.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -RACK_ENV: production -RAILS_ENV: production -NODE_ENV: production -RAILS_LOG_TO_STDOUT: true -RAILS_MAX_THREADS: 5 -RAILS_SERVE_STATIC_FILES: true -SERVICE_TYPE: web -DATABASE_URL: postgres://postgres@localhost:5432 -DATABASE_NAME: eyfs-prod-database -FEEDBACK_URL: https://forms.office.com/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-e5vHvNwH1tNvj-UhV9eyZZUM1pQNEtCN0YyVVdFVkpOUVNXNUlZNTdOUC4u -SIGNUP_URL: https://forms.office.com.mcas.ms/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-e5vHvNwH1tNvj-UhV9eyZZUQlg3SlFPTVZIRlFaVDY5MzJQQUxQTk0yQy4u diff --git a/terraform/workspace-variables/review.tfvars b/terraform/workspace-variables/review.tfvars deleted file mode 100644 index 33b4223d..00000000 --- a/terraform/workspace-variables/review.tfvars +++ /dev/null @@ -1,14 +0,0 @@ -# Platform -environment = "dev" -app_environment = "review" - -# Gov.UK PaaS -paas_api_url = "https://api.london.cloud.service.gov.uk" -paas_space_name = "eyfs-dev" -paas_postgres_service_plan = "tiny-unencrypted-11" -paas_app_start_timeout = "360" -paas_app_stopped = false -paas_web_app_deployment_strategy = "blue-green" -paas_web_app_instances = 1 -paas_web_app_memory = 1024 -paas_cms_app_start_command = "bundle exec rake db:prepare db:seed && bundle exec rails s -b 0.0.0.0" diff --git a/terraform/workspace-variables/review_app_env.yml b/terraform/workspace-variables/review_app_env.yml deleted file mode 100644 index 3d5c4c67..00000000 --- a/terraform/workspace-variables/review_app_env.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -RACK_ENV: production -RAILS_ENV: deployed_development -NODE_ENV: production -RAILS_LOG_TO_STDOUT: true -RAILS_MAX_THREADS: 5 -RAILS_SERVE_STATIC_FILES: true -SERVICE_TYPE: web -DATABASE_URL: postgres://postgres@localhost:5432 -FEEDBACK_URL: https://forms.office.com/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-e5vHvNwH1tNvj-UhV9eyZZUM1pQNEtCN0YyVVdFVkpOUVNXNUlZNTdOUC4u -SIGNUP_URL: https://forms.office.com.mcas.ms/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-e5vHvNwH1tNvj-UhV9eyZZUQlg3SlFPTVZIRlFaVDY5MzJQQUxQTk0yQy4u diff --git a/terraform/workspace-variables/sandbox.tfvars b/terraform/workspace-variables/sandbox.tfvars deleted file mode 100644 index 3d5b854a..00000000 --- a/terraform/workspace-variables/sandbox.tfvars +++ /dev/null @@ -1,15 +0,0 @@ -# Platform -environment = "sandbox" -app_environment = "sandbox" - -# Gov.UK PaaS -paas_api_url = "https://api.london.cloud.service.gov.uk" -paas_space_name = "eyfs-sandbox" -paas_postgres_service_plan = "small-11" -paas_app_start_timeout = "180" -paas_app_stopped = "false" -paas_postgres_create_timeout = "30m" -paas_web_app_deployment_strategy = "blue-green" -paas_web_app_instances = 1 -paas_web_app_memory = 512 -paas_cms_app_start_command = "bundle exec rake db:prepare" diff --git a/terraform/workspace-variables/sandbox_app_env.yml b/terraform/workspace-variables/sandbox_app_env.yml deleted file mode 100644 index d0f91583..00000000 --- a/terraform/workspace-variables/sandbox_app_env.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- - RACK_ENV: production - RAILS_ENV: production - NODE_ENV: production - RAILS_LOG_TO_STDOUT: true - RAILS_MAX_THREADS: 5 - RAILS_SERVE_STATIC_FILES: true - SERVICE_TYPE: web - DATABASE_URL: postgres://postgres@localhost:5432 - DATABASE_NAME: eyfs-sandbox-database - SEND_EMAILS_TO: brett.mchargue@education.gov.uk - FEEDBACK_URL: https://forms.office.com/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-e5vHvNwH1tNvj-UhV9eyZZUM1pQNEtCN0YyVVdFVkpOUVNXNUlZNTdOUC4u - SIGNUP_URL: https://forms.office.com.mcas.ms/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-e5vHvNwH1tNvj-UhV9eyZZUQlg3SlFPTVZIRlFaVDY5MzJQQUxQTk0yQy4u diff --git a/terraform/workspace-variables/test.tfvars b/terraform/workspace-variables/test.tfvars deleted file mode 100644 index 602e84a3..00000000 --- a/terraform/workspace-variables/test.tfvars +++ /dev/null @@ -1,13 +0,0 @@ -# Platform -environment = "test" -app_environment = "test" - -# Gov.UK PaaS -paas_api_url = "https://api.london.cloud.service.gov.uk" -paas_space_name = "eyfs-test" -paas_postgres_service_plan = "tiny-unencrypted-11" -paas_app_start_timeout = "180" -paas_app_stopped = false -paas_web_app_deployment_strategy = "blue-green" -paas_web_app_instances = 1 -paas_web_app_memory = 512 \ No newline at end of file diff --git a/terraform/workspace-variables/test_app_env.yml b/terraform/workspace-variables/test_app_env.yml deleted file mode 100644 index 8842b1fe..00000000 --- a/terraform/workspace-variables/test_app_env.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -RACK_ENV: production -RAILS_ENV: production -NODE_ENV: production -RAILS_LOG_TO_STDOUT: true -RAILS_MAX_THREADS: 5 -RAILS_SERVE_STATIC_FILES: true -SERVICE_TYPE: web -DATABASE_URL: postgres://postgres@localhost:5432 -DATABASE_NAME: eyfs-test-database -FEEDBACK_URL: https://forms.office.com/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-e5vHvNwH1tNvj-UhV9eyZZUM1pQNEtCN0YyVVdFVkpOUVNXNUlZNTdOUC4u -SIGNUP_URL: https://forms.office.com.mcas.ms/Pages/ResponsePage.aspx?id=yXfS-grGoU2187O4s0qC-e5vHvNwH1tNvj-UhV9eyZZUQlg3SlFPTVZIRlFaVDY5MzJQQUxQTk0yQy4u