dxw_govuk_frontend_rails 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8b0ce31fa95a92870c71c1bad7cc7946fc4d7df301c729032a20ff6eb5088e5
4
- data.tar.gz: 8a8b382053a24f041f7716e114821a2775c57c15451530780f2cec1092f634ae
3
+ metadata.gz: cbcd2ddb17bdc8d387895ac9a4ddeb7dcd25239b7c1090ce8b58d47af168c07a
4
+ data.tar.gz: c2993f4da0ed20359c196a5149d208241acce40338ffffedc229d729d5b97cdb
5
5
  SHA512:
6
- metadata.gz: d50b314466a962dc265ce444796b56967f51e6535cf409b18f0e4470396cb81222a37e9045cd21dafd16f2dcfaf6eacd68f042aa1c03e24f9ffbb42fb8568cd5
7
- data.tar.gz: 619f339b61e8d545969408f465ad269924555d74a3d6bfe74f55928a142482619cba8cc8f70715d1d15c04679cca6c4cd84e43581bf0d34aa0ab45dcdbf40dcc
6
+ metadata.gz: 5fb847feb82101b5a189176d65ce95cf8bfaed0cfb6db18fa161080b76c9003a1e7ae2471014cacb591522fd0a9e9a6b2c1ae0cc30ff052035370204d0bc9f46
7
+ data.tar.gz: 4f96f18d8e39a95bb7b2a187d944eb3b33527f3d0f7a18fdde0d2f74399c9f920af932fe7ba9696ba9abea08cb4f1b05d684dbe80a13a8d9ba32ed8f364f8c62
@@ -0,0 +1,33 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+
8
+ jobs:
9
+ build:
10
+ name: Build + Publish
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@master
15
+ - name: Set up Ruby 2.6
16
+ uses: actions/setup-ruby@v1
17
+ with:
18
+ version: 2.6.x
19
+
20
+ - name: Compile sass
21
+ run: |
22
+ npx node-sass ./vendor/assets/stylesheets/govuk-frontend-rails.scss /tmp/govuk-frontend-rails.css
23
+
24
+ - name: Publish to RubyGems
25
+ run: |
26
+ mkdir -p $HOME/.gem
27
+ touch $HOME/.gem/credentials
28
+ chmod 0600 $HOME/.gem/credentials
29
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
30
+ gem build *.gemspec
31
+ gem push *.gem
32
+ env:
33
+ GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dxw_govuk_frontend_rails (2.13.0)
4
+ dxw_govuk_frontend_rails (3.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -17,4 +17,4 @@ DEPENDENCIES
17
17
  rake (~> 10.0)
18
18
 
19
19
  BUNDLED WITH
20
- 2.0.1
20
+ 2.0.2
data/README.md CHANGED
@@ -1,7 +1,17 @@
1
1
  # GOVUK Frontend for Rails
2
2
 
3
+ Adds the GOVUK Frontend for Rails using the asset pipeline.
4
+
3
5
  https://github.com/alphagov/govuk-frontend
4
6
 
7
+ ## Breaking Changes in v3.0.0
8
+
9
+ This release of the GOVUK Frontend has breaking changes! Do not update to this version until you have read and understood:
10
+
11
+ You will not be required to updated any file paths with govuk as we take care of that for you, all others changes will need to be managed:
12
+
13
+ https://github.com/alphagov/govuk-frontend/releases/tag/v3.0.0
14
+
5
15
  ## Limitations
6
16
 
7
17
  This gem does not include the ie8 version of GOVUK Frontend, as the service standard no longer requires it:
@@ -75,4 +85,4 @@ When a new version of the GOVUK Frontend is released:
75
85
  - commit the changes
76
86
  - tag with the same release number as GOVUK Frontend
77
87
  - push the changes
78
- - CircleCI will build the gem and push to Rubygems
88
+ - Github acitons will build the gem and push to Rubygems
@@ -1,3 +1,3 @@
1
1
  module DxwGovukFrontendRails
2
- VERSION = "3.0.0"
2
+ VERSION = "3.1.0"
3
3
  end
data/package-lock.json CHANGED
@@ -5,9 +5,9 @@
5
5
  "requires": true,
6
6
  "dependencies": {
7
7
  "govuk-frontend": {
8
- "version": "3.0.0",
9
- "resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-3.0.0.tgz",
10
- "integrity": "sha512-GCrEeaQZEnsthNtfmOUFlgsieNjHOeoamSWMdD4Gdq0RPxCA9uzfrT2i3jVnlBORekKjOL0C8eFZQBSNnjtz2A=="
8
+ "version": "3.1.0",
9
+ "resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-3.1.0.tgz",
10
+ "integrity": "sha512-ozyG6ulmawzg3rsf9Efxcgj81mk4yzea3tfl0hgmXWILGC0/uEGj6A+g9pJ2ETgk78rgNlRLXDv0WvlaHd/LnA=="
11
11
  }
12
12
  }
13
13
  }
data/package.json CHANGED
@@ -21,6 +21,6 @@
21
21
  },
22
22
  "homepage": "https://github.com/mec/dxw_govuk_frontend_rails#readme",
23
23
  "dependencies": {
24
- "govuk-frontend": "3.0.0"
24
+ "govuk-frontend": "3.1.0"
25
25
  }
26
26
  }
@@ -1361,58 +1361,28 @@ Button.prototype.init = function () {
1361
1361
  var KEY_ENTER = 13;
1362
1362
  var KEY_SPACE$1 = 32;
1363
1363
 
1364
- // Create a flag to know if the browser supports navtive details
1365
- var NATIVE_DETAILS = typeof document.createElement('details').open === 'boolean';
1366
-
1367
1364
  function Details ($module) {
1368
1365
  this.$module = $module;
1369
1366
  }
1370
1367
 
1371
- /**
1372
- * Handle cross-modal click events
1373
- * @param {object} node element
1374
- * @param {function} callback function
1375
- */
1376
- Details.prototype.handleInputs = function (node, callback) {
1377
- node.addEventListener('keypress', function (event) {
1378
- var target = event.target;
1379
- // When the key gets pressed - check if it is enter or space
1380
- if (event.keyCode === KEY_ENTER || event.keyCode === KEY_SPACE$1) {
1381
- if (target.nodeName.toLowerCase() === 'summary') {
1382
- // Prevent space from scrolling the page
1383
- // and enter from submitting a form
1384
- event.preventDefault();
1385
- // Click to let the click event do all the necessary action
1386
- if (target.click) {
1387
- target.click();
1388
- } else {
1389
- // except Safari 5.1 and under don't support .click() here
1390
- callback(event);
1391
- }
1392
- }
1393
- }
1394
- });
1368
+ Details.prototype.init = function () {
1369
+ if (!this.$module) {
1370
+ return
1371
+ }
1395
1372
 
1396
- // Prevent keyup to prevent clicking twice in Firefox when using space key
1397
- node.addEventListener('keyup', function (event) {
1398
- var target = event.target;
1399
- if (event.keyCode === KEY_SPACE$1) {
1400
- if (target.nodeName.toLowerCase() === 'summary') {
1401
- event.preventDefault();
1402
- }
1403
- }
1404
- });
1373
+ // If there is native details support, we want to avoid running code to polyfill native behaviour.
1374
+ var hasNativeDetails = typeof this.$module.open === 'boolean';
1405
1375
 
1406
- node.addEventListener('click', callback);
1376
+ if (hasNativeDetails) {
1377
+ return
1378
+ }
1379
+
1380
+ this.polyfillDetails();
1407
1381
  };
1408
1382
 
1409
- Details.prototype.init = function () {
1383
+ Details.prototype.polyfillDetails = function () {
1410
1384
  var $module = this.$module;
1411
1385
 
1412
- if (!$module) {
1413
- return
1414
- }
1415
-
1416
1386
  // Save shortcuts to the inner summary and content elements
1417
1387
  var $summary = this.$summary = $module.getElementsByTagName('summary').item(0);
1418
1388
  var $content = this.$content = $module.getElementsByTagName('div').item(0);
@@ -1442,9 +1412,7 @@ Details.prototype.init = function () {
1442
1412
  //
1443
1413
  // We have to use the camelcase `tabIndex` property as there is a bug in IE6/IE7 when we set the correct attribute lowercase:
1444
1414
  // See http://web.archive.org/web/20170120194036/http://www.saliences.com/browserBugs/tabIndex.html for more information.
1445
- if (!NATIVE_DETAILS) {
1446
- $summary.tabIndex = 0;
1447
- }
1415
+ $summary.tabIndex = 0;
1448
1416
 
1449
1417
  // Detect initial open state
1450
1418
  var openAttr = $module.getAttribute('open') !== null;
@@ -1454,20 +1422,18 @@ Details.prototype.init = function () {
1454
1422
  } else {
1455
1423
  $summary.setAttribute('aria-expanded', 'false');
1456
1424
  $content.setAttribute('aria-hidden', 'true');
1457
- if (!NATIVE_DETAILS) {
1458
- $content.style.display = 'none';
1459
- }
1425
+ $content.style.display = 'none';
1460
1426
  }
1461
1427
 
1462
1428
  // Bind an event to handle summary elements
1463
- this.handleInputs($summary, this.setAttributes.bind(this));
1429
+ this.polyfillHandleInputs($summary, this.polyfillSetAttributes.bind(this));
1464
1430
  };
1465
1431
 
1466
1432
  /**
1467
1433
  * Define a statechange function that updates aria-expanded and style.display
1468
1434
  * @param {object} summary element
1469
1435
  */
1470
- Details.prototype.setAttributes = function () {
1436
+ Details.prototype.polyfillSetAttributes = function () {
1471
1437
  var $module = this.$module;
1472
1438
  var $summary = this.$summary;
1473
1439
  var $content = this.$content;
@@ -1478,27 +1444,54 @@ Details.prototype.setAttributes = function () {
1478
1444
  $summary.setAttribute('aria-expanded', (expanded ? 'false' : 'true'));
1479
1445
  $content.setAttribute('aria-hidden', (hidden ? 'false' : 'true'));
1480
1446
 
1481
- if (!NATIVE_DETAILS) {
1482
- $content.style.display = (expanded ? 'none' : '');
1447
+ $content.style.display = (expanded ? 'none' : '');
1483
1448
 
1484
- var hasOpenAttr = $module.getAttribute('open') !== null;
1485
- if (!hasOpenAttr) {
1486
- $module.setAttribute('open', 'open');
1487
- } else {
1488
- $module.removeAttribute('open');
1489
- }
1449
+ var hasOpenAttr = $module.getAttribute('open') !== null;
1450
+ if (!hasOpenAttr) {
1451
+ $module.setAttribute('open', 'open');
1452
+ } else {
1453
+ $module.removeAttribute('open');
1490
1454
  }
1455
+
1491
1456
  return true
1492
1457
  };
1493
1458
 
1494
1459
  /**
1495
- * Remove the click event from the node element
1460
+ * Handle cross-modal click events
1496
1461
  * @param {object} node element
1462
+ * @param {function} callback function
1497
1463
  */
1498
- Details.prototype.destroy = function (node) {
1499
- node.removeEventListener('keypress');
1500
- node.removeEventListener('keyup');
1501
- node.removeEventListener('click');
1464
+ Details.prototype.polyfillHandleInputs = function (node, callback) {
1465
+ node.addEventListener('keypress', function (event) {
1466
+ var target = event.target;
1467
+ // When the key gets pressed - check if it is enter or space
1468
+ if (event.keyCode === KEY_ENTER || event.keyCode === KEY_SPACE$1) {
1469
+ if (target.nodeName.toLowerCase() === 'summary') {
1470
+ // Prevent space from scrolling the page
1471
+ // and enter from submitting a form
1472
+ event.preventDefault();
1473
+ // Click to let the click event do all the necessary action
1474
+ if (target.click) {
1475
+ target.click();
1476
+ } else {
1477
+ // except Safari 5.1 and under don't support .click() here
1478
+ callback(event);
1479
+ }
1480
+ }
1481
+ }
1482
+ });
1483
+
1484
+ // Prevent keyup to prevent clicking twice in Firefox when using space key
1485
+ node.addEventListener('keyup', function (event) {
1486
+ var target = event.target;
1487
+ if (event.keyCode === KEY_SPACE$1) {
1488
+ if (target.nodeName.toLowerCase() === 'summary') {
1489
+ event.preventDefault();
1490
+ }
1491
+ }
1492
+ });
1493
+
1494
+ node.addEventListener('click', callback);
1502
1495
  };
1503
1496
 
1504
1497
  function CharacterCount ($module) {
@@ -224,9 +224,11 @@
224
224
  }
225
225
  }
226
226
 
227
- // Sections two-third:one-third on desktop
227
+ // If there are only two sections, set the layout to be two-third:one-third on desktop
228
228
  @include mq ($from: desktop) {
229
- .govuk-footer__section:first-child {
229
+ // We match the first section with `:first-child`.
230
+ // To ensure the section is one of two, we can count backwards using `:nth-last-child(2)`.
231
+ .govuk-footer__section:first-child:nth-last-child(2) {
230
232
  -webkit-box-flex: 2;
231
233
  -webkit-flex-grow: 2;
232
234
  -ms-flex-positive: 2;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dxw_govuk_frontend_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mec
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-08-30 00:00:00.000000000 Z
12
+ date: 2019-09-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -45,8 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - ".circleci/config.yml"
49
- - ".circleci/setup-rubygems.sh"
48
+ - ".github/workflows/gempush.yml"
50
49
  - ".gitignore"
51
50
  - CODE_OF_CONDUCT.md
52
51
  - Gemfile
data/.circleci/config.yml DELETED
@@ -1,33 +0,0 @@
1
- version: 2
2
- jobs:
3
- deploy:
4
- docker:
5
- - image: circleci/ruby:2.6.1-node-browsers
6
-
7
- working_directory: ~/repo
8
-
9
- steps:
10
- - checkout
11
- - run:
12
- name: Compile sass
13
- command: |
14
- npx node-sass ./vendor/assets/stylesheets/govuk-frontend-rails.scss /tmp/govuk-frontend-rails.css
15
- - run:
16
- name: Setup Rubygems
17
- command: bash .circleci/setup-rubygems.sh
18
-
19
- - run:
20
- name: Publish to Rubygems
21
- command: |
22
- gem build dxw_govuk_frontend_rails.gemspec
23
- gem push "dxw_govuk_frontend_rails-$(git describe --tags).gem"
24
- workflows:
25
- version: 2
26
- test-deploy:
27
- jobs:
28
- - deploy:
29
- filters:
30
- tags:
31
- only: /.*/
32
- branches:
33
- ignore: /.*/
@@ -1,3 +0,0 @@
1
- mkdir ~/.gem
2
- echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
3
- chmod 0600 /home/circleci/.gem/credentials