govuk_publishing_components 20.5.0 → 20.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/dependencies.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/modules.js +61 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_chevron-banner.scss +14 -2
- data/config/initializers/assets.rb +1 -0
- data/lib/govuk_publishing_components/engine.rb +0 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61857d26e044f6ba061ca180fefbd746ba4a1bf5ff90d08a1b642a6b0a8df3d3
|
4
|
+
data.tar.gz: 300fcb426e7c8ff4d689fbbab7e9ab336140665ebbbe8bed34a850e049ee472b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5e7d05af79294734c1ad83cf39334347043edb9986c8fbecda43be0b1999493f4d18129778bc1e5ae76bacae896c8270c0621827fca22ecc532c20000ee2fb2
|
7
|
+
data.tar.gz: c8ff056961514d1838e4548f97bf875b7a4567400576d3572f477282074d38105452a9580f6a0ddf6f0a811f3a1723db937dbba1ade34f51d8cef2b16d4b1f31
|
@@ -3,7 +3,7 @@
|
|
3
3
|
// This adds in javascript that initialises components and dependencies
|
4
4
|
// that are provided by Slimmer in public frontend applications.
|
5
5
|
// = require jquery/dist/jquery
|
6
|
-
// = require
|
6
|
+
// = require ./modules.js
|
7
7
|
|
8
8
|
$(document).ready(function () {
|
9
9
|
'use strict'
|
@@ -0,0 +1,61 @@
|
|
1
|
+
;(function (global) {
|
2
|
+
'use strict'
|
3
|
+
|
4
|
+
var $ = global.jQuery
|
5
|
+
var GOVUK = global.GOVUK || {}
|
6
|
+
GOVUK.Modules = GOVUK.Modules || {}
|
7
|
+
|
8
|
+
GOVUK.modules = {
|
9
|
+
find: function (container) {
|
10
|
+
container = container || $('body')
|
11
|
+
|
12
|
+
var modules
|
13
|
+
var moduleSelector = '[data-module]'
|
14
|
+
|
15
|
+
modules = container.find(moduleSelector)
|
16
|
+
|
17
|
+
// Container could be a module too
|
18
|
+
if (container.is(moduleSelector)) {
|
19
|
+
modules = modules.add(container)
|
20
|
+
}
|
21
|
+
|
22
|
+
return modules
|
23
|
+
},
|
24
|
+
|
25
|
+
start: function (container) {
|
26
|
+
var modules = this.find(container)
|
27
|
+
|
28
|
+
for (var i = 0, l = modules.length; i < l; i++) {
|
29
|
+
var module
|
30
|
+
var element = $(modules[i])
|
31
|
+
var type = camelCaseAndCapitalise(element.data('module'))
|
32
|
+
var started = element.data('module-started')
|
33
|
+
|
34
|
+
if (typeof GOVUK.Modules[type] === 'function' && !started) {
|
35
|
+
module = new GOVUK.Modules[type]()
|
36
|
+
module.start(element)
|
37
|
+
element.data('module-started', true)
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
// eg selectable-table to SelectableTable
|
42
|
+
function camelCaseAndCapitalise (string) {
|
43
|
+
return capitaliseFirstLetter(camelCase(string))
|
44
|
+
}
|
45
|
+
|
46
|
+
// http://stackoverflow.com/questions/6660977/convert-hyphens-to-camel-case-camelcase
|
47
|
+
function camelCase (string) {
|
48
|
+
return string.replace(/-([a-z])/g, function (g) {
|
49
|
+
return g.charAt(1).toUpperCase()
|
50
|
+
})
|
51
|
+
}
|
52
|
+
|
53
|
+
// http://stackoverflow.com/questions/1026069/capitalize-the-first-letter-of-string-in-javascript
|
54
|
+
function capitaliseFirstLetter (string) {
|
55
|
+
return string.charAt(0).toUpperCase() + string.slice(1)
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
global.GOVUK = GOVUK
|
61
|
+
})(window)
|
@@ -98,8 +98,20 @@ $yellow: #ffdd00;
|
|
98
98
|
}
|
99
99
|
|
100
100
|
// Target IE 9-11
|
101
|
-
@media screen and (min-width: 0\0) {
|
102
|
-
background-position: -
|
101
|
+
@media screen and (min-width: 0\0) and (min-width: 320px) and (max-width: 364px) {
|
102
|
+
background-position: -15px center;
|
103
|
+
}
|
104
|
+
|
105
|
+
@media screen and (min-width: 0\0) and (min-width: 365px) and (max-width: 640px) {
|
106
|
+
background-position: -28px center;
|
107
|
+
}
|
108
|
+
|
109
|
+
@media screen and (min-width: 0\0) and (min-width: 641px) and (max-width: 769px) {
|
110
|
+
background-position: -20px center;
|
111
|
+
}
|
112
|
+
|
113
|
+
@media screen and (min-width: 0\0) and (min-width: 770px) {
|
114
|
+
background-position: -14px center;
|
103
115
|
}
|
104
116
|
}
|
105
117
|
|
@@ -7,6 +7,7 @@ Rails.application.config.assets.precompile += %w(
|
|
7
7
|
component_guide/filter-components.js
|
8
8
|
component_guide/visual-regression.js
|
9
9
|
govuk_publishing_components/all_components.js
|
10
|
+
govuk_publishing_components/modules.js
|
10
11
|
govuk_publishing_components/vendor/modernizr.js
|
11
12
|
govuk_publishing_components/component_guide.css
|
12
13
|
govuk_publishing_components/favicon-development.png
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 20.5.
|
4
|
+
version: 20.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gds-api-adapters
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: govuk_frontend_toolkit
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: kramdown
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -373,6 +359,7 @@ files:
|
|
373
359
|
- app/assets/javascripts/govuk_publishing_components/lib/select.js
|
374
360
|
- app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js
|
375
361
|
- app/assets/javascripts/govuk_publishing_components/lib/toggle.js
|
362
|
+
- app/assets/javascripts/govuk_publishing_components/modules.js
|
376
363
|
- app/assets/javascripts/govuk_publishing_components/vendor/magna-charta.min.js
|
377
364
|
- app/assets/javascripts/govuk_publishing_components/vendor/modernizr.js
|
378
365
|
- app/assets/stylesheets/component_guide/application.scss
|