diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 7cf7afeb3..c88216d2f 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -6,12 +6,13 @@ $govuk-new-link-styles: true; // Components from govuk_publishing_components gem @import 'govuk_publishing_components/govuk_frontend_support'; +@import 'govuk_publishing_components/component_support'; + @import 'govuk_publishing_components/components/attachment'; @import 'govuk_publishing_components/components/back-link'; @import 'govuk_publishing_components/components/big-number'; @import 'govuk_publishing_components/components/breadcrumbs'; @import 'govuk_publishing_components/components/button'; -@import 'govuk_publishing_components/component_support'; @import 'govuk_publishing_components/components/contents-list'; @import 'govuk_publishing_components/components/contextual-sidebar'; @import 'govuk_publishing_components/components/details'; @@ -27,6 +28,8 @@ $govuk-new-link-styles: true; @import 'govuk_publishing_components/components/hint'; @import 'govuk_publishing_components/components/image-card'; @import 'govuk_publishing_components/components/input'; +@import 'govuk_publishing_components/components/inset-text'; +@import 'govuk_publishing_components/components/intervention'; @import 'govuk_publishing_components/components/inverse-header'; @import 'govuk_publishing_components/components/label'; @import 'govuk_publishing_components/components/lead-paragraph'; @@ -92,24 +95,3 @@ $govuk-new-link-styles: true; @import 'views/answer'; @import 'views/help-page'; @import 'views/guide'; -@import 'views/get-involved'; - -.travel-advice-notice { - background-color: govuk-colour("light-grey"); - border: 1px solid $govuk-border-colour; - margin-bottom: govuk-spacing(7); - position: relative; -} - -.travel-advice-notice__header { - padding: govuk-spacing(4) govuk-spacing(4) 0 govuk-spacing(3); -} - -.travel-advice-notice__content { - margin-top: - govuk-spacing(3); - padding: 0 govuk-spacing(4) 0 govuk-spacing(9); -} - -.travel-advice-notice__icon { - margin-left: govuk-spacing(3); -} diff --git a/app/assets/stylesheets/views/_get-involved.scss b/app/assets/stylesheets/views/_get-involved.scss deleted file mode 100644 index 9df87fe7d..000000000 --- a/app/assets/stylesheets/views/_get-involved.scss +++ /dev/null @@ -1,126 +0,0 @@ -.get-involved { - // Disabled due to many govuk_publishing_components requiring IDs over classes. - // stylelint-disable selector-max-id - - list-style: none; - - .govuk-link { - line-height: 1.16; - } - - .govuk-section-break { - clear: both; - } - - #engage-with-government, - #take-part { - clear: both; - border-bottom-style: solid; - padding-bottom: 5px; - border-bottom-width: 5px; - font-weight: normal; - } - - .respond-to-consultations { - .govuk-grid-column-two-thirds-from-desktop { - padding: 20px 0 0; - margin-bottom: 20px; - } - } - - #respond-heading { - padding: 0; - } - - .big-numbers { - padding: 0; - } - - .recently-opened { - padding: 0; - } - - .govuk-grid-column-two-thirds-from-desktop { - margin-bottom: 50px; - padding: 0; - } - - .govuk-grid-column-one-third-from-desktop { - padding: 0; - } - - .consultation-lists { - padding: 0; - } - - .gem-c-big-number { - margin-top: 10px; - } - - .consultation-closing-soon { - background-color: govuk-colour("dark-blue"); - padding: govuk-spacing(3) govuk-spacing(3); - } - - #closing-soon-title { - border-bottom-style: solid; - padding-bottom: 5px; - border-bottom-width: 1px; - font-weight: normal; - } - - #closing-soon-link { - @include govuk-font(19); - margin-bottom: 5px; - font-weight: bold; - } - - #consultation-title { - @include govuk-font(19); - } - - .consultation-list-row { - float: left; - padding: 0 0 10px; - } - - .consultation-attributes { - @include govuk-font(14); - padding-top: 5px; - - li { - float: left; - padding-right: 10px; - } - - .consultation-view-link { - font-weight: bold; - margin-right: 30px; //force onto new line - } - } - - #see-all-link { - @include govuk-font(19); - font-weight: bold; - } - - .comment-follow { - li { - border-bottom: 1px solid $govuk-border-colour; - padding: 1px 0 7px; - } - } - - .more-ways { - li { - border-bottom: 1px solid $govuk-border-colour; - padding: 1px 0 7px; - } - } - - .take-part-pages { - .govuk-grid-column-one-third-from-desktop { - padding: 15px 15px 0; - } - } -} diff --git a/app/assets/stylesheets/views/_travel-advice.scss b/app/assets/stylesheets/views/_travel-advice.scss index fe30f9c92..5b662fef0 100644 --- a/app/assets/stylesheets/views/_travel-advice.scss +++ b/app/assets/stylesheets/views/_travel-advice.scss @@ -23,3 +23,23 @@ display: block; margin-bottom: govuk-spacing(2); } + +.travel-advice-notice { + background-color: govuk-colour("light-grey"); + border: 1px solid $govuk-border-colour; + margin-bottom: govuk-spacing(7); + position: relative; +} + +.travel-advice-notice__header { + padding: govuk-spacing(4) govuk-spacing(4) 0 govuk-spacing(3); +} + +.travel-advice-notice__content { + margin-top: - govuk-spacing(3); + padding: 0 govuk-spacing(4) 0 govuk-spacing(9); +} + +.travel-advice-notice__icon { + margin-left: govuk-spacing(3); +} diff --git a/app/controllers/get_involved_controller.rb b/app/controllers/get_involved_controller.rb index b3f09321f..a39db8b63 100644 --- a/app/controllers/get_involved_controller.rb +++ b/app/controllers/get_involved_controller.rb @@ -5,6 +5,8 @@ def show load_content_item load_get_involved_data @do_not_show_breadcrumbs = true + @recently_opened = filtered_links(@recently_opened_consultations, t("get_involved.closes")) + @recent_outcomes = filtered_links(@recent_consultation_outcomes, t("get_involved.closed")) render template: "content_items/get_involved" end @@ -88,4 +90,52 @@ def retrieve_consultation_outcomes Services.search_api.search(query)["results"] end + + def time_until_closure(consultation) + days_left = (consultation["end_date"].to_date - Time.zone.now.to_date).to_i + case days_left + when :negative?.to_proc + t("get_involved.closed") + when :zero?.to_proc + t("get_involved.closing_today") + when 1 + t("get_involved.closing_tomorrow") + else + t("get_involved.days_left", number_of_days: days_left) + end + end + + def date_microformat(attribute_name) + attribute_name.to_date.strftime("%d %B %Y") + end + + def filtered_links(array, close_status) + array.map do |item| + { + link: { + text: item["title"], + path: item["link"], + description: "#{close_status} #{date_microformat(item['end_date'])}", + }, + metadata: { + public_updated_at: Time.zone.parse(org_acronym(item)), + document_type: org_acronym(item), + }, + } + end + end + +private + + def org_acronym(item) + item["organisations"].map { |org| + org["public_timestamp"] + }.join(", ") + end + + def org_time(item) + item["organisations"].map { |org| + org["acronym"] + }.join(", ") + end end diff --git a/app/helpers/get_involved_helper.rb b/app/helpers/get_involved_helper.rb index 69ce14f95..aa6729285 100644 --- a/app/helpers/get_involved_helper.rb +++ b/app/helpers/get_involved_helper.rb @@ -1,8 +1,4 @@ module GetInvolvedHelper - def date_microformat(attribute_name) - attribute_name.to_date.strftime("%d %B %Y") - end - # Gets the link to the search page for all consultations def get_consultations_link(filters = %w[open_consultations closed_consultations]) "/search/policy-papers-and-consultations?#{filters.to_query('content_store_document_type')}" @@ -16,8 +12,6 @@ def page_class(css_class) content_for(:page_class, css_class) end -private - def time_until_closure(consultation) days_left = (consultation["end_date"].to_date - Time.zone.now.to_date).to_i case days_left diff --git a/app/views/content_items/get_involved.html.erb b/app/views/content_items/get_involved.html.erb index 3cafb6325..a936631ad 100644 --- a/app/views/content_items/get_involved.html.erb +++ b/app/views/content_items/get_involved.html.erb @@ -1,155 +1,225 @@ <% page_title %> -<% page_class "get-involved" %> +<% page_class "govuk-main-wrapper" %> + <%= render "govuk_publishing_components/components/breadcrumbs", { + collapse_on_mobile: true, + breadcrumbs: [ + { + title: "Home", + url: "/" + } + ] + } %> -<%= render "govuk_publishing_components/components/title", { title: t('get_involved.page_heading') } %> -<%= render "govuk_publishing_components/components/lead_paragraph", { text: t('get_involved.intro_paragraph.body_html', - engage_with_government: link_to(t('get_involved.intro_paragraph.engage_with_government'), "#engage-with-government", class: "govuk-link"), - take_part: link_to(t('get_involved.intro_paragraph.take_part'), "#take-part", class: "govuk-link")) } %> +
<%= t('get_involved.your_views') %>
+ <%= render "govuk_publishing_components/components/lead_paragraph", { + text: t('get_involved.intro_paragraph.body_html', + engage_with_government: link_to(t('get_involved.intro_paragraph.engage_with_government'), "#engage-with-government", + class: "govuk-link"), + take_part: link_to(t('get_involved.intro_paragraph.take_part'), "#take-part", + class: "govuk-link")), + margin_bottom: 9 + } %> ++ <%= t('get_involved.your_views') %> +
+ <%# Respond to consultations %> + <%= render "govuk_publishing_components/components/heading", { + text: t('get_involved.respond_to_consultations'), + heading_level: 2, + font_size: "s" + } %> + + <%# Big numbers %> ++ <%= @next_closing_consultation['title'] %> +
+ <%= link_to t('get_involved.read_respond'), @next_closing_consultation['link'], class: "govuk-link" %><%= t('get_involved.petition_paragraph.body_html', - create_a_petition: link_to(t('get_involved.petition_paragraph.create_a_petition'), "https://petition.parliament.uk/", class: "govuk-link", rel: "external")) %> -
+ <%= t('get_involved.petition_paragraph.body_html', create_a_petition: link_to(t('get_involved.petition_paragraph.create_a_petition'), "https://petition.parliament.uk/", class: "govuk-link", rel: "external")) %> +
+<%= t('get_involved.follow_paragraph') %>
++ + <%= t('get_involved.see_all_dept') %> + +
+ <%= render "govuk_publishing_components/components/heading", { + text: t('get_involved.follow_links'), + heading_level: 3, + font_size: "s", + padding: true, + border_top: 2, + } %> + <%= render "govuk_publishing_components/components/list", { + items: [ + sanitize("#{t('get_involved.gov_past')}"), + sanitize("#{ t('get_involved.civil_service_quarterly')}"), + sanitize("#{t('get_involved.make_donation')}"), + sanitize("#{t('get_involved.gds_blog')}"), + sanitize("#{t('get_involved.civil_service')}"), + ] + } %> +<%= t('get_involved.take_part_suggestions') %>
-+ <%= t('get_involved.take_part_suggestions') %> +
+ + <%= render "govuk_publishing_components/components/list", { + items: [ + sanitize("#{t('get_involved.join_ics')}"), + sanitize("#{t('get_involved.neighbourhood_watch')}"), + sanitize("#{t('get_involved.make_donation')}"), + sanitize("#{t('get_involved.gds_blog')}"), + sanitize("#{t('get_involved.school_overseas')}"), + ] + } %>
<%= t('get_involved.follow_paragraph') %>
-<%= t('get_involved.see_all_dept') %>
-<%= t('get_involved.active_blogs') %>
-