govuk_admin_template 6.4.0 → 6.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0dd24b18963f9c4062e5602ebf1acc74f2547732
4
- data.tar.gz: ab99ec8210a401578bf7bf7fc87c680621349d41
2
+ SHA256:
3
+ metadata.gz: 010b3cd14741108d2a2b276944dc9b5b43606a3078f913b6fd41918662f3ec22
4
+ data.tar.gz: cd45ef2f5fe57d5f5a32a93237888ff0fca097ac43c8da7a0f0d9edb4e394fdf
5
5
  SHA512:
6
- metadata.gz: f18cae051147f471b3d9ee2d59d158b452d92c59e74b66940a18ef7142e4ff057103321517a6e7d1be36f4734c72de90645a5067b3caffeffd1f26fddee2ddad
7
- data.tar.gz: ba1069a0a1d28b17aecacee347cf78f9c9f42d43e6110973bfb8ce6922e3cab4b697360de0a14ad0939003ddbe68086943900dc02a7b048bec0d89643ded1445
6
+ metadata.gz: 80e19916ad0dc705653a028d580b0c3372f75629e9ed1a4ee5ff6d41e88a02f574ab7778e0fa13dc5d96b2c7c46dde78dd84cd8b81abb41668bd44ab52cf8b7c
7
+ data.tar.gz: c65437f8401bb0789bfb853dd1df53bcb92c4d0e4a3faee50e772ec55a9294c24fd26c39914c73c36c4824fad43a8b731c87aafbcff53ec7b0685ede97fa0a8f
data/CHANGELOG.md CHANGED
@@ -1,4 +1,22 @@
1
- # Unreleased
1
+ # 6.8.0
2
+
3
+ * Replace the development dependency govuk-lint with rubocop-govuk
4
+ * Fix colour contrast issues flagged by WAVE Web Accessibility Evaluation Tool
5
+ * Ensure govspeak guidance can be navigated to via keyboard tabbing
6
+
7
+ # 6.7.0
8
+
9
+ * Update bootstrap-sass dependency to 3.4.1 (from 3.3.5.1)
10
+
11
+ # 6.6.0
12
+
13
+ * Use the external URL for Signon
14
+ * Explicitly declare a dependency on `plek`
15
+
16
+ # 6.5.0
17
+
18
+ * Remove IE7 support
19
+ * Allow track-click to be customised with a selector
2
20
 
3
21
  # 6.4.0
4
22
 
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # GOV.UK Admin Template
1
+ # GOV.UK Admin Template (DEPRECATED)
2
+
3
+ > **NOTE**: This project is deprecated. New GOV.UK admin applications should be built using the [layout component in govuk_publishing_components](https://govuk-publishing-components.herokuapp.com/component-guide/layout_for_admin). Projects outside of GDS can use the [GOV.UK Design System](https://design-system.service.gov.uk/) directly to build interfaces.
4
+
5
+ ---
2
6
 
3
7
  Styles, scripts and templates wrapped up in a gem for getting up and running with [Bootstrap](http://getbootstrap.com) based backend admin apps.
4
8
 
@@ -5,6 +5,7 @@
5
5
  var that = this;
6
6
 
7
7
  that.start = function(container) {
8
+ var selector = container.data("track-selector") || '.js-track';
8
9
  var trackClick = function() {
9
10
  var category = container.data("track-category"),
10
11
  action = container.data("track-action") || "button-pressed",
@@ -13,7 +14,7 @@
13
14
  GOVUKAdmin.trackEvent(category, action, { label: label });
14
15
  };
15
16
 
16
- container.on("click", ".js-track", trackClick);
17
+ container.on("click", selector, trackClick);
17
18
  }
18
19
  };
19
20
 
@@ -276,13 +276,13 @@ a.list-group-item {
276
276
 
277
277
  .link-muted,
278
278
  .link-muted:visited {
279
- color: $gray-light;
279
+ color: $gray-dark;
280
280
  text-decoration: underline;
281
281
  }
282
282
 
283
283
  .link-muted:hover,
284
284
  .link-muted:focus {
285
- color: $gray;
285
+ color: #000;
286
286
  }
287
287
 
288
288
  .link-inherit,
@@ -304,7 +304,7 @@ a.list-group-item {
304
304
  font-size: 65%;
305
305
  font-weight: normal;
306
306
  line-height: 1.5;
307
- color: $gray-light;
307
+ color: $gray;
308
308
  display: block;
309
309
  }
310
310
 
@@ -360,7 +360,7 @@ a.list-group-item {
360
360
  }
361
361
 
362
362
  .no-content {
363
- color: lighten($gray-light, 20%); // Large text needs a lighter colour for balance
363
+ color: $gray;
364
364
  @extend %large-and-spaced;
365
365
  }
366
366
 
@@ -1,3 +1,7 @@
1
+ $black: #000;
2
+ $gray-dark: #444;
3
+ $blue: #1d70b8;
4
+
1
5
  /*
2
6
  Bootstrap 3.2 made gray-light darker for accessibility and contrast:
3
7
  https://github.com/twbs/bootstrap/releases/tag/v3.2.0
@@ -5,4 +9,41 @@
5
9
  This assumed gray-light was on a light background. We aren't always
6
10
  using it in that way. Reset to the original value #999.
7
11
  */
8
- $gray-light: lighten(#000, 60%);
12
+
13
+ $gray-light: lighten($black, 60%);
14
+
15
+ /*
16
+ Updates a bunch of copy that used to be gray to black for things like labels.
17
+ */
18
+ $text-color: $black;
19
+
20
+ /*
21
+ Updates the input to black so it contrasts with the light gray background.
22
+ */
23
+ $input-color: $black;
24
+
25
+ /*
26
+ Updates muted text to gray so it contrasts with the light gray background.
27
+ */
28
+ $text-muted: $gray-dark;
29
+
30
+ /*
31
+ Updates text in the breadcrumbs to use a darker gray to fix contrast issues.
32
+ */
33
+ $breadcrumb-active-color: $gray-dark;
34
+
35
+ /*
36
+ Updates the spans in headers to use a darker gray to fix contrast issues.
37
+ */
38
+ $headings-small-color: $gray-dark;
39
+
40
+ /*
41
+ Updates the disabled pagination links to use a darker gray to fix contrast issues.
42
+ */
43
+ $pagination-disabled-color: $gray-dark;
44
+
45
+ /*
46
+ Updates the default link to colour to a the same colour used in the
47
+ GOVUK design system. This fixes some contrast issues.
48
+ */
49
+ $link-color: $blue;
@@ -1,5 +1,18 @@
1
1
  @import 'govuk_admin_template/buttons'; // overrides bootstrap buttons
2
2
 
3
+ $govuk-tag-dark-grey: #383f43;
4
+ $govuk-tag-light-gray: #eeefef;
5
+ $govuk-tag-mid-blue: #1d70b8;
6
+ $govuk-tag-white: #fff;
7
+ $govuk-tag-dark-green: #005a30;
8
+ $govuk-tag-light-green: #cce2d8;
9
+ $govuk-tag-dark-blue: #144e81;
10
+ $govuk-tag-light-blue: #d2e2f1;
11
+ $govuk-tag-dark-yellow: #594d00;
12
+ $govuk-tag-light-yellow: #fff7bf;
13
+ $govuk-tag-dark-red: #942514;
14
+ $govuk-tag-light-red: #f6d7d2;
15
+
3
16
  /*
4
17
  The admin gem's navbar has a bottom margin, for correct spacing
5
18
  when the page-header class isn't used. To account for this reduce
@@ -19,8 +32,40 @@
19
32
  .lead {
20
33
  font-weight: normal;
21
34
  color: #555;
35
+ }
36
+
37
+ // Overrides the lables to use same colour scheme as the GOVUK design system
38
+
39
+ .label-default {
40
+ color: $govuk-tag-dark-grey;
41
+ background: $govuk-tag-light-gray;
42
+ }
43
+
44
+ .label-primary {
45
+ color: $govuk-tag-mid-blue;
46
+ background: $govuk-tag-white;
47
+ }
48
+
49
+ .label-success {
50
+ color: $govuk-tag-dark-green;
51
+ background: $govuk-tag-light-green;
52
+ }
53
+
54
+ .label-info {
55
+ color: $govuk-tag-dark-blue;
56
+ background: $govuk-tag-light-blue;
57
+ }
58
+
59
+ .label-warning {
60
+ color: $govuk-tag-dark-yellow;
61
+ background: $govuk-tag-light-yellow;
62
+ }
63
+
64
+ .label-danger {
65
+ color: $govuk-tag-dark-red;
66
+ background: $govuk-tag-light-red;
67
+ }
22
68
 
23
- &.text-muted {
24
- color: $gray-light;
25
- }
69
+ .label {
70
+ font-size: 80%;
26
71
  }
@@ -20,7 +20,7 @@
20
20
  font-size: 11px;
21
21
  font-weight: bold;
22
22
  line-height: $line-height-computed;
23
- color: $gray-light;
23
+ color: $gray;
24
24
  text-transform: uppercase;
25
25
  }
26
26
 
@@ -30,6 +30,11 @@
30
30
  }
31
31
  }
32
32
 
33
+ .nav-tabs .badge {
34
+ color: #fff;
35
+ background: #666;
36
+ }
37
+
33
38
  .nav-list > li > a,
34
39
  .nav-list .nav-header {
35
40
  margin-left: -15px;
@@ -15,18 +15,9 @@
15
15
  vertical-align: top;
16
16
  float: none;
17
17
 
18
- .ie8 &,
19
- .lte-ie7 & {
18
+ .ie8 & {
20
19
  min-height: 20px;
21
20
  }
22
-
23
- .lte-ie7 & {
24
- display: inline;
25
- padding-left: 60px;
26
- background-position: 15px 0.67em;
27
- height: auto;
28
- }
29
-
30
21
  }
31
22
 
32
23
  // Prevent navbar height from collapsing when there's
@@ -102,11 +93,6 @@ header .navbar-header {
102
93
  margin-top: 13px;
103
94
  margin-right: 10px;
104
95
  display: inline-block;
105
-
106
- .lte-ie7 & {
107
- display: inline;
108
- margin-bottom: 13px;
109
- }
110
96
  }
111
97
 
112
98
  @media (max-width: 500px) {
@@ -130,3 +116,8 @@ header .navbar-header {
130
116
  background-color: $dev-color;
131
117
  color: #000;
132
118
  }
119
+
120
+ .sidebar-nav .badge {
121
+ color: #fff;
122
+ background: #666;
123
+ }
@@ -1,7 +1,7 @@
1
1
  module GovukAdminTemplate
2
2
  class StyleGuideController < ApplicationController
3
3
  def index
4
- @normal_link_href = "#{request.original_url}##{Time.now.utc.to_i}"
4
+ @normal_link_href = "#{request.original_url}##{Time.zone.now.utc.to_i}"
5
5
  @visited_link_href = request.original_url
6
6
  end
7
7
  end
@@ -5,7 +5,7 @@
5
5
  <h2>Formatting help</h2>
6
6
  <%= yield :format_specific_help %>
7
7
  <h3>
8
- <a data-toggle="collapse" data-target="#govspeak-headings">
8
+ <a data-toggle="collapse" href="#govspeak-headings">
9
9
  Headings
10
10
  </a>
11
11
  </h3>
@@ -18,7 +18,7 @@
18
18
  </div>
19
19
 
20
20
  <h3>
21
- <a data-toggle="collapse" data-target="#govspeak-links">
21
+ <a data-toggle="collapse" href="#govspeak-links">
22
22
  Links
23
23
  </a>
24
24
  </h3>
@@ -54,7 +54,7 @@
54
54
  </div>
55
55
 
56
56
  <h3>
57
- <a data-toggle="collapse" data-target="#govspeak-bullets">
57
+ <a data-toggle="collapse" href="#govspeak-bullets">
58
58
  Bullets
59
59
  </a>
60
60
  </h3>
@@ -67,7 +67,7 @@
67
67
  </div>
68
68
 
69
69
  <h3>
70
- <a data-toggle="collapse" data-target="#govspeak-numbered-list">
70
+ <a data-toggle="collapse" href="#govspeak-numbered-list">
71
71
  Numbered list
72
72
  </a>
73
73
  </h3>
@@ -81,7 +81,7 @@
81
81
  </div>
82
82
 
83
83
  <h3>
84
- <a data-toggle="collapse" data-target="#govspeak-priority-list">
84
+ <a data-toggle="collapse" href="#govspeak-priority-list">
85
85
  Priority list
86
86
  </a>
87
87
  </h3>
@@ -98,7 +98,7 @@
98
98
  </div>
99
99
 
100
100
  <h3>
101
- <a data-toggle="collapse" data-target="#govspeak-legislative-list">
101
+ <a data-toggle="collapse" href="#govspeak-legislative-list">
102
102
  Legislative list
103
103
  </a>
104
104
  </h3>
@@ -120,7 +120,7 @@
120
120
  </div>
121
121
 
122
122
  <h3>
123
- <a data-toggle="collapse" data-target="#govspeak-tables">
123
+ <a data-toggle="collapse" href="#govspeak-tables">
124
124
  Tables
125
125
  </a>
126
126
  </h3>
@@ -139,7 +139,7 @@
139
139
  </div>
140
140
 
141
141
  <h3>
142
- <a data-toggle="collapse" data-target="#govspeak-cta">
142
+ <a data-toggle="collapse" href="#govspeak-cta">
143
143
  Call to action
144
144
  </a>
145
145
  </h3>
@@ -150,21 +150,18 @@
150
150
  </div>
151
151
 
152
152
  <h3>
153
- <a data-toggle="collapse" data-target="#govspeak-abbreviations-and-acronyms">
153
+ <a data-toggle="collapse" href="#govspeak-abbreviations-and-acronyms">
154
154
  Abbreviations and acronyms
155
155
  </a>
156
156
  </h3>
157
157
  <div class="collapse" id="govspeak-abbreviations-and-acronyms">
158
- <pre>Example content containing DWP and EU acronyms.
159
-
160
- *[EU]: European Union
161
- *[DWP]: Department for Work and Pensions</pre>
158
+ <pre>*[DWP]: Department for Work and Pensions</pre>
162
159
  <p>Text found in content which matches what’s in the brackets <code>[ ]</code> (eg DWP), will have the full text (Department for Work and Pensions) available to screenreaders and when hovering: <abbr title="Department for Work and Pensions">DWP</abbr>. The markdown code will not be displayed.</p>
163
160
  <p>List abbreviation markdown at the end.</p>
164
161
  </div>
165
162
 
166
163
  <h3>
167
- <a data-toggle="collapse" data-target="#govspeak-blockquotes">
164
+ <a data-toggle="collapse" href="#govspeak-blockquotes">
168
165
  Blockquotes
169
166
  </a>
170
167
  </h3>
@@ -178,7 +175,7 @@
178
175
  </div>
179
176
 
180
177
  <h3>
181
- <a data-toggle="collapse" data-target="#govspeak-addresses">
178
+ <a data-toggle="collapse" href="#govspeak-addresses">
182
179
  Addresses
183
180
  </a>
184
181
  </h3>
@@ -192,7 +189,7 @@
192
189
  </div>
193
190
 
194
191
  <h3>
195
- <a data-toggle="collapse" data-target="#govspeak-footnotes">
192
+ <a data-toggle="collapse" href="#govspeak-footnotes">
196
193
  Footnotes
197
194
  </a>
198
195
  </h3>
@@ -8,7 +8,6 @@
8
8
  allow_google_analytics_stub = (Rails.env.development? || (Rails.env.test? && GovukAdminTemplate::Config.enable_google_analytics_in_tests))
9
9
  %>
10
10
  <!DOCTYPE html>
11
- <!--[if lte IE 7]><html class="no-js lte-ie7 <%= yield(:html_class) %>" lang="en"><![endif]-->
12
11
  <!--[if IE 8]><html class="no-js ie8 <%= yield(:html_class) %>" lang="en"><![endif]-->
13
12
  <!--[if IE 9]><html class="no-js ie9 <%= yield(:html_class) %>" lang="en"><![endif]-->
14
13
  <!--[if gt IE 9]><!--><html class="no-js <%= yield(:html_class) %>" lang="en"><!--<![endif]-->
@@ -28,10 +27,6 @@
28
27
  %>
29
28
  <% end %>
30
29
  <%= yield :head %>
31
- <%# CSS resets and fixes for Bootstrap 3 in IE7 %>
32
- <!--[if lte IE 7]>
33
- <%= stylesheet_link_tag "govuk_admin_template/bootstrap-ie7" %>
34
- <![endif]-->
35
30
  <%
36
31
  # HTML5 and bootstrap shims, for <= IE8 support of HTML5 elements
37
32
  # respond.js must come after CSS (from :head) and media queries so
@@ -81,7 +76,7 @@
81
76
 
82
77
  <% if GovukAdminTemplate::Config.show_signout %>
83
78
  <div class="navbar-text pull-right">
84
- <%= link_to current_user.name, Plek.current.find('signon') %>
79
+ <%= link_to current_user.name, Plek.new.external_url_for('signon') %>
85
80
  &bull; <%= link_to 'Sign out', '/auth/gds/sign_out' %>
86
81
  </div>
87
82
  <% end %>
data/config/routes.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  GovukAdminTemplate::Engine.routes.draw do
2
- root :to => 'govuk_admin_template/style_guide#index'
2
+ root to: "govuk_admin_template/style_guide#index"
3
3
  end
@@ -6,7 +6,7 @@ module GovukAdminTemplate
6
6
  module Config
7
7
  # Name of your application
8
8
  mattr_accessor :app_title
9
- @@app_title = "GOV.UK"
9
+ @app_title = "GOV.UK"
10
10
 
11
11
  # Show flash-messages
12
12
  # Default: false
@@ -1,37 +1,40 @@
1
1
  module GovukAdminTemplate
2
2
  class Engine < ::Rails::Engine
3
- require 'bootstrap-sass'
4
- require 'jquery-rails'
5
-
6
- initializer 'govuk_admin_template.assets.precompile' do |app|
7
- app.config.assets.precompile += %w(lte-ie8.js govuk-admin-template.js govuk_admin_template/bootstrap-ie7.css)
8
- app.config.assets.precompile += %w(govuk_admin_template/favicon-development.png govuk_admin_template/favicon-test.png govuk_admin_template/favicon-integration.png
9
- govuk_admin_template/favicon-preview.png govuk_admin_template/favicon-production.png govuk_admin_template/favicon.png)
10
-
3
+ require "bootstrap-sass"
4
+ require "jquery-rails"
5
+
6
+ initializer "govuk_admin_template.assets.precompile" do |app|
7
+ app.config.assets.precompile += %w[lte-ie8.js govuk-admin-template.js]
8
+ app.config.assets.precompile += %w[govuk_admin_template/favicon-development.png
9
+ govuk_admin_template/favicon-test.png
10
+ govuk_admin_template/favicon-integration.png
11
+ govuk_admin_template/favicon-preview.png
12
+ govuk_admin_template/favicon-production.png
13
+ govuk_admin_template/favicon.png]
11
14
  end
12
15
 
13
16
  # User friendly GOV.UK date formats, based on:
14
17
  # https://www.gov.uk/guidance/style-guide/a-to-z-of-gov-uk-style#dates
15
18
  # https://www.gov.uk/guidance/style-guide/a-to-z-of-gov-uk-style#times
16
- initializer 'govuk_admin_template.date_formats' do |app|
19
+ initializer "govuk_admin_template.date_formats" do |_app|
17
20
  # 1 January 2013
18
- Date::DATE_FORMATS[:govuk_date] = '%-e %B %Y'
21
+ Date::DATE_FORMATS[:govuk_date] = "%-e %B %Y"
19
22
 
20
23
  # 1 Jan 2013
21
- Date::DATE_FORMATS[:govuk_date_short] = '%-e %b %Y'
24
+ Date::DATE_FORMATS[:govuk_date_short] = "%-e %b %Y"
22
25
 
23
26
  # 1:15pm, 1 January 2013
24
- Time::DATE_FORMATS[:govuk_date] = '%-I:%M%P, %-e %B %Y'
27
+ Time::DATE_FORMATS[:govuk_date] = "%-I:%M%P, %-e %B %Y"
25
28
 
26
29
  # 1:15pm, 1 Jan 2013
27
- Time::DATE_FORMATS[:govuk_date_short] = '%-I:%M%P, %-e %b %Y'
30
+ Time::DATE_FORMATS[:govuk_date_short] = "%-I:%M%P, %-e %b %Y"
28
31
 
29
32
  # 1:15pm
30
- Time::DATE_FORMATS[:govuk_time] = '%-I:%M%P'
33
+ Time::DATE_FORMATS[:govuk_time] = "%-I:%M%P"
31
34
  end
32
35
 
33
36
  initializer "govuk_admin_template.view_helpers" do
34
- ActionView::Base.send :include, ViewHelpers
37
+ ActionView::Base.include ViewHelpers
35
38
  end
36
39
  end
37
40
  end
@@ -38,40 +38,40 @@ module GovukAdminTemplate
38
38
  b.use :error, wrap_with: { tag: :span, class: :error }
39
39
  end
40
40
 
41
- config.wrappers :bootstrap, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
41
+ config.wrappers :bootstrap, tag: "div", class: "form-group", error_class: "has-error" do |b|
42
42
  b.use :html5
43
43
  b.use :placeholder
44
- b.use :label, class: 'control-label'
45
- b.wrapper tag: 'div' do |ba|
44
+ b.use :label, class: "control-label"
45
+ b.wrapper tag: "div" do |ba|
46
46
  ba.use :input
47
- ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
48
- ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
47
+ ba.use :error, wrap_with: { tag: "span", class: "help-inline" }
48
+ ba.use :hint, wrap_with: { tag: "p", class: "help-block" }
49
49
  end
50
50
  end
51
51
 
52
- config.wrappers :prepend, tag: 'div', class: "form-group", error_class: 'has-error' do |b|
52
+ config.wrappers :prepend, tag: "div", class: "form-group", error_class: "has-error" do |b|
53
53
  b.use :html5
54
54
  b.use :placeholder
55
55
  b.use :label
56
- b.wrapper tag: 'div', class: 'controls' do |input|
57
- input.wrapper tag: 'div', class: 'input-prepend' do |prepend|
56
+ b.wrapper tag: "div", class: "controls" do |input|
57
+ input.wrapper tag: "div", class: "input-prepend" do |prepend|
58
58
  prepend.use :input
59
59
  end
60
- input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
61
- input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
60
+ input.use :hint, wrap_with: { tag: "span", class: "help-block" }
61
+ input.use :error, wrap_with: { tag: "span", class: "help-inline" }
62
62
  end
63
63
  end
64
64
 
65
- config.wrappers :append, tag: 'div', class: "form-group", error_class: 'has-error' do |b|
65
+ config.wrappers :append, tag: "div", class: "form-group", error_class: "has-error" do |b|
66
66
  b.use :html5
67
67
  b.use :placeholder
68
68
  b.use :label
69
- b.wrapper tag: 'div', class: 'controls' do |input|
70
- input.wrapper tag: 'div', class: 'input-append' do |append|
69
+ b.wrapper tag: "div", class: "controls" do |input|
70
+ input.wrapper tag: "div", class: "input-append" do |append|
71
71
  append.use :input
72
72
  end
73
- input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
74
- input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
73
+ input.use :hint, wrap_with: { tag: "span", class: "help-block" }
74
+ input.use :error, wrap_with: { tag: "span", class: "help-inline" }
75
75
  end
76
76
  end
77
77
 
@@ -85,13 +85,13 @@ module GovukAdminTemplate
85
85
  config.boolean_style = :inline
86
86
 
87
87
  # Default class for buttons
88
- config.button_class = 'btn'
88
+ config.button_class = "btn"
89
89
 
90
90
  # Default tag used for error notification helper.
91
91
  config.error_notification_tag = :div
92
92
 
93
93
  # CSS class to add for error notification helper.
94
- config.error_notification_class = 'alert alert-danger'
94
+ config.error_notification_class = "alert alert-danger"
95
95
 
96
96
  # Tell browsers whether to use default HTML5 validations (novalidate option).
97
97
  # Default is enabled.
@@ -1,3 +1,3 @@
1
1
  module GovukAdminTemplate
2
- VERSION = "6.4.0".freeze
2
+ VERSION = "6.8.0".freeze
3
3
  end
@@ -5,7 +5,8 @@ module GovukAdminTemplate
5
5
 
6
6
  flash.each do |type, message|
7
7
  next unless type.to_sym.in?(%i[success info warning danger])
8
- html << content_tag(:div, message, class: "alert alert-#{type}")
8
+
9
+ html << tag.div(message, class: "alert alert-#{type}")
9
10
  end
10
11
 
11
12
  html.join.html_safe
@@ -8,11 +8,11 @@ module GovukAdminTemplate
8
8
  mattr_accessor :environment_style, :environment_label
9
9
 
10
10
  def self.environment_style
11
- @@environment_style || self.default_environment_style
11
+ @@environment_style || default_environment_style
12
12
  end
13
13
 
14
14
  def self.environment_label
15
- @@environment_label || self.environment_style.try(:titleize)
15
+ @@environment_label || environment_style.try(:titleize)
16
16
  end
17
17
 
18
18
  # In development we can't consistently set an environment
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc "Lint files"
4
+ task "lint" => :environment do
5
+ sh "rubocop --format clang"
6
+ end
@@ -0,0 +1,52 @@
1
+ UNGUARDED_URL_USAGE = /\surl\(/.freeze
2
+ ABSOLUTE_ASSET_USAGE = /(?:image-path|image-url|asset-path|asset-url)\(["']\/assets/.freeze
3
+
4
+ namespace :sass do
5
+ desc "Check all SCSS for 404-creating problems, takes place of govuk-lint"
6
+ task check: :environment do
7
+ scss_files = File.expand_path(
8
+ "../../app/assets/stylesheets/**/*.scss", __dir__
9
+ )
10
+
11
+ matching_lines = Dir[scss_files].each_with_object([]) do |scss_file, matching|
12
+ File.readlines(scss_file).each_with_index do |line, number|
13
+ matching << "Unguarded url usage: #{scss_file}:#{number + 1}" if line =~ UNGUARDED_URL_USAGE
14
+ matching << "Absolute /assets usage: #{scss_file}:#{number + 1}" if line =~ ABSOLUTE_ASSET_USAGE
15
+ end
16
+ end
17
+
18
+ if matching_lines.any?
19
+ raise <<~MSG
20
+
21
+ One or more problems exist:
22
+
23
+ Unguarded url usage
24
+ -------------------
25
+
26
+ Do not use instances of url(...) to refer to images within this gem.
27
+ Prefer the SASS function image-url. Unguarded url references won't work in
28
+ Rails 4 and up due to MD5 hashes in asset filenames. Your asset will 404 in
29
+ production Rails 4 apps.
30
+
31
+ Absolute /assets usage
32
+ ----------------------
33
+
34
+ When using any of the image/asset helpers, don't refer to /assets absolutely.
35
+ For example,
36
+
37
+ image-url('/assets/govuk_admin_template/header-crown.png')
38
+
39
+ should instead be
40
+
41
+ image-url('govuk_admin_template/header-crown.png')
42
+
43
+ If Sprockets can't find the image on precompilation, it won't rewrite the
44
+ URL and will pass it through unaltered. This usually means it will 404.
45
+
46
+ Problems:
47
+ #{matching_lines.join("\n ")}
48
+
49
+ MSG
50
+ end
51
+ end
52
+ end