diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 375bc0c77..8d22e264e 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,4 +1,6 @@ //= link_tree ../images //= link application.js -//= link design-system.js //= link application.css + +//= link legacy-application.js +//= link legacy-application.css diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 49d3c84ab..499c0308d 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,23 +1,2 @@ -//= require select2 -//= require jquery-ui/widgets/sortable -//= require moment -//= require mousetrap -//= require jquery-ui.custom.min -//= require_directory ./vendor -//= require_directory . -//= require_directory ./modules -//= require jquery_nested_form - -// System wide behaviours -$(function () { - $('a.preview').attr('target', '_blank') - $('form.preview').attr('target', '_blank') - $('.select2').select2({ allowClear: true }) -}) - -// System wide library functions -var GovUKGuideUtils = { // eslint-disable-line no-unused-vars - convertToSlug: function (title) { - return title.toLowerCase().replace(/[^\w ]+/g, '').replace(/ +/g, '-') - } -} +//= require govuk_publishing_components/dependencies +//= require govuk_publishing_components/all_components \ No newline at end of file diff --git a/app/assets/javascripts/design-system.js b/app/assets/javascripts/design-system.js deleted file mode 100644 index 499c0308d..000000000 --- a/app/assets/javascripts/design-system.js +++ /dev/null @@ -1,2 +0,0 @@ -//= require govuk_publishing_components/dependencies -//= require govuk_publishing_components/all_components \ No newline at end of file diff --git a/app/assets/javascripts/legacy-application.js b/app/assets/javascripts/legacy-application.js new file mode 100644 index 000000000..49d3c84ab --- /dev/null +++ b/app/assets/javascripts/legacy-application.js @@ -0,0 +1,23 @@ +//= require select2 +//= require jquery-ui/widgets/sortable +//= require moment +//= require mousetrap +//= require jquery-ui.custom.min +//= require_directory ./vendor +//= require_directory . +//= require_directory ./modules +//= require jquery_nested_form + +// System wide behaviours +$(function () { + $('a.preview').attr('target', '_blank') + $('form.preview').attr('target', '_blank') + $('.select2').select2({ allowClear: true }) +}) + +// System wide library functions +var GovUKGuideUtils = { // eslint-disable-line no-unused-vars + convertToSlug: function (title) { + return title.toLowerCase().replace(/[^\w ]+/g, '').replace(/ +/g, '-') + } +} diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 80439a259..eba0417c1 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,25 +1,2 @@ -@import "govuk_admin_template"; -@import "select2"; -@import "./vendor/select2-bootstrap"; -@import "colors"; -@import "bootstrap_and_overrides"; -@import "forms"; - -// Components -@import "sidebar_nav"; -@import "sortable_accordion"; -@import "sortable_table"; -@import "panel_part"; -@import "diff"; -@import "notes"; -@import "workflow"; -@import "broken_links_report"; -@import "error_summary"; - -// Pages -@import "downtime"; -@import "smart_answer_builder"; -@import "smart_answer_flowchart"; - // GOVUK Design System @import "govuk_publishing_components/all_components"; diff --git a/app/assets/stylesheets/legacy-application.scss b/app/assets/stylesheets/legacy-application.scss new file mode 100644 index 000000000..80439a259 --- /dev/null +++ b/app/assets/stylesheets/legacy-application.scss @@ -0,0 +1,25 @@ +@import "govuk_admin_template"; +@import "select2"; +@import "./vendor/select2-bootstrap"; +@import "colors"; +@import "bootstrap_and_overrides"; +@import "forms"; + +// Components +@import "sidebar_nav"; +@import "sortable_accordion"; +@import "sortable_table"; +@import "panel_part"; +@import "diff"; +@import "notes"; +@import "workflow"; +@import "broken_links_report"; +@import "error_summary"; + +// Pages +@import "downtime"; +@import "smart_answer_builder"; +@import "smart_answer_flowchart"; + +// GOVUK Design System +@import "govuk_publishing_components/all_components"; diff --git a/app/helpers/navigation_items_helper.rb b/app/helpers/navigation_items_helper.rb new file mode 100644 index 000000000..a8de089d2 --- /dev/null +++ b/app/helpers/navigation_items_helper.rb @@ -0,0 +1,29 @@ +module NavigationItemsHelper + # [ + # { + # text: "Publications", href: root_path + # }, + # ].concat(current_user.govuk_editor? ? [ + # { text: 'Add artefact', href: new_artefact_path }, + # { text: 'Downtime', href: downtimes_path } + # ]: []).concat([ + # { text: 'Reports', href: reports_path }, + # { text: 'Search by user', href: user_search_path }, + # { text: 'Sign out', href: '/auth/gds/sign_out' } + # ] + + def navigation_items(is_editor) + list = [ + { text: "Publications", href: root_path } + ] + + if is_editor + list << { text: 'Add artefact', href: new_artefact_path } + list << { text: 'Downtime', href: downtimes_path } + end + + list << { text: 'Reports', href: reports_path } + list << { text: 'Search by user', href: user_search_path } + list << { text: 'Sign out', href: '/auth/gds/sign_out' } + end +end \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6d92d319d..db47a5b1d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,7 +5,7 @@ <%= favicon_link_tag "govuk_admin_template/#{favicon}" %> <% end %> <% content_for :head do %> - <%= stylesheet_link_tag "application", :media => "all" %> + <%= stylesheet_link_tag "legacy-application", :media => "all" %> <%= csrf_meta_tag %> <%= yield :extra_headers %> <% end %> @@ -54,7 +54,7 @@ <% content_for :footer_version, ENV.fetch("SENTRY_RELEASE", "null")[0..18] %> <% content_for :body_end do %> - <%= javascript_include_tag "application" %> + <%= javascript_include_tag "legacy-application" %> <%= yield :extra_javascript %> <% end %> diff --git a/app/views/layouts/design_system.html.erb b/app/views/layouts/design_system.html.erb index 180b2eba6..61a22a8c8 100644 --- a/app/views/layouts/design_system.html.erb +++ b/app/views/layouts/design_system.html.erb @@ -2,6 +2,8 @@ <%= render "govuk_publishing_components/components/layout_for_admin", product_title: "Publisher", browser_title: yield(:page_title), environment: environment do %> + <% render "layouts/google_tag_manager" %> + <%= render "govuk_publishing_components/components/skip_link" %> <% user = current_user %> @@ -9,21 +11,29 @@ <%= render "govuk_publishing_components/components/layout_header", { product_name: "Publisher", environment: environment, - navigation_items: [ - { - text: "Publications", href: root_path - }, - ].concat(current_user.govuk_editor? ? [ - { text: 'Add artefact', href: new_artefact_path }, - { text: 'Downtime', href: downtimes_path } - ]: []).concat([ - { text: 'Reports', href: reports_path }, - { text: 'Search by user', href: user_search_path }, - { text: 'Sign out', href: '/auth/gds/sign_out' } - ]), + navigation_items: navigation_items(current_user.govuk_editor?) } %>
+ <% [:success, :info, :warning, :danger, :notice, :alert].select { |k| flash[k].present? }.each do |k| %> + <% + case k + when :notice + alert_class = "success" + when :alert + alert_class = "danger" + else + alert_class = k + end + %> +
+ <%= flash[k] %> +
+ <% end %> + <%= yield %>
@@ -31,5 +41,3 @@ navigation: [], } %> <% end %> - -<%= javascript_include_tag "design-system" %>