Skip to content

Commit

Permalink
Create new assets for transition to design system
Browse files Browse the repository at this point in the history
Rename `application.js` and `application.scss` to
`legacy-application.scss` and `legacy-application.js` in
preparation to use the `layout_for_admin` component from
the govuk_publishing_components gem. Update the configuration
manifest and point `application.html.erb` to the new legacy
asset files.
  • Loading branch information
patrickpatrickpatrick committed Jan 24, 2024
1 parent e9ae3e4 commit 1506373
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 48 deletions.
3 changes: 3 additions & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//= link_tree ../images
//= link application.js
//= link application.css

//= link legacy-application.js
//= link legacy-application.css
25 changes: 2 additions & 23 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions app/assets/javascripts/legacy-application.js
Original file line number Diff line number Diff line change
@@ -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, '-')
}
}
23 changes: 0 additions & 23 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -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";
25 changes: 25 additions & 0 deletions app/assets/stylesheets/legacy-application.scss
Original file line number Diff line number Diff line change
@@ -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";
4 changes: 2 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down Expand Up @@ -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 %>
Expand Down

0 comments on commit 1506373

Please sign in to comment.