govuk_elements_rails 0.3.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +19 -0
- data/README.md +165 -46
- data/lib/govuk_elements_rails.rb +0 -1
- data/lib/govuk_elements_rails/engine.rb +0 -10
- data/vendor/assets/javascripts/details.polyfill.js +29 -43
- data/vendor/assets/stylesheets/_govuk-elements.scss +54 -0
- data/vendor/assets/stylesheets/elements/_base.scss +126 -0
- data/vendor/assets/stylesheets/elements/_breadcrumbs.scss +6 -0
- data/vendor/assets/stylesheets/elements/_buttons.scss +5 -5
- data/vendor/assets/stylesheets/elements/_components.scss +9 -0
- data/vendor/assets/stylesheets/elements/_details.scss +3 -9
- data/vendor/assets/stylesheets/elements/_elements-typography.scss +102 -9
- data/vendor/assets/stylesheets/elements/_forms.scss +84 -61
- data/vendor/assets/stylesheets/elements/_helpers.scss +6 -12
- data/vendor/assets/stylesheets/elements/_icons.scss +63 -207
- data/vendor/assets/stylesheets/elements/_layout.scss +9 -22
- data/vendor/assets/stylesheets/elements/_lists.scss +10 -13
- data/vendor/assets/stylesheets/elements/_panels.scss +24 -17
- data/vendor/assets/stylesheets/elements/_phase-banner.scss +10 -0
- data/vendor/assets/stylesheets/elements/_tables.scss +1 -5
- data/vendor/assets/stylesheets/elements/forms/_form-block-labels.scss +8 -7
- data/vendor/assets/stylesheets/elements/forms/_form-validation.scss +0 -3
- metadata +33 -49
- data/LICENCE +0 -20
- data/app/builders/govuk_elements_form_builder.rb +0 -77
- data/app/builders/labelling_form_builder.rb +0 -316
- data/lib/govuk_elements_rails/version.rb +0 -5
- data/vendor/assets/images/icons/accordian-arrow-2x.png +0 -0
- data/vendor/assets/images/icons/accordian-arrow.png +0 -0
- data/vendor/assets/images/icons/arrow-sprite.png +0 -0
- data/vendor/assets/images/icons/icon-calendar-2x.png +0 -0
- data/vendor/assets/images/icons/icon-calendar.png +0 -0
- data/vendor/assets/images/icons/icon-file-download-2x.png +0 -0
- data/vendor/assets/images/icons/icon-file-download.png +0 -0
- data/vendor/assets/images/icons/icon-important-2x.png +0 -0
- data/vendor/assets/images/icons/icon-important.png +0 -0
- data/vendor/assets/images/icons/icon-information-2x.png +0 -0
- data/vendor/assets/images/icons/icon-information.png +0 -0
- data/vendor/assets/images/icons/icon-locator-2x.png +0 -0
- data/vendor/assets/images/icons/icon-locator.png +0 -0
- data/vendor/assets/images/icons/icon-pointer-2x.png +0 -0
- data/vendor/assets/images/icons/icon-pointer-black-2x.png +0 -0
- data/vendor/assets/images/icons/icon-pointer-black.png +0 -0
- data/vendor/assets/images/icons/icon-pointer-indexed.png +0 -0
- data/vendor/assets/images/icons/icon-pointer.png +0 -0
- data/vendor/assets/images/icons/icon-search-2x.png +0 -0
- data/vendor/assets/images/icons/icon-search.png +0 -0
- data/vendor/assets/images/icons/player-icon-forward.png +0 -0
- data/vendor/assets/images/icons/player-icon-pause.png +0 -0
- data/vendor/assets/images/icons/player-icon-play.png +0 -0
- data/vendor/assets/images/icons/player-icon-rewind.png +0 -0
- data/vendor/assets/images/icons/player-icon-volume.png +0 -0
- data/vendor/assets/javascripts/application.js +0 -157
- data/vendor/assets/javascripts/bind.js +0 -40
- data/vendor/assets/javascripts/selection-buttons.js +0 -111
- data/vendor/assets/stylesheets/elements-page-ie6.scss +0 -5
- data/vendor/assets/stylesheets/elements-page-ie7.scss +0 -4
- data/vendor/assets/stylesheets/elements-page-ie8.scss +0 -4
- data/vendor/assets/stylesheets/elements-page.scss +0 -386
- data/vendor/assets/stylesheets/main-ie6.scss +0 -5
- data/vendor/assets/stylesheets/main-ie7.scss +0 -4
- data/vendor/assets/stylesheets/main-ie8.scss +0 -4
- data/vendor/assets/stylesheets/main.scss +0 -36
- data/vendor/assets/stylesheets/prism.scss +0 -144
- data/vendor/assets/stylesheets/service-design-manual/helpers/_breadcrumbs.scss +0 -81
- data/vendor/assets/stylesheets/service-design-manual/helpers/_page-header.scss +0 -28
- data/vendor/assets/stylesheets/service-design-manual/styleguide/_colours.scss +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daa6ca3a658ac82f5376402f7b2340a632d51c8e
|
4
|
+
data.tar.gz: 444a393037f86a9829f34cf65bc832c635ac84a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89b63c571f1666b85d2ecc654840c04c75b1398410738c254640aee1c792930796ee98a818bbbaa9605f251079dd1ddb53668800bdcd6b9ec728f7702ac7e8bc
|
7
|
+
data.tar.gz: 99471d0e0cf3d42df8d2659fcb223bf9a658543697a1a1650d6d128eb8cb454fc3c7c75a9ee5adffb35a5c8c014915d82ce65afed6124e04657c24e106a88bca
|
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2014 Crown Copyright (Government Digital Service)
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -3,17 +3,137 @@
|
|
3
3
|
A gem wrapper around [govuk_elements](http://github.com/alphagov/govuk_elements)
|
4
4
|
that pulls stylesheet and javascript files into a Rails app.
|
5
5
|
|
6
|
-
## Installing
|
6
|
+
## Installing for use in a Rails app
|
7
7
|
|
8
|
-
Just include `govuk_elements_rails` in your `Gemfile
|
9
|
-
|
8
|
+
Just include `govuk_elements_rails` in your Rails application `Gemfile`:
|
9
|
+
|
10
|
+
gem 'govuk_elements_rails'
|
11
|
+
|
12
|
+
It automatically attaches itself to your asset path so the static/SCSS
|
10
13
|
files will be available to the asset pipeline.
|
11
14
|
|
12
|
-
###
|
15
|
+
### Dependency on govuk_frontend_toolkit
|
13
16
|
|
14
|
-
|
17
|
+
The gem has a dependency on the
|
18
|
+
[govuk_frontend_toolkit gem](https://rubygems.org/gems/govuk_frontend_toolkit).
|
19
|
+
So `govuk_frontend_toolkit` will be installed on `bundle install` if it is not
|
20
|
+
installed already.
|
15
21
|
|
16
|
-
|
22
|
+
### Dependency on govuk_template base HTML styles
|
23
|
+
|
24
|
+
The gem assumes you have `govuk_template` base HTML styles in your SASS.
|
25
|
+
But the [govuk_template gem](https://rubygems.org/gems/govuk_template) is not a
|
26
|
+
dependency. Either require `govuk_template` in your `Gemfile`:
|
27
|
+
|
28
|
+
gem 'govuk_template'
|
29
|
+
|
30
|
+
or include the following in a Sass file, see Usage section for details:
|
31
|
+
|
32
|
+
// Base (unclassed HTML elements)
|
33
|
+
// These are predefined by govuk_template
|
34
|
+
// If you're not using govuk_template, uncomment the line below.
|
35
|
+
// HTML elements, set by the GOV.UK template
|
36
|
+
@import 'elements/base'
|
37
|
+
|
38
|
+
## Usage
|
39
|
+
|
40
|
+
For detailed information on usage see the
|
41
|
+
[govuk_elements README](https://github.com/alphagov/govuk_elements#govuk-elements).
|
42
|
+
|
43
|
+
### Stylesheets usage
|
44
|
+
|
45
|
+
At the top of a Sass file in your Rails project you should use an `@import` rule
|
46
|
+
to include the file for the mixins you require.
|
47
|
+
|
48
|
+
For example here are possible imports, remember to add semicolons to the end of
|
49
|
+
lines if you are using the `scss` format instead of `sass`:
|
50
|
+
|
51
|
+
// From GDS's alphagov/govuk_frontend_toolkit
|
52
|
+
@import 'colours'
|
53
|
+
@import 'font_stack'
|
54
|
+
@import 'measurements'
|
55
|
+
@import 'conditionals'
|
56
|
+
@import 'device-pixels'
|
57
|
+
@import 'grid_layout'
|
58
|
+
@import 'typography'
|
59
|
+
@import 'shims'
|
60
|
+
|
61
|
+
@import 'design-patterns/alpha-beta'
|
62
|
+
@import 'design-patterns/buttons'
|
63
|
+
@import 'design-patterns/breadcrumbs'
|
64
|
+
|
65
|
+
// From GDS's alphagov/govuk_elements
|
66
|
+
@import 'elements/helpers'
|
67
|
+
@import 'elements/reset'
|
68
|
+
|
69
|
+
// Base (unclassed HTML elements)
|
70
|
+
// These are predefined by govuk_template
|
71
|
+
// If you're not using govuk_template, uncomment the line below.
|
72
|
+
// HTML elements, set by the GOV.UK template
|
73
|
+
// @import 'elements/base'
|
74
|
+
|
75
|
+
@import 'elements/layout'
|
76
|
+
@import 'elements/elements-typography'
|
77
|
+
@import 'elements/buttons'
|
78
|
+
// @import 'elements/icons'
|
79
|
+
@import 'elements/lists'
|
80
|
+
// @import 'elements/tables'
|
81
|
+
@import 'elements/details'
|
82
|
+
@import 'elements/panels'
|
83
|
+
@import 'elements/forms'
|
84
|
+
@import 'elements/forms/form-block-labels'
|
85
|
+
@import 'elements/forms/form-date'
|
86
|
+
@import 'elements/forms/form-validation'
|
87
|
+
@import 'elements/breadcrumbs'
|
88
|
+
@import 'elements/phase-banner'
|
89
|
+
@import 'elements/components'
|
90
|
+
|
91
|
+
For further detailed information on usage see the
|
92
|
+
[govuk_elements README](https://github.com/alphagov/govuk_elements#govuk-elements).
|
93
|
+
|
94
|
+
### Javascript usage
|
95
|
+
|
96
|
+
In the `app/assets/javascripts/application.js` file in your Rails project use
|
97
|
+
`require` rule to include the files for the javascript enhancements you require.
|
98
|
+
For example here are all the requires possible at present:
|
99
|
+
|
100
|
+
// from govuk_elements gem
|
101
|
+
//= require details.polyfill
|
102
|
+
|
103
|
+
### Javascript from govuk_frontend_toolkit
|
104
|
+
|
105
|
+
In the `app/assets/javascripts/application.js` file in your Rails project use
|
106
|
+
`require` rule to include javascript from the `govuk_frontend_toolkit` gem. For
|
107
|
+
example:
|
108
|
+
|
109
|
+
// from govuk_frontend_toolkit gem
|
110
|
+
//= require vendor/polyfills/bind
|
111
|
+
//= require govuk/selection-buttons
|
112
|
+
|
113
|
+
To include all of the govuk javascript, require `govuk_toolkit`, i.e.
|
114
|
+
|
115
|
+
// from govuk_frontend_toolkit gem
|
116
|
+
//= require vendor/polyfills/bind
|
117
|
+
//= require govuk_toolkit
|
118
|
+
|
119
|
+
See the
|
120
|
+
[govuk_frontend_toolkit documentation](https://github.com/alphagov/govuk_frontend_toolkit#documentation)
|
121
|
+
for details of what javascript is available.
|
122
|
+
|
123
|
+
## Alternate ways to reuse GOV.UK Elements
|
124
|
+
|
125
|
+
There are other alternate ways to include GOV.UK Elements implementations in a Rails
|
126
|
+
project, for example via [NPM](https://www.npmjs.com/package/govuk-elements-sass)
|
127
|
+
or [Mojular](https://github.com/mojular/govuk-elements).
|
128
|
+
|
129
|
+
Feel free to use an alternate approach when it's more appropriate for your team.
|
130
|
+
|
131
|
+
## Making updates to the gem itself
|
132
|
+
|
133
|
+
You only need to look at this section if you want to update the gem with changes
|
134
|
+
from the govuk-elements repo.
|
135
|
+
|
136
|
+
If you just want to use the gem in your Rails application, don't follow these steps.
|
17
137
|
|
18
138
|
If you are working on the gem itself, clone and download submodules like this:
|
19
139
|
|
@@ -22,19 +142,47 @@ If you are working on the gem itself, clone and download submodules like this:
|
|
22
142
|
git submodule init
|
23
143
|
git submodule update
|
24
144
|
|
25
|
-
To
|
145
|
+
To update govuk_elements to a specific tag:
|
26
146
|
|
27
|
-
cd
|
28
|
-
|
29
|
-
|
147
|
+
cd govuk_elements
|
148
|
+
git fetch origin
|
149
|
+
git describe --tags # shows current tag
|
150
|
+
git tag -l # lists available tags
|
151
|
+
git checkout master
|
152
|
+
latest_tag=`git describe --abbrev=0 --tags`
|
153
|
+
git checkout $latest_tag # change to most recent tag
|
154
|
+
cd ..
|
30
155
|
|
31
|
-
|
156
|
+
Check that the symlinks under `vendor/assets` still point to the govuk_elements files.
|
157
|
+
|
158
|
+
To create the gem for local testing:
|
159
|
+
|
160
|
+
rake clean
|
161
|
+
rake gem
|
162
|
+
|
163
|
+
If you're happy all's ok, you can commit:
|
32
164
|
|
33
165
|
cd govuk_elements
|
34
|
-
git
|
35
|
-
|
166
|
+
tag_sha=`git rev-parse HEAD`
|
167
|
+
commit_msg="Upgrade to govuk_elements $latest_tag"
|
168
|
+
commit_msg2="See govuk_elements $latest_tag changelog for details:"
|
169
|
+
commit_msg3="https://github.com/alphagov/govuk_elements/blob/$tag_sha/CHANGELOG.md"
|
170
|
+
|
171
|
+
echo $commit_msg
|
172
|
+
echo $commit_msg2
|
173
|
+
echo $commit_msg3
|
36
174
|
cd ..
|
37
|
-
git
|
175
|
+
git add govuk_elements
|
176
|
+
git commit -m "$commit_msg" -m "$commit_msg2" -m "$commit_msg3"
|
177
|
+
|
178
|
+
To add a javascript file to gem, create new symlink to govuk_elements file like in this example:
|
179
|
+
|
180
|
+
cd vendor/assets/javascripts/
|
181
|
+
ls -l
|
182
|
+
ln -s ../../../govuk_elements/public/javascripts/vendor/details.polyfill.js .
|
183
|
+
ls -l
|
184
|
+
cd ../../..
|
185
|
+
git add vendor/javascripts/details.polyfill.js
|
38
186
|
|
39
187
|
To update version number, edit version.rb, and repackage:
|
40
188
|
|
@@ -46,39 +194,10 @@ To tag and publish the gem to rubygems.org:
|
|
46
194
|
|
47
195
|
rake publish
|
48
196
|
|
49
|
-
|
50
|
-
|
51
|
-
At the top of a Sass file in your Rails project you should use an `@import` rule
|
52
|
-
to include the file for the mixins you require. For example here are all the
|
53
|
-
imports possible:
|
54
|
-
|
55
|
-
@import 'elements/helpers';
|
56
|
-
@import 'elements/reset';
|
57
|
-
@import 'elements/elements-typography';
|
58
|
-
@import 'elements/layout';
|
59
|
-
|
60
|
-
@import 'elements/forms';
|
61
|
-
@import 'elements/tables';
|
62
|
-
@import 'elements/buttons';
|
63
|
-
@import 'elements/details';
|
64
|
-
@import 'elements/lists';
|
65
|
-
@import 'elements/panels';
|
66
|
-
@import "elements/icons";
|
197
|
+
If you are installing from git for testing, ensure you enable submodules in your Gemfile
|
198
|
+
require like so:
|
67
199
|
|
68
|
-
|
69
|
-
`require` rule to include the files for the javascript enhancements you require.
|
70
|
-
For example here are all the requires possible at present:
|
71
|
-
|
72
|
-
// from govuk_elements gem
|
73
|
-
//= require details.polyfill
|
74
|
-
//= require bind
|
75
|
-
//= require selection-buttons
|
76
|
-
|
77
|
-
## Alternate ways to reuse GOV.UK Elements
|
78
|
-
|
79
|
-
There are other alternate ways to include GOV.UK Elements files in a Rails
|
80
|
-
project, for example via `Bower`. Feel free to use an alternate approach if it
|
81
|
-
is more appropriate for your team.
|
200
|
+
gem 'govuk_elements_rails', :git => "https://github.com/ministryofjustice/govuk_elements_rails.git", :submodules => true
|
82
201
|
|
83
202
|
## Feedback
|
84
203
|
|
data/lib/govuk_elements_rails.rb
CHANGED
@@ -1,14 +1,4 @@
|
|
1
1
|
module GovUKElementsRails
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
-
|
4
|
-
initializer "govuk_elements_rails.default_form_builder" do |app|
|
5
|
-
use_builder = app.config.respond_to?(:use_govuk_elements_form_builder) &&
|
6
|
-
app.config.use_govuk_elements_form_builder
|
7
|
-
|
8
|
-
if use_builder
|
9
|
-
ActionView::Base.default_form_builder = GovukElementsFormBuilder
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
3
|
end
|
14
4
|
end
|
@@ -7,6 +7,9 @@
|
|
7
7
|
// http://www.sitepoint.com/fixing-the-details-element/
|
8
8
|
|
9
9
|
(function () {
|
10
|
+
'use strict';
|
11
|
+
|
12
|
+
var NATIVE_DETAILS = typeof document.createElement('details').open === 'boolean';
|
10
13
|
|
11
14
|
// Add event construct for modern browsers or IE
|
12
15
|
// which fires the callback with a pre-converted target reference
|
@@ -26,7 +29,7 @@
|
|
26
29
|
function addClickEvent(node, callback) {
|
27
30
|
// Prevent space(32) from scrolling the page
|
28
31
|
addEvent(node, 'keypress', function (e, target) {
|
29
|
-
if (target.nodeName ===
|
32
|
+
if (target.nodeName === 'SUMMARY') {
|
30
33
|
if (e.keyCode === 32) {
|
31
34
|
if (e.preventDefault) {
|
32
35
|
e.preventDefault();
|
@@ -78,12 +81,9 @@
|
|
78
81
|
|
79
82
|
// else iterate through them to apply their initial state
|
80
83
|
var n = list.length, i = 0;
|
81
|
-
for (
|
84
|
+
for (i; i < n; i++) {
|
82
85
|
var details = list[i];
|
83
86
|
|
84
|
-
// Detect native implementations
|
85
|
-
details.__native = typeof(details.open) == 'boolean';
|
86
|
-
|
87
87
|
// Save shortcuts to the inner summary and content elements
|
88
88
|
details.__summary = details.getElementsByTagName('summary').item(0);
|
89
89
|
details.__content = details.getElementsByTagName('div').item(0);
|
@@ -103,47 +103,23 @@
|
|
103
103
|
// Add aria-controls
|
104
104
|
details.__summary.setAttribute('aria-controls', details.__content.id);
|
105
105
|
|
106
|
-
// Set
|
107
|
-
// details.__summary.setAttribute('tabindex', 0);
|
106
|
+
// Set tabIndex so the summary is keyboard accessible for non-native elements
|
108
107
|
// http://www.saliences.com/browserBugs/tabIndex.html
|
109
|
-
|
110
|
-
|
111
|
-
|
108
|
+
if (!NATIVE_DETAILS) {
|
109
|
+
details.__summary.tabIndex = 0;
|
110
|
+
}
|
112
111
|
|
113
|
-
//
|
114
|
-
|
112
|
+
// Detect initial open state
|
113
|
+
var openAttr = details.getAttribute('open') !== null;
|
114
|
+
if (openAttr === true) {
|
115
115
|
details.__summary.setAttribute('aria-expanded', 'true');
|
116
116
|
details.__content.setAttribute('aria-hidden', 'false');
|
117
|
-
|
118
|
-
}
|
119
|
-
|
120
|
-
// Native support - doesn't have 'open' attribute
|
121
|
-
if (details.open === false) {
|
117
|
+
} else {
|
122
118
|
details.__summary.setAttribute('aria-expanded', 'false');
|
123
119
|
details.__content.setAttribute('aria-hidden', 'true');
|
124
|
-
|
125
|
-
}
|
126
|
-
|
127
|
-
// If this is not a native implementation
|
128
|
-
if (!details.__native) {
|
129
|
-
|
130
|
-
// Add an arrow
|
131
|
-
var twisty = document.createElement('i');
|
132
|
-
|
133
|
-
// Check for the 'open' attribute
|
134
|
-
// If open exists, but isn't supported it won't have a value
|
135
|
-
if (details.getAttribute('open') === "") {
|
136
|
-
details.__summary.setAttribute('aria-expanded', 'true');
|
137
|
-
details.__content.setAttribute('aria-hidden', 'false');
|
138
|
-
}
|
139
|
-
|
140
|
-
// If open doesn't exist - it will be null or undefined
|
141
|
-
if (details.getAttribute('open') == null || details.getAttribute('open') == "undefined" ) {
|
142
|
-
details.__summary.setAttribute('aria-expanded', 'false');
|
143
|
-
details.__content.setAttribute('aria-hidden', 'true');
|
120
|
+
if (!NATIVE_DETAILS) {
|
144
121
|
details.__content.style.display = 'none';
|
145
122
|
}
|
146
|
-
|
147
123
|
}
|
148
124
|
|
149
125
|
// Create a circular reference from the summary back to its
|
@@ -152,11 +128,11 @@
|
|
152
128
|
|
153
129
|
// If this is not a native implementation, create an arrow
|
154
130
|
// inside the summary
|
155
|
-
if (!
|
131
|
+
if (!NATIVE_DETAILS) {
|
156
132
|
|
157
133
|
var twisty = document.createElement('i');
|
158
134
|
|
159
|
-
if (
|
135
|
+
if (openAttr === true) {
|
160
136
|
twisty.className = 'arrow arrow-open';
|
161
137
|
twisty.appendChild(document.createTextNode('\u25bc'));
|
162
138
|
} else {
|
@@ -174,12 +150,22 @@
|
|
174
150
|
// Also update the arrow position
|
175
151
|
function statechange(summary) {
|
176
152
|
|
177
|
-
var expanded = summary.__details.__summary.getAttribute('aria-expanded')
|
178
|
-
var hidden = summary.__details.__content.getAttribute('aria-hidden')
|
153
|
+
var expanded = summary.__details.__summary.getAttribute('aria-expanded') === 'true';
|
154
|
+
var hidden = summary.__details.__content.getAttribute('aria-hidden') === 'true';
|
179
155
|
|
180
156
|
summary.__details.__summary.setAttribute('aria-expanded', (expanded ? 'false' : 'true'));
|
181
157
|
summary.__details.__content.setAttribute('aria-hidden', (hidden ? 'false' : 'true'));
|
182
|
-
|
158
|
+
|
159
|
+
if (!NATIVE_DETAILS) {
|
160
|
+
summary.__details.__content.style.display = (expanded ? 'none' : '');
|
161
|
+
|
162
|
+
var hasOpenAttr = summary.__details.getAttribute('open') !== null;
|
163
|
+
if (!hasOpenAttr) {
|
164
|
+
summary.__details.setAttribute('open', 'open');
|
165
|
+
} else {
|
166
|
+
summary.__details.removeAttribute('open');
|
167
|
+
}
|
168
|
+
}
|
183
169
|
|
184
170
|
if (summary.__twisty) {
|
185
171
|
summary.__twisty.firstChild.nodeValue = (expanded ? '\u25ba' : '\u25bc');
|
@@ -0,0 +1,54 @@
|
|
1
|
+
// GOV.UK front end toolkit
|
2
|
+
// Sass variables, mixins and functions
|
3
|
+
// https://github.com/alphagov/govuk_frontend_toolkit/tree/master/stylesheets
|
4
|
+
|
5
|
+
// Settings (variables)
|
6
|
+
@import "colours"; // Colour variables
|
7
|
+
@import "font_stack"; // Font family variables
|
8
|
+
@import "measurements"; // Widths and gutter variables
|
9
|
+
|
10
|
+
// Mixins
|
11
|
+
@import "conditionals"; // Media query mixin
|
12
|
+
@import "device-pixels"; // Retina image mixin
|
13
|
+
@import "grid_layout"; // Basic grid layout mixin
|
14
|
+
@import "typography"; // Core bold and heading mixins, also external links
|
15
|
+
@import "shims"; // Inline block mixin, clearfix placeholder
|
16
|
+
|
17
|
+
// Mixins to generate components (chunks of UI)
|
18
|
+
@import "design-patterns/alpha-beta";
|
19
|
+
@import "design-patterns/buttons";
|
20
|
+
@import "design-patterns/breadcrumbs";
|
21
|
+
|
22
|
+
// Functions
|
23
|
+
// @import "url-helpers"; // Function to output image-url, or prefixed path (Rails and Compass only)
|
24
|
+
|
25
|
+
// GOV.UK elements
|
26
|
+
|
27
|
+
@import "elements/helpers"; // Helper functions and classes
|
28
|
+
|
29
|
+
// Generic (normalize/reset.css)
|
30
|
+
@import "elements/reset";
|
31
|
+
|
32
|
+
// Base (unclassed HTML elements)
|
33
|
+
// These are predefined by govuk_template
|
34
|
+
// If you're not using govuk_template, uncomment the line below.
|
35
|
+
// @import "elements/base"; // HTML elements, set by the GOV.UK template
|
36
|
+
|
37
|
+
// Objects (unstyled design patterns)
|
38
|
+
@import "elements/layout"; // Main content container. Grid layout - rows and column widths
|
39
|
+
|
40
|
+
// Components (chunks of UI)
|
41
|
+
@import "elements/elements-typography"; // Typography
|
42
|
+
@import "elements/buttons"; // Buttons
|
43
|
+
@import "elements/icons"; // Icons - numbered steps, calendar, search
|
44
|
+
@import "elements/lists"; // Lists - numbered, bulleted
|
45
|
+
@import "elements/tables"; // Tables - regular, numeric
|
46
|
+
@import "elements/details"; // Details summary
|
47
|
+
@import "elements/panels"; // Panels with a left grey border
|
48
|
+
@import "elements/forms"; // Form - wrappers, inputs, labels
|
49
|
+
@import "elements/forms/form-block-labels"; // Chunky labels for radios and checkboxes
|
50
|
+
@import "elements/forms/form-date"; // Date of birth pattern
|
51
|
+
@import "elements/forms/form-validation"; // Errors and validation
|
52
|
+
@import "elements/breadcrumbs"; // Breadcrumbs
|
53
|
+
@import "elements/phase-banner"; // Alpha and beta banners and tags
|
54
|
+
@import "elements/components"; // GOV.UK prefixed styles - blue highlighted box
|