govuk_publishing_components 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +50 -41
- data/Rakefile +6 -2
- data/app/assets/javascripts/govuk_publishing_components/components/task-list.js +8 -9
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +18 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss +11 -0
- data/app/assets/stylesheets/govuk_publishing_components/{application.scss → component_guide.scss} +2 -9
- data/app/assets/stylesheets/govuk_publishing_components/component_guide_print.scss +0 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +39 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_task-list-related.scss +7 -7
- data/app/assets/stylesheets/govuk_publishing_components/components/_task-list.scss +23 -23
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_variables.scss +1 -0
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_input.html.erb +31 -0
- data/app/views/govuk_publishing_components/components/_task_list.html.erb +15 -56
- data/app/views/govuk_publishing_components/components/_task_list_related.html.erb +7 -7
- data/app/views/govuk_publishing_components/components/docs/input.yml +22 -0
- data/app/views/govuk_publishing_components/components/docs/task_list.yml +45 -50
- data/app/views/layouts/govuk_publishing_components/application.html.erb +2 -2
- data/config/initializers/assets.rb +1 -1
- data/lib/govuk_publishing_components.rb +1 -0
- data/lib/govuk_publishing_components/components/task_list_helper.rb +111 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +25 -5
- data/app/assets/stylesheets/govuk_publishing_components/print.scss +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9cc0e69ba995b899312ec518fc2193c23b09b942d5cc4a3fefe65a6d2bb3535e
|
4
|
+
data.tar.gz: e51a19c9a7298816343b611486c92873fba2f05160344e22ff8c39ab33b447a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b864217c5e2b22c3ef1ec1c999a857aab5116cf57bea4aa523f2f5927673b1236538ef3d6dd57970fc33906b967dca79456bc28fb65eb57e162deb4c9b6e3ff
|
7
|
+
data.tar.gz: 745f7d086a3ae2eba8ebbf8ca0ddd3a179c7c09320aaab5518a6edec150aae8f74c7738d0670173ca17395ef23440a033122f68b372e2cffd518232a0afbe2ad
|
data/README.md
CHANGED
@@ -1,21 +1,35 @@
|
|
1
1
|
# GOV.UK Publishing Components
|
2
2
|
|
3
|
-
A gem to document components in GOV.UK frontend applications.
|
3
|
+
A gem to document components in GOV.UK frontend applications and provide shared components to applications. Components should be added to this gem if they are required in more than one application, otherwise they should be added to that application.
|
4
4
|
|
5
5
|
![Screenshot of component guide](docs/screenshot.png)
|
6
6
|
|
7
7
|
## Write components in your application
|
8
8
|
|
9
|
-
Components are packages of template, style, behaviour and documentation
|
9
|
+
Components are packages of template, style, behaviour and documentation.
|
10
10
|
|
11
11
|
A component must:
|
12
12
|
* [meet the component principles](docs/component_principles.md)
|
13
13
|
* [follow component conventions](docs/component_conventions.md)
|
14
14
|
|
15
|
-
|
15
|
+
Components are included in templates in slightly different ways depending on whether the component is in the application itself, in static, or in the gem.
|
16
|
+
|
17
|
+
A component from the application would be included in a template like this:
|
18
|
+
|
19
|
+
```erb
|
20
|
+
<%= render "components/back-to-top", href: "#contents" %>
|
21
|
+
```
|
22
|
+
|
23
|
+
A component from static would be included like this:
|
24
|
+
|
25
|
+
```erb
|
26
|
+
<%= render "govuk_component/lead_paragraph", text: "A description is one or two leading sentences." %>
|
27
|
+
```
|
28
|
+
|
29
|
+
A component from the gem would be included like this:
|
16
30
|
|
17
31
|
```erb
|
18
|
-
<%= render
|
32
|
+
<%= render "govuk_publishing_components/components/back_link", href: "#" %>
|
19
33
|
```
|
20
34
|
|
21
35
|
## Set up a component guide
|
@@ -27,9 +41,11 @@ https://government-frontend.herokuapp.com/component-guide
|
|
27
41
|
|
28
42
|
The guide includes your application’s `application.scss` and `application.js` files by default. This is [configurable](#configuration).
|
29
43
|
|
44
|
+
You are encouraged to set up [Heroku review apps](https://docs.publishing.service.gov.uk/manual/review-apps.html) for your application, so that any changes to local components can be reviewed by looking at the component guide.
|
45
|
+
|
30
46
|
### Install gem
|
31
47
|
|
32
|
-
Add this line to your application's Gemfile
|
48
|
+
Add this line to your application's Gemfile:
|
33
49
|
|
34
50
|
```ruby
|
35
51
|
gem 'govuk_publishing_components'
|
@@ -40,39 +56,13 @@ And then execute:
|
|
40
56
|
$ bundle
|
41
57
|
```
|
42
58
|
|
43
|
-
#### Integration with Heroku
|
44
|
-
|
45
|
-
To make the best use of the component guide we use Heroku to serve the current `master` build and whenever a [pull request is added](https://devcenter.heroku.com/articles/github-integration-review-apps)
|
46
|
-
|
47
|
-
When an app is deployed to Heroku it will be in `production` mode, so only gems that are in the main group will be installed and made available.
|
48
|
-
To ensure that we only load the guide on Heroku and not when deployed to _production_ we need to have the gem included in the main bundle group in the Gemfile.
|
49
|
-
For this use case we need `require: false` so that it's not loaded in _production_ but then we can manually `require` the gem in our `application.rb` based on the more complex environmental logic that we've specified.
|
50
|
-
|
51
|
-
First move the gem outside of the `development`, `test` groups and set require to false. ([example](https://github.com/alphagov/government-frontend/blob/5110d3d33f7a6b63f218b889a5afec90e6df810f/Gemfile#L11)):
|
52
|
-
|
53
|
-
```ruby
|
54
|
-
# Gemfile
|
55
|
-
gem 'govuk_publishing_components', require: false
|
56
|
-
```
|
57
|
-
|
58
|
-
Now we can manually require the gem ([example](https://github.com/alphagov/government-frontend/blob/5110d3d33f7a6b63f218b889a5afec90e6df810f/config/application.rb#L14)):
|
59
|
-
|
60
|
-
```ruby
|
61
|
-
# config/application.rb
|
62
|
-
if !Rails.env.production? || ENV['HEROKU_APP_NAME'].present?
|
63
|
-
require 'govuk_publishing_components'
|
64
|
-
end
|
65
|
-
```
|
66
|
-
|
67
59
|
### Mount the component guide
|
68
60
|
|
69
61
|
Mount the component guide in your application:
|
70
62
|
|
71
63
|
```ruby
|
72
64
|
# config/routes.rb
|
73
|
-
|
74
|
-
mount GovukPublishingComponents::Engine, at: "/component-guide" if defined?(GovukPublishingComponents)
|
75
|
-
end
|
65
|
+
mount GovukPublishingComponents::Engine, at: "/component-guide"
|
76
66
|
```
|
77
67
|
|
78
68
|
If your application was government-frontend the component guide would be at:
|
@@ -84,14 +74,12 @@ Use a config block in an initializer:
|
|
84
74
|
|
85
75
|
```ruby
|
86
76
|
# config/initializers/govuk_publishing_components.rb
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
c.application_javascript = "custom_javascript" # Defaults to "application"
|
94
|
-
end
|
77
|
+
GovukPublishingComponents.configure do |c|
|
78
|
+
c.component_guide_title = "My component guide"
|
79
|
+
|
80
|
+
c.application_stylesheet = "custom_stylesheet" # Defaults to "application"
|
81
|
+
c.application_print_stylesheet = "print" # Not included by default
|
82
|
+
c.application_javascript = "custom_javascript" # Defaults to "application"
|
95
83
|
end
|
96
84
|
```
|
97
85
|
|
@@ -154,6 +142,10 @@ class ComponentGuideTest < ActionDispatch::IntegrationTest
|
|
154
142
|
end
|
155
143
|
```
|
156
144
|
|
145
|
+
#### Test files
|
146
|
+
|
147
|
+
All test files for components in the gem can be run with the command `bundle exec rake`.
|
148
|
+
|
157
149
|
### Exclude accessibility rules
|
158
150
|
|
159
151
|
Sometimes you will have a component that will throw an error due to it being in isolation, for example radio buttons not being in a fieldset.
|
@@ -165,7 +157,7 @@ For an example of this check [test/.../docs/test-component-with-duplicate-ids.ym
|
|
165
157
|
|
166
158
|
## Component generator
|
167
159
|
|
168
|
-
The gem includes a component generator to stub the minimal files required for a component.
|
160
|
+
The gem includes a component generator to stub the minimal files required for a component. The following command will create a component in the application it is run in - it will not create a component if run within the gem.
|
169
161
|
|
170
162
|
```ruby
|
171
163
|
rails generate govuk_publishing_components:component [component_name]
|
@@ -173,6 +165,20 @@ rails generate govuk_publishing_components:component [component_name]
|
|
173
165
|
|
174
166
|
This will create a template, scss file and yml documentation file for a new component. It will not create a test file as this cannot be reliably done automatically across applications, but a test file will be necessary.
|
175
167
|
|
168
|
+
### Creating components in the gem
|
169
|
+
|
170
|
+
Currently components in the gem must be manually created. File naming conventions should follow those in the [component conventions](docs/component_conventions.md), but a slightly different directory structure is required to avoid conflicts with components in applications.
|
171
|
+
|
172
|
+
* Stylesheets go in `app/assets/stylesheets/govuk_publishing_components/components`
|
173
|
+
* Print stylesheets go in `app/assets/stylesheets/govuk_publishing_components/components/print`
|
174
|
+
* Scripts go in `app/assets/javascripts/govuk_publishing_components/components`
|
175
|
+
* Templates go in `app/views/govuk_publishing_components/components`
|
176
|
+
* Documentation goes in `app/views/govuk_publishing_components/components/docs`
|
177
|
+
* Test files go in `spec/components`
|
178
|
+
* Script test files go in `spec/javascripts/components`
|
179
|
+
|
180
|
+
In addition, components in the gem can have helper files. Helper files go in `lib/govuk_publishing_components/components` and need to be required in `lib/govuk_publishing_components.rb`. Helper files should be structured as a class.
|
181
|
+
|
176
182
|
## Automated Testing
|
177
183
|
### Visual Diff Tool
|
178
184
|
The component guide includes a visual diff tool that should make it easier to spot when you are introducing visual regressions in your components.
|
@@ -190,3 +196,6 @@ The tool can be run via the console using the following command:
|
|
190
196
|
|
191
197
|
## Development
|
192
198
|
For documentation on how to update and develop this gem see [DEVELOPMENT.md](./DEVELOPMENT.md)
|
199
|
+
|
200
|
+
### Moving components upstream into this gem
|
201
|
+
See [the documentation on how to move components into this gem](docs/moving-components-upstream-into-this-gem.md)
|
data/Rakefile
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
begin
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
RSpec::Core::RakeTask.new(:spec)
|
4
|
+
rescue LoadError
|
5
|
+
puts "Running in production mode"
|
6
|
+
end
|
3
7
|
|
4
8
|
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
5
9
|
|
@@ -27,7 +27,7 @@
|
|
27
27
|
var rememberShownStep = false;
|
28
28
|
var taskListSize;
|
29
29
|
var sessionStoreLink = 'govuk-task-list-active-link';
|
30
|
-
var activeLinkClass = 'gem-c-task-list__link
|
30
|
+
var activeLinkClass = 'gem-c-task-list__link--active';
|
31
31
|
var activeLinkHref = '#content';
|
32
32
|
|
33
33
|
this.start = function ($element) {
|
@@ -94,8 +94,9 @@
|
|
94
94
|
if (headerIsOpen($(this))) {
|
95
95
|
linkText = actions.hideLinkText;
|
96
96
|
}
|
97
|
-
|
98
|
-
|
97
|
+
if (!$(this).find('.js-toggle-link').length) {
|
98
|
+
$(this).append('<span class="gem-c-task-list__toggle-link js-toggle-link">' + linkText + '</span>');
|
99
|
+
}
|
99
100
|
});
|
100
101
|
}
|
101
102
|
|
@@ -172,9 +173,6 @@
|
|
172
173
|
var toggleClick = new StepToggleClick(event, stepView, $steps, tasklistTracker, $groups);
|
173
174
|
toggleClick.track();
|
174
175
|
|
175
|
-
var toggleLink = $(this).find('.js-toggle-link');
|
176
|
-
toggleLink.text(toggleLink.text() == actions.showLinkText ? actions.hideLinkText : actions.showLinkText);
|
177
|
-
|
178
176
|
setShowHideAllText();
|
179
177
|
});
|
180
178
|
}
|
@@ -210,11 +208,11 @@
|
|
210
208
|
|
211
209
|
function setOnlyThisLinkActive(clicked) {
|
212
210
|
$element.find('.' + activeLinkClass).removeClass(activeLinkClass);
|
213
|
-
clicked.addClass(activeLinkClass);
|
211
|
+
clicked.parent().addClass(activeLinkClass);
|
214
212
|
}
|
215
213
|
|
216
214
|
function ensureOnlyOneActiveLink() {
|
217
|
-
var $activeLinks = $element.find('.js-
|
215
|
+
var $activeLinks = $element.find('.js-list-item.' + activeLinkClass);
|
218
216
|
|
219
217
|
if ($activeLinks.length <= 1) {
|
220
218
|
return;
|
@@ -239,7 +237,7 @@
|
|
239
237
|
|
240
238
|
function removeActiveStateFromAllButCurrent($links, current) {
|
241
239
|
$links.each(function() {
|
242
|
-
if ($(this).data('position') !== current) {
|
240
|
+
if ($(this).find('.js-link').data('position') !== current) {
|
243
241
|
$(this).removeClass(activeLinkClass);
|
244
242
|
}
|
245
243
|
});
|
@@ -339,6 +337,7 @@
|
|
339
337
|
$stepElement.toggleClass('step-is-shown', isShown);
|
340
338
|
$stepContent.toggleClass('js-hidden', !isShown);
|
341
339
|
$titleLink.attr("aria-expanded", isShown);
|
340
|
+
$stepElement.find('.js-toggle-link').text(isShown ? actions.hideLinkText : actions.showLinkText);
|
342
341
|
|
343
342
|
if (shouldUpdateHash) {
|
344
343
|
updateHash($stepElement);
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// This is the file that the application needs to include in order to use
|
2
|
+
// the components.
|
3
|
+
|
4
|
+
// `govuk_frontend_toolkit`
|
5
|
+
@import "measurements";
|
6
|
+
@import "grid_layout";
|
7
|
+
@import "typography";
|
8
|
+
@import "colours";
|
9
|
+
|
10
|
+
@import "components/back-link";
|
11
|
+
@import "components/error-summary";
|
12
|
+
@import "components/fieldset";
|
13
|
+
@import "components/input";
|
14
|
+
@import "components/label";
|
15
|
+
@import "components/radio";
|
16
|
+
@import "components/task-list";
|
17
|
+
@import "components/task-list-header";
|
18
|
+
@import "components/task-list-related";
|
@@ -0,0 +1,11 @@
|
|
1
|
+
// This is the file that the application needs to include in order to use
|
2
|
+
// the components.
|
3
|
+
|
4
|
+
// `govuk_frontend_toolkit`
|
5
|
+
@import "measurements";
|
6
|
+
@import "grid_layout";
|
7
|
+
@import "typography";
|
8
|
+
@import "colours";
|
9
|
+
|
10
|
+
@import "components/print/task-list";
|
11
|
+
@import "components/print/task-list-header";
|
data/app/assets/stylesheets/govuk_publishing_components/{application.scss → component_guide.scss}
RENAMED
@@ -1,18 +1,11 @@
|
|
1
|
+
// This file contains the styles for the Component Guide.
|
2
|
+
|
1
3
|
// `govuk_frontend_toolkit`
|
2
4
|
@import "measurements";
|
3
5
|
@import "grid_layout";
|
4
6
|
@import "typography";
|
5
7
|
@import "colours";
|
6
8
|
|
7
|
-
@import "components/back-link";
|
8
|
-
@import "components/error-summary";
|
9
|
-
@import "components/fieldset";
|
10
|
-
@import "components/label";
|
11
|
-
@import "components/radio";
|
12
|
-
@import "components/task-list";
|
13
|
-
@import "components/task-list-header";
|
14
|
-
@import "components/task-list-related";
|
15
|
-
|
16
9
|
$border-color: #ccc;
|
17
10
|
|
18
11
|
.govuk-component-guide-wrapper {
|
File without changes
|
@@ -0,0 +1,39 @@
|
|
1
|
+
.gem-c-input {
|
2
|
+
@include core-19;
|
3
|
+
|
4
|
+
box-sizing: border-box;
|
5
|
+
width: 100%;
|
6
|
+
height: 2.10526em;
|
7
|
+
margin-top: 0;
|
8
|
+
margin-bottom: 20px;
|
9
|
+
|
10
|
+
padding: $gem-spacing-scale-1;
|
11
|
+
// setting any background-color makes text invisible when changing colours to dark backgrounds in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1335476)
|
12
|
+
// as background-color and color need to always be set together, color should not be set either
|
13
|
+
border: $gem-border-width-form-element solid;
|
14
|
+
border-radius: 0;
|
15
|
+
|
16
|
+
// Disable inner shadow and remove rounded corners
|
17
|
+
appearance: none;
|
18
|
+
}
|
19
|
+
|
20
|
+
@media (min-width: 40.0625em) {
|
21
|
+
.govuk-c-input {
|
22
|
+
margin-bottom: 30px;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
.gem-c-input:focus {
|
27
|
+
outline: $gem-focus-width solid $gem-focus-colour;
|
28
|
+
}
|
29
|
+
|
30
|
+
.gem-c-input--error {
|
31
|
+
border: $gem-border-width-error solid $gem-error-colour;
|
32
|
+
}
|
33
|
+
|
34
|
+
// Replace this with the error message component.
|
35
|
+
.gem-c-input__label-error {
|
36
|
+
font-weight: bold;
|
37
|
+
color: $gem-error-colour;
|
38
|
+
padding-top: 4px;
|
39
|
+
}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
.
|
1
|
+
.gem-c-task-list-related {
|
2
2
|
margin-bottom: $gutter-half;
|
3
3
|
}
|
4
4
|
|
5
|
-
.
|
6
|
-
.
|
5
|
+
.gem-c-task-list-related__heading,
|
6
|
+
.gem-c-task-list-related__links {
|
7
7
|
@include bold-19;
|
8
8
|
margin: 0;
|
9
9
|
padding: 0;
|
10
10
|
}
|
11
11
|
|
12
|
-
.
|
12
|
+
.gem-c-task-list-related__pretitle {
|
13
13
|
display: block;
|
14
14
|
margin-bottom: $gutter-half;
|
15
15
|
|
@@ -18,11 +18,11 @@
|
|
18
18
|
}
|
19
19
|
}
|
20
20
|
|
21
|
-
.
|
21
|
+
.gem-c-task-list-related__links {
|
22
22
|
list-style: none;
|
23
23
|
}
|
24
24
|
|
25
|
-
.
|
25
|
+
.gem-c-task-list-related__link-item {
|
26
26
|
margin-top: $gutter-half;
|
27
27
|
|
28
28
|
@include media(tablet) {
|
@@ -30,7 +30,7 @@
|
|
30
30
|
}
|
31
31
|
}
|
32
32
|
|
33
|
-
.
|
33
|
+
.gem-c-task-list-related__link {
|
34
34
|
text-decoration: none;
|
35
35
|
|
36
36
|
&:hover {
|
@@ -350,13 +350,13 @@ $top-border: solid 2px $grey-3;
|
|
350
350
|
margin-left: $links-margin;
|
351
351
|
list-style: disc;
|
352
352
|
|
353
|
-
.gem-c-task-list__link
|
353
|
+
.gem-c-task-list__link--active:before {
|
354
354
|
left: -($gutter + $gutter-half) - $links-margin;
|
355
355
|
}
|
356
356
|
|
357
357
|
.gem-c-task-list--large & {
|
358
358
|
@include media(tablet) {
|
359
|
-
.gem-c-task-list__link
|
359
|
+
.gem-c-task-list__link--active:before {
|
360
360
|
left: -($gutter * 2) - $links-margin;
|
361
361
|
}
|
362
362
|
}
|
@@ -367,27 +367,8 @@ $top-border: solid 2px $grey-3;
|
|
367
367
|
margin-bottom: 10px;
|
368
368
|
}
|
369
369
|
|
370
|
-
.gem-c-task-list__link
|
371
|
-
text-decoration: none;
|
372
|
-
|
373
|
-
&:hover {
|
374
|
-
text-decoration: underline;
|
375
|
-
}
|
376
|
-
}
|
377
|
-
|
378
|
-
.gem-c-task-list__link-item--active {
|
370
|
+
.gem-c-task-list__link--active {
|
379
371
|
position: relative;
|
380
|
-
color: $black;
|
381
|
-
|
382
|
-
&:visited,
|
383
|
-
&:active,
|
384
|
-
&:link {
|
385
|
-
color: $black;
|
386
|
-
}
|
387
|
-
|
388
|
-
&:focus {
|
389
|
-
outline: 0;
|
390
|
-
}
|
391
372
|
|
392
373
|
&:before {
|
393
374
|
@include box-sizing(border-box);
|
@@ -413,14 +394,33 @@ $top-border: solid 2px $grey-3;
|
|
413
394
|
}
|
414
395
|
}
|
415
396
|
}
|
397
|
+
|
398
|
+
.gem-c-task-list__link-item {
|
399
|
+
color: $black;
|
400
|
+
|
401
|
+
&:visited,
|
402
|
+
&:active,
|
403
|
+
&:link {
|
404
|
+
color: $black;
|
405
|
+
}
|
406
|
+
}
|
407
|
+
}
|
408
|
+
|
409
|
+
.gem-c-task-list__link-item {
|
410
|
+
text-decoration: none;
|
411
|
+
|
412
|
+
&:hover {
|
413
|
+
text-decoration: underline;
|
414
|
+
}
|
416
415
|
}
|
417
416
|
|
418
417
|
.gem-c-task-list__context {
|
418
|
+
display: inline-block;
|
419
419
|
font-weight: normal;
|
420
420
|
color: $grey-1;
|
421
421
|
|
422
422
|
&:before {
|
423
|
-
content: " \2013
|
423
|
+
content: " \2013\00a0"; // dash followed by
|
424
424
|
}
|
425
425
|
}
|
426
426
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<p>See the <a href="https://github.com/alphagov/govuk_publishing_components">govuk_publishing_components gem</a> for further details, or <a href="https://docs.publishing.service.gov.uk/manual/components.html#component-guides">a list of all component guides</a>.</p>
|
11
11
|
</div>
|
12
12
|
|
13
|
-
<h2 class="component-doc-h2">Components</h2>
|
13
|
+
<h2 class="component-doc-h2">Components in this application</h2>
|
14
14
|
|
15
15
|
<ul class="component-list">
|
16
16
|
<% @component_docs.each do |component_doc| %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%
|
2
|
+
id ||= "input-#{SecureRandom.hex(4)}"
|
3
|
+
hint_id ||= "hint-#{SecureRandom.hex(4)}"
|
4
|
+
value ||= false
|
5
|
+
error_message ||= false
|
6
|
+
label ||= {}
|
7
|
+
%>
|
8
|
+
|
9
|
+
<%= render "govuk_publishing_components/components/label", {
|
10
|
+
text: label[:text],
|
11
|
+
html_for: id,
|
12
|
+
hint_text: error_message,
|
13
|
+
hint_text_classes: "gem-c-input__label-error",
|
14
|
+
hint_id: hint_id,
|
15
|
+
bold: error_message ? true : false,
|
16
|
+
} %>
|
17
|
+
|
18
|
+
<input
|
19
|
+
class="gem-c-input <%= "gem-c-input--error" if error_message %>"
|
20
|
+
id="<%= id %>"
|
21
|
+
name="<%= name %>"
|
22
|
+
type="text"
|
23
|
+
|
24
|
+
<% if error_message %>
|
25
|
+
aria-describedby="<%= hint_id %>"
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<% if value %>
|
29
|
+
value="<%= value %>"
|
30
|
+
<% end %>
|
31
|
+
>
|
@@ -1,7 +1,9 @@
|
|
1
1
|
<%
|
2
|
+
options = {}
|
3
|
+
options[:heading_level] = heading_level ||= 2
|
4
|
+
|
2
5
|
groups ||= false
|
3
6
|
small ||= false
|
4
|
-
heading_level ||= 2
|
5
7
|
show_step ||= false
|
6
8
|
remember_last_step ||= false
|
7
9
|
task_list_url ||= false
|
@@ -33,7 +35,7 @@
|
|
33
35
|
<% group.each_with_index do |step, step_index| %>
|
34
36
|
<%
|
35
37
|
step_count += 1
|
36
|
-
id = step[:
|
38
|
+
id = TaskListHelper.new.generate_task_list_id(step[:title])
|
37
39
|
|
38
40
|
logic = "and"
|
39
41
|
logic = step[:logic] if ["and", "or"].include? step[:logic]
|
@@ -55,68 +57,25 @@
|
|
55
57
|
<% end %>
|
56
58
|
|
57
59
|
<div class="gem-c-task-list__header js-toggle-panel" data-position="<%= "#{group_index + 1}.#{step_index + 1}" %>">
|
58
|
-
|
59
|
-
<%= step[:title] %>
|
60
|
-
</h<%= heading_level %>>
|
60
|
+
<%= content_tag("h#{heading_level}", step[:title], class: 'gem-c-task-list__title js-step-title') %>
|
61
61
|
</div>
|
62
62
|
|
63
63
|
<div class="gem-c-task-list__panel js-panel" id="step-panel-<%= id %>-<%= step_index + 1 %>">
|
64
64
|
<%
|
65
65
|
in_substep = false
|
66
|
-
|
66
|
+
options[:group_index] = group_index
|
67
|
+
options[:step_index] = step_index
|
68
|
+
options[:link_index] = 0
|
67
69
|
%>
|
68
70
|
<% step[:contents].each do |element| %>
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
<% elsif element[:type] == 'list' %>
|
76
|
-
<%
|
77
|
-
list_style = ''
|
78
|
-
list_element = 'ol'
|
79
|
-
|
80
|
-
if element[:style] == 'required'
|
81
|
-
list_style = 'gem-c-task-list__links--required'
|
82
|
-
elsif element[:style] == 'choice'
|
83
|
-
list_style = 'gem-c-task-list__links--choice'
|
84
|
-
list_element = 'ul'
|
85
|
-
end
|
86
|
-
%>
|
87
|
-
|
88
|
-
<%= content_tag(
|
89
|
-
list_element,
|
90
|
-
class: "gem-c-task-list__links #{list_style}",
|
91
|
-
data: {
|
92
|
-
length: element[:contents].length
|
93
|
-
}) do %>
|
94
|
-
<% element[:contents].each do |link| %>
|
95
|
-
<%
|
96
|
-
if link[:href]
|
97
|
-
link_href = link[:active] ? "#content" : link[:href]
|
98
|
-
link_text = link[:active] ? '<span class="visuallyhidden">You are currently viewing:</span> '.html_safe + link[:text] : link[:text]
|
99
|
-
link_active = 'gem-c-task-list__link-item--active' if link[:active]
|
100
|
-
link_rel = link_href.start_with?('http') ? 'rel=external' : ''
|
101
|
-
link_index += 1
|
102
|
-
link_position = "data-position=\"#{group_index + 1}.#{step_index + 1}.#{link_index}\""
|
103
|
-
|
104
|
-
link_tag = "<a href=\"#{link_href}\" class=\"gem-c-task-list__link-item js-link #{link_active}\" #{link_position} #{link_rel}>#{link_text}</a>".html_safe
|
105
|
-
else
|
106
|
-
link_tag = link[:text]
|
107
|
-
end
|
108
|
-
%>
|
109
|
-
<li class="gem-c-task-list__link">
|
110
|
-
<%= link_tag %>
|
111
|
-
|
112
|
-
<% if link[:context] %>
|
113
|
-
<span class="gem-c-task-list__context"><%= link[:context] %></span>
|
114
|
-
<% end %>
|
115
|
-
</li>
|
116
|
-
<% end %>
|
117
|
-
<% end %>
|
71
|
+
<%= TaskListHelper.new.render_task_list_element(element, options) %>
|
72
|
+
<%
|
73
|
+
if element[:type] == 'list'
|
74
|
+
options[:link_index] += element[:contents].length
|
75
|
+
end
|
76
|
+
%>
|
118
77
|
|
119
|
-
<%
|
78
|
+
<% if element[:type] == 'substep' %>
|
120
79
|
<% if in_substep %>
|
121
80
|
</div>
|
122
81
|
<% in_substep = false %>
|
@@ -3,12 +3,12 @@
|
|
3
3
|
pretitle ||= t("govuk_component.task_list_related.part_of", default: "Part of")
|
4
4
|
%>
|
5
5
|
<% if links %>
|
6
|
-
<div class="
|
7
|
-
<h2 class="
|
8
|
-
<span class="
|
6
|
+
<div class="gem-c-task-list-related" data-module="track-click">
|
7
|
+
<h2 class="gem-c-task-list-related__heading">
|
8
|
+
<span class="gem-c-task-list-related__pretitle"><%= pretitle %></span>
|
9
9
|
<% if links.length == 1 %>
|
10
10
|
<a href="<%= links[0][:href] %>"
|
11
|
-
class="
|
11
|
+
class="gem-c-task-list-related__link"
|
12
12
|
data-track-category="tasklistPartOfClicked"
|
13
13
|
data-track-action="<%= pretitle %>"
|
14
14
|
data-track-label="<%= links[0][:href] %>"
|
@@ -19,11 +19,11 @@
|
|
19
19
|
</h2>
|
20
20
|
<% else %>
|
21
21
|
</h2>
|
22
|
-
<ul class="
|
22
|
+
<ul class="gem-c-task-list-related__links">
|
23
23
|
<% links.each do |link| %>
|
24
|
-
<li class="
|
24
|
+
<li class="gem-c-task-list-related__link-item">
|
25
25
|
<a href="<%= link[:href] %>"
|
26
|
-
class="
|
26
|
+
class="gem-c-task-list-related__link"
|
27
27
|
data-track-category="tasklistPartOfClicked"
|
28
28
|
data-track-action="<%= pretitle %>"
|
29
29
|
data-track-label="<%= link[:href] %>"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Form input
|
2
|
+
description: A single-line text field.
|
3
|
+
body: |
|
4
|
+
[Forked from GOV.UK Frontend](https://govuk-frontend-review.herokuapp.com/components/input)
|
5
|
+
accessibility_criteria: |
|
6
|
+
Markdown listing what this component must do to be accessible. For example:
|
7
|
+
|
8
|
+
The link must:
|
9
|
+
|
10
|
+
* be keyboard focusable
|
11
|
+
examples:
|
12
|
+
default:
|
13
|
+
data:
|
14
|
+
label:
|
15
|
+
text: "What is your email address?"
|
16
|
+
name: "address"
|
17
|
+
with_error:
|
18
|
+
data:
|
19
|
+
label:
|
20
|
+
text: "What is your email address?"
|
21
|
+
name: "address"
|
22
|
+
error_message: "Email address not recognised"
|
@@ -699,8 +699,7 @@ examples:
|
|
699
699
|
contents: [
|
700
700
|
{
|
701
701
|
href: 'https://en.wikipedia.org/wiki/HDMI',
|
702
|
-
text: 'Remove the Chromebit from HDMI 1 on the TV'
|
703
|
-
active: true
|
702
|
+
text: 'Remove the Chromebit from HDMI 1 on the TV'
|
704
703
|
}
|
705
704
|
]
|
706
705
|
}
|
@@ -743,28 +742,28 @@ examples:
|
|
743
742
|
style: 'required',
|
744
743
|
contents: [
|
745
744
|
{
|
746
|
-
href: '',
|
747
|
-
text: 'Ensure the catchbox transmitter is plugged in at the mains wall'
|
748
|
-
active: true
|
745
|
+
href: 'http://www.google.com',
|
746
|
+
text: 'Ensure the catchbox transmitter is plugged in at the mains wall'
|
749
747
|
},
|
750
748
|
{
|
751
|
-
href: '',
|
749
|
+
href: 'http://www.google.com',
|
752
750
|
text: 'Turn on the transmitter and wait for the switch to blink green'
|
753
751
|
},
|
754
752
|
{
|
755
|
-
href: '',
|
756
|
-
text: 'Plug the transmitter USB cable into the facilitators laptop'
|
753
|
+
href: 'http://www.google.com',
|
754
|
+
text: 'Plug the transmitter USB cable into the facilitators laptop',
|
755
|
+
active: true
|
757
756
|
},
|
758
757
|
{
|
759
|
-
href: '',
|
758
|
+
href: 'http://www.google.com',
|
760
759
|
text: 'Twist and pull the black piece of foam out of the catchbox'
|
761
760
|
},
|
762
761
|
{
|
763
|
-
href: '',
|
762
|
+
href: 'http://www.google.com',
|
764
763
|
text: 'Turn on the catchbox and wait for the LED to turn green'
|
765
764
|
},
|
766
765
|
{
|
767
|
-
href: '',
|
766
|
+
href: 'http://www.google.com',
|
768
767
|
text: 'Wait for the transmitter light to turn solid green'
|
769
768
|
}
|
770
769
|
]
|
@@ -790,7 +789,7 @@ examples:
|
|
790
789
|
text: "Get annoyed when it doesn't work"
|
791
790
|
},
|
792
791
|
{
|
793
|
-
href: '',
|
792
|
+
href: 'http://www.google.com',
|
794
793
|
text: 'Try to find someone else who knows how to do it',
|
795
794
|
context: '1 to 10 minutes'
|
796
795
|
}
|
@@ -813,17 +812,15 @@ examples:
|
|
813
812
|
style: 'required',
|
814
813
|
contents: [
|
815
814
|
{
|
816
|
-
href: '',
|
817
|
-
text: 'Connect to standup hangout via the calendar invite'
|
818
|
-
active: true
|
815
|
+
href: 'http://www.google.com',
|
816
|
+
text: 'Connect to standup hangout via the calendar invite'
|
819
817
|
},
|
820
818
|
{
|
821
819
|
text: 'or'
|
822
820
|
},
|
823
821
|
{
|
824
|
-
href: '',
|
825
|
-
text: 'Connect to standup hangout via the link in the team slack'
|
826
|
-
active: true
|
822
|
+
href: 'http://www.google.com',
|
823
|
+
text: 'Connect to standup hangout via the link in the team slack'
|
827
824
|
}
|
828
825
|
]
|
829
826
|
},
|
@@ -836,19 +833,19 @@ examples:
|
|
836
833
|
style: 'required',
|
837
834
|
contents: [
|
838
835
|
{
|
839
|
-
href: '',
|
836
|
+
href: 'http://www.google.com',
|
840
837
|
text: 'Click the three dots in the bottom hand corner to open settings'
|
841
838
|
},
|
842
839
|
{
|
843
|
-
href: '',
|
840
|
+
href: 'http://www.google.com',
|
844
841
|
text: 'Set speaker to "Jabra"'
|
845
842
|
},
|
846
843
|
{
|
847
|
-
href: '',
|
844
|
+
href: 'http://www.google.com',
|
848
845
|
text: 'Set microphone to "C Media USB"'
|
849
846
|
},
|
850
847
|
{
|
851
|
-
href: '',
|
848
|
+
href: 'http://www.google.com',
|
852
849
|
text: 'Click "present to meeting"'
|
853
850
|
},
|
854
851
|
]
|
@@ -887,12 +884,13 @@ examples:
|
|
887
884
|
description: Designed to fit in the sidebar of a page. Note that the small version of the task list should not become smaller on mobile, and the large version on mobile should be the same size as the small version. This example is a copy of the one above for comparison.
|
888
885
|
data:
|
889
886
|
small: true
|
887
|
+
remember_last_step: true
|
890
888
|
task_list_url: "/learn-to-setup-standup"
|
891
889
|
highlight_group: 2
|
892
890
|
groups: [
|
893
891
|
[
|
894
892
|
{
|
895
|
-
title: 'Get the TV ready
|
893
|
+
title: 'Get the TV ready (small)',
|
896
894
|
contents: [
|
897
895
|
{
|
898
896
|
type: 'paragraph',
|
@@ -904,15 +902,14 @@ examples:
|
|
904
902
|
contents: [
|
905
903
|
{
|
906
904
|
href: 'https://en.wikipedia.org/wiki/HDMI',
|
907
|
-
text: 'Remove the Chromebit from HDMI 1 on the TV'
|
908
|
-
active: true
|
905
|
+
text: 'Remove the Chromebit from HDMI 1 on the TV'
|
909
906
|
}
|
910
907
|
]
|
911
908
|
}
|
912
909
|
]
|
913
910
|
},
|
914
911
|
{
|
915
|
-
title: 'Plug everything in
|
912
|
+
title: 'Plug everything in (small)',
|
916
913
|
contents: [
|
917
914
|
{
|
918
915
|
type: 'paragraph',
|
@@ -937,7 +934,7 @@ examples:
|
|
937
934
|
],
|
938
935
|
[
|
939
936
|
{
|
940
|
-
title: 'Configure the catchbox
|
937
|
+
title: 'Configure the catchbox (small)',
|
941
938
|
contents: [
|
942
939
|
{
|
943
940
|
type: 'paragraph',
|
@@ -948,28 +945,28 @@ examples:
|
|
948
945
|
style: 'required',
|
949
946
|
contents: [
|
950
947
|
{
|
951
|
-
href: '',
|
952
|
-
text: 'Ensure the catchbox transmitter is plugged in at the mains wall'
|
953
|
-
active: true
|
948
|
+
href: 'http://www.google.com',
|
949
|
+
text: 'Ensure the catchbox transmitter is plugged in at the mains wall'
|
954
950
|
},
|
955
951
|
{
|
956
|
-
href: '',
|
952
|
+
href: 'http://www.google.com',
|
957
953
|
text: 'Turn on the transmitter and wait for the switch to blink green'
|
958
954
|
},
|
959
955
|
{
|
960
|
-
href: '',
|
961
|
-
text: 'Plug the transmitter USB cable into the facilitators laptop'
|
956
|
+
href: 'http://www.google.com',
|
957
|
+
text: 'Plug the transmitter USB cable into the facilitators laptop',
|
958
|
+
active: true
|
962
959
|
},
|
963
960
|
{
|
964
|
-
href: '',
|
961
|
+
href: 'http://www.google.com',
|
965
962
|
text: 'Twist and pull the black piece of foam out of the catchbox'
|
966
963
|
},
|
967
964
|
{
|
968
|
-
href: '',
|
965
|
+
href: 'http://www.google.com',
|
969
966
|
text: 'Turn on the catchbox and wait for the LED to turn green'
|
970
967
|
},
|
971
968
|
{
|
972
|
-
href: '',
|
969
|
+
href: 'http://www.google.com',
|
973
970
|
text: 'Wait for the transmitter light to turn solid green'
|
974
971
|
}
|
975
972
|
]
|
@@ -995,7 +992,7 @@ examples:
|
|
995
992
|
text: "Get annoyed when it doesn't work"
|
996
993
|
},
|
997
994
|
{
|
998
|
-
href: '',
|
995
|
+
href: 'http://www.google.com',
|
999
996
|
text: 'Try to find someone else who knows how to do it',
|
1000
997
|
context: '1 to 10 minutes'
|
1001
998
|
}
|
@@ -1006,7 +1003,7 @@ examples:
|
|
1006
1003
|
],
|
1007
1004
|
[
|
1008
1005
|
{
|
1009
|
-
title: 'Join and configure the standup
|
1006
|
+
title: 'Join and configure the standup (small)',
|
1010
1007
|
show_help_link: true,
|
1011
1008
|
contents: [
|
1012
1009
|
{
|
@@ -1018,17 +1015,15 @@ examples:
|
|
1018
1015
|
style: 'required',
|
1019
1016
|
contents: [
|
1020
1017
|
{
|
1021
|
-
href: '',
|
1022
|
-
text: 'Connect to standup hangout via the calendar invite'
|
1023
|
-
active: true
|
1018
|
+
href: 'http://www.google.com',
|
1019
|
+
text: 'Connect to standup hangout via the calendar invite'
|
1024
1020
|
},
|
1025
1021
|
{
|
1026
1022
|
text: 'or'
|
1027
1023
|
},
|
1028
1024
|
{
|
1029
|
-
href: '',
|
1030
|
-
text: 'Connect to standup hangout via the link in the team slack'
|
1031
|
-
active: true
|
1025
|
+
href: 'http://www.google.com',
|
1026
|
+
text: 'Connect to standup hangout via the link in the team slack'
|
1032
1027
|
}
|
1033
1028
|
]
|
1034
1029
|
},
|
@@ -1041,19 +1036,19 @@ examples:
|
|
1041
1036
|
style: 'required',
|
1042
1037
|
contents: [
|
1043
1038
|
{
|
1044
|
-
href: '',
|
1039
|
+
href: 'http://www.google.com',
|
1045
1040
|
text: 'Click the three dots in the bottom hand corner to open settings'
|
1046
1041
|
},
|
1047
1042
|
{
|
1048
|
-
href: '',
|
1043
|
+
href: 'http://www.google.com',
|
1049
1044
|
text: 'Set speaker to "Jabra"'
|
1050
1045
|
},
|
1051
1046
|
{
|
1052
|
-
href: '',
|
1047
|
+
href: 'http://www.google.com',
|
1053
1048
|
text: 'Set microphone to "C Media USB"'
|
1054
1049
|
},
|
1055
1050
|
{
|
1056
|
-
href: '',
|
1051
|
+
href: 'http://www.google.com',
|
1057
1052
|
text: 'Click "present to meeting"'
|
1058
1053
|
},
|
1059
1054
|
]
|
@@ -1063,7 +1058,7 @@ examples:
|
|
1063
1058
|
],
|
1064
1059
|
[
|
1065
1060
|
{
|
1066
|
-
title: 'Clear up
|
1061
|
+
title: 'Clear up (small)',
|
1067
1062
|
contents: [
|
1068
1063
|
{
|
1069
1064
|
type: 'paragraph',
|
@@ -1076,7 +1071,7 @@ examples:
|
|
1076
1071
|
]
|
1077
1072
|
},
|
1078
1073
|
{
|
1079
|
-
title: 'Get someone else to clear up
|
1074
|
+
title: 'Get someone else to clear up (small)',
|
1080
1075
|
logic: 'or',
|
1081
1076
|
optional: true,
|
1082
1077
|
contents: [
|
@@ -10,8 +10,8 @@
|
|
10
10
|
<% end %>
|
11
11
|
<%= yield :title %><% if content_for(:title) %> - <% end %><%= GovukPublishingComponents::Config.component_guide_title %>
|
12
12
|
</title>
|
13
|
-
<%= stylesheet_link_tag "govuk_publishing_components/
|
14
|
-
<%= stylesheet_link_tag "govuk_publishing_components/
|
13
|
+
<%= stylesheet_link_tag "govuk_publishing_components/component_guide", media: "screen" %>
|
14
|
+
<%= stylesheet_link_tag "govuk_publishing_components/component_guide_print", media: "print" %>
|
15
15
|
<%= stylesheet_link_tag "#{GovukPublishingComponents::Config.application_stylesheet}" %>
|
16
16
|
<%= javascript_include_tag "govuk_publishing_components/application" %>
|
17
17
|
<%= javascript_include_tag "#{GovukPublishingComponents::Config.application_javascript}" %>
|
@@ -1 +1 @@
|
|
1
|
-
Rails.application.config.assets.precompile += %w( govuk_publishing_components/
|
1
|
+
Rails.application.config.assets.precompile += %w(govuk_publishing_components/component_guide.css govuk_publishing_components/component_guide_print.css)
|
@@ -0,0 +1,111 @@
|
|
1
|
+
class TaskListHelper
|
2
|
+
include ActionView::Helpers
|
3
|
+
include ActionView::Context
|
4
|
+
|
5
|
+
def render_task_list_element(element, options)
|
6
|
+
@options = options
|
7
|
+
@link_index = options[:link_index]
|
8
|
+
|
9
|
+
case element[:type]
|
10
|
+
when "paragraph"
|
11
|
+
paragraph(element[:text])
|
12
|
+
when "heading"
|
13
|
+
heading(element[:text])
|
14
|
+
when "list"
|
15
|
+
list(element)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# id should be lowercase, contain only numbers and letters and replace spaces with dashes
|
20
|
+
def generate_task_list_id(step_title)
|
21
|
+
step_title.downcase.tr(" ", "-").gsub(/[^a-z0-9\-\s]/i, '')
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def paragraph(text)
|
27
|
+
content_tag(
|
28
|
+
:p,
|
29
|
+
text,
|
30
|
+
class: "gem-c-task-list__paragraph"
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def heading(text)
|
35
|
+
content_tag(
|
36
|
+
"h#{@options[:heading_level] + 1}",
|
37
|
+
text,
|
38
|
+
class: "gem-c-task-list__heading"
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def list(element)
|
43
|
+
content_tag(
|
44
|
+
get_list_element(element[:style]),
|
45
|
+
class: "gem-c-task-list__links #{get_list_style(element[:style])}",
|
46
|
+
data: {
|
47
|
+
length: element[:contents].length
|
48
|
+
}
|
49
|
+
) do
|
50
|
+
element[:contents].collect { |contents|
|
51
|
+
concat(
|
52
|
+
content_tag(
|
53
|
+
:li,
|
54
|
+
class: "gem-c-task-list__link js-list-item #{link_active(contents[:active])}"
|
55
|
+
) do
|
56
|
+
create_list_item_content(contents)
|
57
|
+
end
|
58
|
+
)
|
59
|
+
}
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def create_list_item_content(link)
|
64
|
+
if link[:href]
|
65
|
+
@link_index += 1
|
66
|
+
href = link_href(link[:active], link[:href])
|
67
|
+
text = "#{link_text(link[:active], link[:text])} #{create_context(link[:context])}".html_safe
|
68
|
+
|
69
|
+
link_to(
|
70
|
+
href,
|
71
|
+
rel: ("external" if href.start_with?('http')),
|
72
|
+
data: {
|
73
|
+
position: "#{@options[:group_index] + 1}.#{@options[:step_index] + 1}.#{@link_index}"
|
74
|
+
},
|
75
|
+
class: "gem-c-task-list__link-item js-link"
|
76
|
+
) do
|
77
|
+
text
|
78
|
+
end
|
79
|
+
else
|
80
|
+
link[:text]
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def create_context(context)
|
85
|
+
content_tag(:span, context, class: "gem-c-task-list__context") if context
|
86
|
+
end
|
87
|
+
|
88
|
+
def get_list_style(style)
|
89
|
+
if style == "required"
|
90
|
+
"gem-c-task-list__links--required"
|
91
|
+
elsif style == "choice"
|
92
|
+
"gem-c-task-list__links--choice"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def get_list_element(style)
|
97
|
+
style == "choice" ? "ul" : "ol"
|
98
|
+
end
|
99
|
+
|
100
|
+
def link_href(active, href)
|
101
|
+
active ? "#content" : href
|
102
|
+
end
|
103
|
+
|
104
|
+
def link_text(active, text)
|
105
|
+
active ? content_tag(:span, "You are currently viewing: ", class: "visuallyhidden") + text : text
|
106
|
+
end
|
107
|
+
|
108
|
+
def link_active(active)
|
109
|
+
"gem-c-task-list__link--active" if active
|
110
|
+
end
|
111
|
+
end
|
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: 4.1.
|
4
|
+
version: 4.1.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: 2018-
|
11
|
+
date: 2018-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: govuk-lint
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -241,10 +255,14 @@ files:
|
|
241
255
|
- app/assets/javascripts/govuk_publishing_components/vendor/matches-polyfill.min.js
|
242
256
|
- app/assets/javascripts/govuk_publishing_components/visual-regression.js
|
243
257
|
- app/assets/javascripts/history-support.js
|
244
|
-
- app/assets/stylesheets/govuk_publishing_components/
|
258
|
+
- app/assets/stylesheets/govuk_publishing_components/_all_components.scss
|
259
|
+
- app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss
|
260
|
+
- app/assets/stylesheets/govuk_publishing_components/component_guide.scss
|
261
|
+
- app/assets/stylesheets/govuk_publishing_components/component_guide_print.scss
|
245
262
|
- app/assets/stylesheets/govuk_publishing_components/components/_back-link.scss
|
246
263
|
- app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss
|
247
264
|
- app/assets/stylesheets/govuk_publishing_components/components/_fieldset.scss
|
265
|
+
- app/assets/stylesheets/govuk_publishing_components/components/_input.scss
|
248
266
|
- app/assets/stylesheets/govuk_publishing_components/components/_label.scss
|
249
267
|
- app/assets/stylesheets/govuk_publishing_components/components/_radio.scss
|
250
268
|
- app/assets/stylesheets/govuk_publishing_components/components/_task-list-header.scss
|
@@ -255,7 +273,6 @@ files:
|
|
255
273
|
- app/assets/stylesheets/govuk_publishing_components/components/helpers/_variables.scss
|
256
274
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_task-list-header.scss
|
257
275
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_task-list.scss
|
258
|
-
- app/assets/stylesheets/govuk_publishing_components/print.scss
|
259
276
|
- app/controllers/govuk_publishing_components/application_controller.rb
|
260
277
|
- app/controllers/govuk_publishing_components/component_guide_controller.rb
|
261
278
|
- app/helpers/govuk_publishing_components/application_helper.rb
|
@@ -273,6 +290,7 @@ files:
|
|
273
290
|
- app/views/govuk_publishing_components/components/_back_link.html.erb
|
274
291
|
- app/views/govuk_publishing_components/components/_error_summary.html.erb
|
275
292
|
- app/views/govuk_publishing_components/components/_fieldset.html.erb
|
293
|
+
- app/views/govuk_publishing_components/components/_input.html.erb
|
276
294
|
- app/views/govuk_publishing_components/components/_label.html.erb
|
277
295
|
- app/views/govuk_publishing_components/components/_radio.html.erb
|
278
296
|
- app/views/govuk_publishing_components/components/_task_list.html.erb
|
@@ -281,6 +299,7 @@ files:
|
|
281
299
|
- app/views/govuk_publishing_components/components/docs/back_link.yml
|
282
300
|
- app/views/govuk_publishing_components/components/docs/error_summary.yml
|
283
301
|
- app/views/govuk_publishing_components/components/docs/fieldset.yml
|
302
|
+
- app/views/govuk_publishing_components/components/docs/input.yml
|
284
303
|
- app/views/govuk_publishing_components/components/docs/label.yml
|
285
304
|
- app/views/govuk_publishing_components/components/docs/radio.yml
|
286
305
|
- app/views/govuk_publishing_components/components/docs/task_list.yml
|
@@ -297,6 +316,7 @@ files:
|
|
297
316
|
- lib/generators/govuk_publishing_components/templates/_component.scss
|
298
317
|
- lib/generators/govuk_publishing_components/templates/component.yml.erb
|
299
318
|
- lib/govuk_publishing_components.rb
|
319
|
+
- lib/govuk_publishing_components/components/task_list_helper.rb
|
300
320
|
- lib/govuk_publishing_components/config.rb
|
301
321
|
- lib/govuk_publishing_components/engine.rb
|
302
322
|
- lib/govuk_publishing_components/minitest/component_guide_test.rb
|
@@ -322,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
322
342
|
version: '0'
|
323
343
|
requirements: []
|
324
344
|
rubyforge_project:
|
325
|
-
rubygems_version: 2.
|
345
|
+
rubygems_version: 2.7.3
|
326
346
|
signing_key:
|
327
347
|
specification_version: 4
|
328
348
|
summary: A gem to document components in GOV.UK frontend applications
|