From 71850b561ccc5cd862ac8d8af82614061782818f Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Mon, 30 Apr 2018 11:25:28 +0000 Subject: [PATCH 1/3] Remove subscription links component - update to use component from gem --- .../components/_subscription-links.scss | 40 ------------------- .../components/_subscription-links.html.erb | 21 ---------- .../components/docs/subscription-links.yml | 17 -------- .../content_items/travel_advice.html.erb | 2 +- test/components/subscription_links_test.rb | 27 ------------- .../content_items_controller_test.rb | 1 + 6 files changed, 2 insertions(+), 106 deletions(-) delete mode 100644 app/assets/stylesheets/components/_subscription-links.scss delete mode 100644 app/views/components/_subscription-links.html.erb delete mode 100644 app/views/components/docs/subscription-links.yml delete mode 100644 test/components/subscription_links_test.rb diff --git a/app/assets/stylesheets/components/_subscription-links.scss b/app/assets/stylesheets/components/_subscription-links.scss deleted file mode 100644 index c8106d07a..000000000 --- a/app/assets/stylesheets/components/_subscription-links.scss +++ /dev/null @@ -1,40 +0,0 @@ -.app-c-subscription-links { - @include bold-19; - - .app-c-subscription-links__list { - list-style: none; - margin-left: -$gutter-half / 2; - margin-right: -$gutter-half / 2; - } - - .app-c-subscription-links__list-item { - display: inline-block; - margin-left: $gutter-half / 2; - margin-right: $gutter-half / 2; - margin-bottom: $gutter / 2; - } - - .app-c-subscription-links__link { - text-decoration: none; - padding-left: 28px; - background-repeat: no-repeat; - background-position: 0 20%; - - @include media(tablet) { - background-position: 0 35%; - } - } - - .app-c-subscription-links__link--feed { - background-image: image-url("feed-icon-black.png"); - } - - .app-c-subscription-links__link--email-alerts { - background-image: image-url("mail-icon.png"); - - @include device-pixel-ratio() { - background-image: image-url("mail-icon-x2.png"); - background-size: 20px 14px; - } - } -} diff --git a/app/views/components/_subscription-links.html.erb b/app/views/components/_subscription-links.html.erb deleted file mode 100644 index 5708d93c1..000000000 --- a/app/views/components/_subscription-links.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<% - email_signup_link ||= false - feed_link ||= false -%> -<% if email_signup_link || feed_link %> - -<% end %> diff --git a/app/views/components/docs/subscription-links.yml b/app/views/components/docs/subscription-links.yml deleted file mode 100644 index 95b409f0b..000000000 --- a/app/views/components/docs/subscription-links.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Subscription links -description: Links to ‘Get email alerts’ and ‘Subscribe to feed’ -accessibility_criteria: | - Icons in subscription links must be presentational and ignored by screen readers. -shared_accessibility_criteria: - - link -examples: - default: - data: - email_signup_link: '/foreign-travel-advice/singapore/email-signup' - feed_link: '/foreign-travel-advice/singapore.atom' - with_only_email_signup_link: - data: - email_signup_link: '/foreign-travel-advice/singapore/email-signup' - with_only_feed_link: - data: - feed_link: '/foreign-travel-advice/singapore.atom' diff --git a/app/views/content_items/travel_advice.html.erb b/app/views/content_items/travel_advice.html.erb index 862f349c6..d4742c527 100644 --- a/app/views/content_items/travel_advice.html.erb +++ b/app/views/content_items/travel_advice.html.erb @@ -27,7 +27,7 @@ - <%= render 'components/subscription-links', email_signup_link: @content_item.email_signup_link, feed_link: @content_item.feed_link %> + <%= render 'govuk_publishing_components/components/subscription-links', email_signup_link: @content_item.email_signup_link, feed_link: @content_item.feed_link %> diff --git a/test/components/subscription_links_test.rb b/test/components/subscription_links_test.rb deleted file mode 100644 index ad4f96fc0..000000000 --- a/test/components/subscription_links_test.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'component_test_helper' - -class SubscriptionLinksTest < ComponentTestCase - def component_name - "subscription-links" - end - - test "renders nothing when no parameters are given" do - assert_empty render_component({}) - end - - test "renders an email signup link" do - render_component(email_signup_link: '/email-signup') - assert_select ".app-c-subscription-links__link--email-alerts[href=\"/email-signup\"]", text: "Get email alerts" - end - - test "renders a feed link" do - render_component(feed_link: 'singapore.atom') - assert_select ".app-c-subscription-links__link--feed[href=\"singapore.atom\"]", text: "Subscribe to feed" - end - - test "renders both email signup and feed links" do - render_component(email_signup_link: 'email-signup', feed_link: 'singapore.atom') - assert_select ".app-c-subscription-links__link--email-alerts[href=\"email-signup\"]", text: "Get email alerts" - assert_select ".app-c-subscription-links__link--feed[href=\"singapore.atom\"]", text: "Subscribe to feed" - end -end diff --git a/test/controllers/content_items_controller_test.rb b/test/controllers/content_items_controller_test.rb index ccc5e6cab..96b24e448 100644 --- a/test/controllers/content_items_controller_test.rb +++ b/test/controllers/content_items_controller_test.rb @@ -83,6 +83,7 @@ class ContentItemsControllerTest < ActionController::TestCase assert_response :redirect assert_redirected_to content_item['base_path'] end + test "returns HTML when an unspecific accepts header is requested (eg by IE8 and below)" do request.headers["Accept"] = "*/*" content_item = content_store_has_schema_example('travel_advice', 'full-country') From 003c274f3c9d18e0a291b0ed10544e7d35d9bbe4 Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Tue, 1 May 2018 13:23:28 +0000 Subject: [PATCH 2/3] fix --- app/assets/images/feed-icon-black.png | Bin 382 -> 0 bytes app/assets/images/mail-icon-x2.png | Bin 256 -> 0 bytes app/assets/images/mail-icon.png | Bin 213 -> 0 bytes 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/assets/images/feed-icon-black.png delete mode 100644 app/assets/images/mail-icon-x2.png delete mode 100644 app/assets/images/mail-icon.png diff --git a/app/assets/images/feed-icon-black.png b/app/assets/images/feed-icon-black.png deleted file mode 100644 index 643830f580e5c8f5b0e11a1cc2d4c64c3f3b8377..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 382 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh3?wzC-F*zCssnsNT!HjJfxQ(n8-R9elmz(& zGwk-{Vt#ky_{M(LPfzym*fQ_e+xu%5#fAGj+gY3ID@lnyyLYB8T}?o9#_lMfo-R)p z#}JO|y4~SI%?2XOt-Qx(+_PTd{@p%NZo=OSXU?q=kbZAk%P6mI<6-^%yV~C16X7v0 zYBQKWE%dv+<;Q5O;E?8R6TyUyOe+F}#`A6*% z4Ug87r_Cd#*@{RWoFJBbfT{Ydfapx7g@5Lxw(9x0Em-(-folDqe4cmD+SZ=~g`%gc KpUXO@geCyy$7cBe diff --git a/app/assets/images/mail-icon-x2.png b/app/assets/images/mail-icon-x2.png deleted file mode 100644 index 4625eceb9bb0ea8e0ecbe2d0dd733a3fee6af833..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 256 zcmeAS@N?(olHy`uVBq!ia0vp^8bB<=!3-o-PV+tiQ2{<7uG}EN!^OqT#l^$T%?o4z z0ZER&NTk;9Vo>uv!>8$DedLn?0Fy?mOlRe{Gf zux6^<-~a#jGB1{1BH^xf{hWeziLb})!#_6{1Q#W9Udm?wW6fO7=ldEC9Q2o3}>nV1TI0>d!@ivEtrOuLj@;G4J i*zby;y?(5G|BJcvtd4)FUSJE*F$|urelF{r5}E)J%~*#3 diff --git a/app/assets/images/mail-icon.png b/app/assets/images/mail-icon.png deleted file mode 100644 index 5f63ddea453718b820fd122dc8e2a4f18a89f94b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^B0$W?!VDzuzEV64q*MZYLR^6~4-YSXbj@s?7Em2` zNswPKL&N^_^WP^3++T0-H)qB_pm3?_X9ZE`S>R+@F-zyUTf(|dbc z8xKl*7`_Sna4$D*Pc^r2$H{Hg*ODu6qI2yTKnoZ=UHx3vIVCg!0H=~b*Z=?k From 0b2cf9072445f547c474eae65a32b96ebfeac96c Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Tue, 1 May 2018 15:28:23 +0000 Subject: [PATCH 3/3] Bump gem --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index b25b6d21b..76faf42e4 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem 'gds-api-adapters', '~> 52.5' gem 'govuk_ab_testing', '~> 2.4' gem 'govuk_app_config', '~> 1.4' gem 'govuk_frontend_toolkit', '~> 7.4' -gem 'govuk_publishing_components', '~> 7.0.0' +gem 'govuk_publishing_components', '~> 7.1.0' gem 'plek', '~> 2.1' gem 'slimmer', '~> 12.1' diff --git a/Gemfile.lock b/Gemfile.lock index 4591e7445..b50dd423e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -119,7 +119,7 @@ GEM rubocop-rspec (~> 1.19.0) scss_lint govuk_ab_testing (2.4.1) - govuk_app_config (1.4.2) + govuk_app_config (1.5.0) logstasher (~> 1.2.2) sentry-raven (~> 2.7.1) statsd-ruby (~> 1.4.0) @@ -127,7 +127,7 @@ GEM govuk_frontend_toolkit (7.5.0) railties (>= 3.1.0) sass (>= 3.2.0) - govuk_publishing_components (7.0.0) + govuk_publishing_components (7.1.0) govspeak (>= 5.0.3) govuk_app_config govuk_frontend_toolkit @@ -368,7 +368,7 @@ DEPENDENCIES govuk_ab_testing (~> 2.4) govuk_app_config (~> 1.4) govuk_frontend_toolkit (~> 7.4) - govuk_publishing_components (~> 7.0.0) + govuk_publishing_components (~> 7.1.0) govuk_schemas (~> 3.1) htmlentities (~> 4.3) jasmine-rails