govuk_publishing_components 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/Rakefile +1 -9
  4. data/app/assets/javascripts/components/task-list.js +471 -0
  5. data/app/assets/javascripts/current-location.js +10 -0
  6. data/app/assets/javascripts/govuk_publishing_components/application.js +4 -0
  7. data/app/assets/javascripts/history-support.js +8 -0
  8. data/app/assets/stylesheets/components/_task-list-header-print.scss +15 -0
  9. data/app/assets/stylesheets/components/_task-list-header.scss +36 -0
  10. data/app/assets/stylesheets/components/_task-list-print.scss +35 -0
  11. data/app/assets/stylesheets/components/_task-list-related.scss +39 -0
  12. data/app/assets/stylesheets/components/_task-list.scss +454 -0
  13. data/app/assets/stylesheets/govuk_publishing_components/application.scss +3 -0
  14. data/app/assets/stylesheets/govuk_publishing_components/print.scss +4 -0
  15. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +5 -0
  16. data/app/models/govuk_publishing_components/component_doc.rb +10 -3
  17. data/app/models/govuk_publishing_components/component_doc_resolver.rb +19 -5
  18. data/app/views/components/_task_list.html.erb +143 -0
  19. data/app/views/components/_task_list_header.html.erb +38 -0
  20. data/app/views/components/_task_list_related.html.erb +39 -0
  21. data/app/views/components/docs/task_list.yml +1032 -0
  22. data/app/views/components/docs/task_list_header.yml +33 -0
  23. data/app/views/components/docs/task_list_related.yml +54 -0
  24. data/app/views/govuk_publishing_components/component_guide/index.html.erb +14 -3
  25. data/app/views/govuk_publishing_components/component_guide/show.html.erb +1 -1
  26. data/app/views/layouts/govuk_publishing_components/application.html.erb +1 -4
  27. data/config/initializers/assets.rb +1 -0
  28. data/lib/govuk_publishing_components/config.rb +5 -1
  29. data/lib/govuk_publishing_components/version.rb +1 -1
  30. metadata +33 -3
@@ -0,0 +1,33 @@
1
+ name: Task list header
2
+ description: Shows that a content page is part of a task list.
3
+ body: |
4
+ The component indicates to the user that the current page is part of a [task list](/component-guide/task_list), and can provide a link to that task list.
5
+ accessibility_criteria: |
6
+ The component is designed to go into the top of an existing content page and should not interfere with the heading structure of the page, so therefore should not contain a heading tag.
7
+
8
+ The component must:
9
+
10
+ - provide a skip link to the task list on the page, if that task list is present
11
+ shared_accessibility_criteria:
12
+ - link
13
+ examples:
14
+ default:
15
+ data:
16
+ title: 'Learn to drive a car: step by step'
17
+ with_a_link:
18
+ data:
19
+ title: 'Having children: step by step'
20
+ path: /childcare-parenting/pregnancy-and-birth
21
+ with_a_skip_link:
22
+ description: This option allows the insertion of a skip link to a task list elsewhere on the page. This aids navigation when using a keyboard or screen reader. The skip link is visually hidden until it receives focus.
23
+ data:
24
+ title: 'Separating from a spouse or civil partner: step by step'
25
+ path: /divorce
26
+ skip_link: '#task-list-wrapper'
27
+ with_a_skip_link_with_custom_text:
28
+ description: It's hard to think of good text to put in a skip link, so this option lets you customise it.
29
+ data:
30
+ title: 'Buying and renting a property: step by step'
31
+ path: /buy-sell-your-home
32
+ skip_link: '#task-list-steps'
33
+ skip_link_text: Skip to steps
@@ -0,0 +1,54 @@
1
+ name: Task list related links
2
+ description: Links to task lists that a page is part of
3
+ body: |
4
+ The component is designed to go on a content page to accompany a small task list in a sidebar. It provides links to the main task list page.
5
+
6
+ The component has two uses:
7
+
8
+ - above the task list, it provides a link to the main task list page
9
+ - below the task list, it shows and links to any other task lists that this page belongs to
10
+
11
+ In the first use case, only one link should be present and the entire text of the component should be contained in a heading. In the second use case, if more than one link is provided, the links should be shown in a list, separate from the heading.
12
+ accessibility_criteria: |
13
+ The component must:
14
+
15
+ - display a single link as part of a heading
16
+ - display multiple links outside of a heading in a separate list
17
+ shared_accessibility_criteria:
18
+ - link
19
+ examples:
20
+ default:
21
+ data:
22
+ links: [
23
+ {
24
+ href: '/learn-to-drive-a-car',
25
+ text: 'Learn to drive a car: step by step'
26
+ }
27
+ ]
28
+ with_more_than_one_link:
29
+ description: If more than one link is passed to the component it should output them as a list outside of the heading.
30
+ data:
31
+ links: [
32
+ {
33
+ href: '/learn-to-drive-a-car',
34
+ text: 'Learn to drive a car: step by step'
35
+ },
36
+ {
37
+ href: '/learn-to-drive-a-motorbike',
38
+ text: 'Learn to drive a motorbike: step by step'
39
+ }
40
+ ]
41
+ with_a_different_title:
42
+ description: The default title 'Part of' can be replaced if required.
43
+ data:
44
+ pretitle: 'Also part of'
45
+ links: [
46
+ {
47
+ href: '/learn-to-drive-a-car',
48
+ text: 'Learn to drive a car: step by step'
49
+ },
50
+ {
51
+ href: '/learn-to-drive-a-motorbike',
52
+ text: 'Learn to drive a motorbike: step by step'
53
+ }
54
+ ]
@@ -15,9 +15,20 @@
15
15
  <ul class="component-list">
16
16
  <% @component_docs.each do |component_doc| %>
17
17
  <li>
18
- <h2>
19
- <%= link_to component_doc.name, component_doc_path(component_doc.id) %>
20
- </h2>
18
+ <%= link_to component_doc.name, component_doc_path(component_doc.id) %>
19
+ <p>
20
+ <%= component_doc.description %>
21
+ </p>
22
+ </li>
23
+ <% end %>
24
+ </ul>
25
+
26
+ <h2 class="component-doc-h2">Components in the gem</h2>
27
+
28
+ <ul class="component-list">
29
+ <% @gem_component_docs.each do |component_doc| %>
30
+ <li>
31
+ <%= link_to component_doc.name, component_doc_path(component_doc.id) %>
21
32
  <p>
22
33
  <%= component_doc.description %>
23
34
  </p>
@@ -1,5 +1,5 @@
1
1
  <% content_for :title, "#{@component_doc.name} component" %>
2
- <%= render 'govuk_component/title', title: @component_doc.name, context: 'Component' %>
2
+ <%= render 'govuk_component/title', title: @component_doc.name, context: "Component" %>
3
3
 
4
4
  <div class="component-show">
5
5
  <div class="grid-row">
@@ -11,11 +11,8 @@
11
11
  <%= yield :title %><% if content_for(:title) %> - <% end %><%= GovukPublishingComponents::Config.component_guide_title %>
12
12
  </title>
13
13
  <%= stylesheet_link_tag "govuk_publishing_components/application", media: "all" %>
14
+ <%= stylesheet_link_tag "govuk_publishing_components/print", media: "print" %>
14
15
  <%= stylesheet_link_tag "#{GovukPublishingComponents::Config.application_stylesheet}" %>
15
- <% if GovukPublishingComponents::Config.application_print_stylesheet %>
16
- <%= stylesheet_link_tag "#{GovukPublishingComponents::Config.application_print_stylesheet}", media: "print" %>
17
- <% end %>
18
-
19
16
  <%= javascript_include_tag "govuk_publishing_components/application" %>
20
17
  <%= javascript_include_tag "#{GovukPublishingComponents::Config.application_javascript}" %>
21
18
  <%= csrf_meta_tags %>
@@ -0,0 +1 @@
1
+ Rails.application.config.assets.precompile += %w( govuk_publishing_components/print.css )
@@ -14,7 +14,7 @@ module GovukPublishingComponents
14
14
  self.application_stylesheet = "application"
15
15
 
16
16
  mattr_accessor :application_print_stylesheet
17
- self.application_print_stylesheet = nil
17
+ self.application_print_stylesheet = "print"
18
18
 
19
19
  mattr_accessor :application_javascript
20
20
  self.application_javascript = "application"
@@ -25,5 +25,9 @@ module GovukPublishingComponents
25
25
  def self.component_directory_name
26
26
  static ? STATIC_COMPONENT_DIRECTORY : APP_COMPONENT_DIRECTORY
27
27
  end
28
+
29
+ def self.gem_directory
30
+ Gem::Specification.find_by_name("govuk_publishing_components").gem_dir
31
+ end
28
32
  end
29
33
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '3.0.0'.freeze
3
3
  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: 2.0.0
4
+ version: 3.0.0
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: 2017-11-30 00:00:00.000000000 Z
11
+ date: 2017-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '3.3'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rspec
112
+ name: rspec-rails
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
@@ -178,6 +178,20 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: 1.3.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: govuk-content-schema-test-helpers
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '1.5'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '1.5'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: webmock
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -204,12 +218,21 @@ files:
204
218
  - README.md
205
219
  - Rakefile
206
220
  - app/assets/config/govuk_publishing_components_manifest.js
221
+ - app/assets/javascripts/components/task-list.js
222
+ - app/assets/javascripts/current-location.js
207
223
  - app/assets/javascripts/govuk_publishing_components/accessibility-test.js
208
224
  - app/assets/javascripts/govuk_publishing_components/application.js
209
225
  - app/assets/javascripts/govuk_publishing_components/vendor/axe.min.js
210
226
  - app/assets/javascripts/govuk_publishing_components/vendor/matches-polyfill.min.js
211
227
  - app/assets/javascripts/govuk_publishing_components/visual-regression.js
228
+ - app/assets/javascripts/history-support.js
229
+ - app/assets/stylesheets/components/_task-list-header-print.scss
230
+ - app/assets/stylesheets/components/_task-list-header.scss
231
+ - app/assets/stylesheets/components/_task-list-print.scss
232
+ - app/assets/stylesheets/components/_task-list-related.scss
233
+ - app/assets/stylesheets/components/_task-list.scss
212
234
  - app/assets/stylesheets/govuk_publishing_components/application.scss
235
+ - app/assets/stylesheets/govuk_publishing_components/print.scss
213
236
  - app/controllers/govuk_publishing_components/application_controller.rb
214
237
  - app/controllers/govuk_publishing_components/component_guide_controller.rb
215
238
  - app/helpers/govuk_publishing_components/application_helper.rb
@@ -217,6 +240,12 @@ files:
217
240
  - app/models/govuk_publishing_components/component_doc_resolver.rb
218
241
  - app/models/govuk_publishing_components/component_example.rb
219
242
  - app/models/govuk_publishing_components/shared_accessibility_criteria.rb
243
+ - app/views/components/_task_list.html.erb
244
+ - app/views/components/_task_list_header.html.erb
245
+ - app/views/components/_task_list_related.html.erb
246
+ - app/views/components/docs/task_list.yml
247
+ - app/views/components/docs/task_list_header.yml
248
+ - app/views/components/docs/task_list_related.yml
220
249
  - app/views/govuk_publishing_components/component_guide/component_doc/_call.html.erb
221
250
  - app/views/govuk_publishing_components/component_guide/component_doc/_component.html.erb
222
251
  - app/views/govuk_publishing_components/component_guide/component_doc/_preview.html.erb
@@ -225,6 +254,7 @@ files:
225
254
  - app/views/govuk_publishing_components/component_guide/preview.html.erb
226
255
  - app/views/govuk_publishing_components/component_guide/show.html.erb
227
256
  - app/views/layouts/govuk_publishing_components/application.html.erb
257
+ - config/initializers/assets.rb
228
258
  - config/routes.rb
229
259
  - lib/generators/govuk_publishing_components/USAGE
230
260
  - lib/generators/govuk_publishing_components/component_generator.rb