govuk_tech_docs 2.1.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of govuk_tech_docs might be problematic. Click here for more details.

Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.github/pull_request_template.md +1 -0
  3. data/.nvmrc +1 -1
  4. data/.ruby-version +1 -1
  5. data/.travis.yml +5 -0
  6. data/CHANGELOG.md +41 -2
  7. data/README.md +15 -22
  8. data/example/.ruby-version +1 -1
  9. data/govuk_tech_docs.gemspec +2 -7
  10. data/lib/assets/javascripts/_modules/search.js +13 -2
  11. data/lib/assets/javascripts/_modules/table-of-contents.js +9 -14
  12. data/lib/assets/stylesheets/_govuk_tech_docs.scss +9 -10
  13. data/lib/assets/stylesheets/modules/_page-review.scss +3 -5
  14. data/lib/assets/stylesheets/modules/_search.scss +50 -24
  15. data/lib/assets/stylesheets/modules/_technical-documentation.scss +11 -2
  16. data/lib/assets/stylesheets/modules/_toc.scss +23 -13
  17. data/lib/govuk_tech_docs/api_reference/api_reference_extension.rb +0 -1
  18. data/lib/govuk_tech_docs/api_reference/api_reference_renderer.rb +70 -186
  19. data/lib/govuk_tech_docs/api_reference/templates/api_reference_full.html.erb +3 -2
  20. data/lib/govuk_tech_docs/api_reference/templates/operation.html.erb +1 -1
  21. data/lib/govuk_tech_docs/api_reference/templates/parameters.html.erb +1 -1
  22. data/lib/govuk_tech_docs/api_reference/templates/responses.html.erb +1 -1
  23. data/lib/govuk_tech_docs/api_reference/templates/schema.html.erb +12 -12
  24. data/lib/govuk_tech_docs/tech_docs_html_renderer.rb +75 -1
  25. data/lib/govuk_tech_docs/version.rb +1 -1
  26. data/lib/source/images/search-button.png +0 -0
  27. data/lib/source/layouts/_search.erb +10 -4
  28. data/lib/source/layouts/core.erb +4 -4
  29. data/package-lock.json +358 -288
  30. data/package.json +2 -2
  31. metadata +48 -65
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6eb13261f7f9ed89665a78f4a39b41936486bbbb945de36818908d703f078cd
4
- data.tar.gz: b968b91fe10b4075ed1544d7a98e8f4257401464f138c790ee1290d597a1e018
3
+ metadata.gz: a16d9b95456a7ddffdb052922793613e157fa866e7a2e69a7d42b83b858e141f
4
+ data.tar.gz: 34f980b0d8a4caf7cc28dd15f103f92cc456f9cd41d6a4b478881eb19b6d4266
5
5
  SHA512:
6
- metadata.gz: cdbe93545cd55d9b8ae9d9d2490c08e9e55bccceb5653b9d5ab680ce141b3238391d12949b50df6b52821847e8902891f6d1c5ed76417b7f6dbe035735b92702
7
- data.tar.gz: 1becd936b596332a278fd5895f6f37ad67356b862bdb33bd5df6d1aa49f441bdfd2a2b94cd9f4bb75d15fbc54c94568a0be12629ecefbd1809ed7013aef67c81
6
+ metadata.gz: 381565277ad19f4dc82047604b54a26430107b81eeee02550c212d361883cf380c05114ffef36865b1ff3892a254555b9547876f261dcab71ef15d37364962aa
7
+ data.tar.gz: 1d1812a952608da41e1af4f52a8d9d22d8e99fb55e507f1056b1e5d19c025141b1fa4e20aba2659c4c48728f4de5c35561cff0f099a7556fd6e547d462d78d6a
@@ -0,0 +1 @@
1
+ ⚠️ Don't forget to update the gem version in the [CHANGELOG](https://github.com/alphagov/tech-docs-gem/blob/master/CHANGELOG.md) before merging! When you're ready to release bump [version file](https://github.com/alphagov/tech-docs-gem/blob/master/lib/govuk_tech_docs/version.rb) and generate a tag. ⚠️
data/.nvmrc CHANGED
@@ -1 +1 @@
1
- 10.16.0
1
+ 10
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.3
1
+ 2.7.2
data/.travis.yml CHANGED
@@ -1,5 +1,10 @@
1
1
  language: ruby
2
+ cache:
3
+ bundler: true
4
+ npm: true
2
5
  before_install:
6
+ - nvm install
7
+ - nvm use
3
8
  - gem update --system
4
9
  - gem install bundler
5
10
  before_script:
data/CHANGELOG.md CHANGED
@@ -1,6 +1,46 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 2.3.0
4
+
5
+ - [#232: Update GOV.UK Frontend and use new link styles](https://github.com/alphagov/tech-docs-gem/pull/232)
6
+
7
+ ## 2.2.2
8
+
9
+ - [#223: Remove unnecessary CSS class on the search submit button](https://github.com/alphagov/tech-docs-gem/pull/223)
10
+ - [#224: Accessibility fix: Hide the 'table of contents close' button when search results are open](https://github.com/alphagov/tech-docs-gem/pull/224)
11
+
12
+ ## 2.2.1
13
+
14
+ - [#218: Remove unnecessary explicit dependencies: sprockets, activesupport, sass and pry](https://github.com/alphagov/tech-docs-gem/pull/218)
15
+ - [#125: Fix API docs showing required properties as optional](https://github.com/alphagov/tech-docs-gem/pull/125)
16
+
17
+ ## 2.2.0
18
+
19
+ ### Accessibility Fixes
20
+
21
+ - [#205: Improve table of contents accessibility](https://github.com/alphagov/tech-docs-gem/pull/205)
22
+ - [#209: Some search and keyboard navigation updates](https://github.com/alphagov/tech-docs-gem/pull/209)
23
+ - [#210: Stop linking images to new tabs](https://github.com/alphagov/tech-docs-gem/pull/210)
24
+ - [#214: Implement row level table headings to allow accessible tables with row headings](https://github.com/alphagov/tech-docs-gem/pull/214)
25
+ - [#215: Add tabindex and focus states to code blocks](https://github.com/alphagov/tech-docs-gem/pull/215)
26
+
27
+ ### Docs
28
+
29
+ - [#206: Remove tdt docs content from readme file](https://github.com/alphagov/tech-docs-gem/pull/206)
30
+
31
+ ## 2.1.1
32
+
33
+ ### Fixes
34
+
35
+ We’ve made fixes in the following pull requests:
36
+
37
+ - [#199: Fix page expiry box link colours (hover and focus) ](https://github.com/alphagov/tech-docs-gem/pull/199)
38
+
39
+ ### Ruby version bump
40
+
41
+ We've updated the Ruby version supported:
42
+
43
+ - [#201: Bump ruby to 2.7.2](https://github.com/alphagov/tech-docs-gem/pull/201)
4
44
 
5
45
  ## 2.1.0
6
46
 
@@ -74,7 +114,6 @@ You can look at the [2.0.6 milestone](https://github.com/alphagov/tech-docs-gem/
74
114
 
75
115
  ## 2.0.5
76
116
 
77
-
78
117
  Adds [new global configuration option](https://github.com/alphagov/tech-docs-gem/pull/122) that controls whether review banners appear or not at the bottom of pages when expiry dates are set in the frontmatter.
79
118
 
80
119
  [Fixes the hard-coded service link](https://github.com/alphagov/tech-docs-gem/pull/119) in the header.
data/README.md CHANGED
@@ -3,23 +3,19 @@
3
3
  This repo contains the Ruby gem that distributes the [Tech Docs Template][tdt-template]. The Tech Docs Template is a [middleman template][mmt] that
4
4
  you can use to build technical documentation using a GOV.UK style.
5
5
 
6
- 👉 Find out more about the template and its features from the [Tech Docs Template documentation][tdt-docs].
7
-
8
- ## Usage
9
-
10
- 👉 Find out how to [generate a new website with the Tech Docs Template][tdt-readme].
6
+ To find out more about setting up and managing content for a website using this template, see the [Tech Docs Template documentation][tdt-docs].
11
7
 
12
8
  ## Contributing
13
9
 
14
10
  Everybody who uses this project is encouraged to contribute.
15
11
 
16
- 👉 [See CONTRIBUTING.md](CONTRIBUTING.md) for guidance on making changes.
12
+ You can find out more about contributing to this project from the[CONTRIBUTING.md file](CONTRIBUTING.md).
17
13
 
18
14
  ## GOV.UK frontend
19
15
 
20
16
  This gem uses [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend), part of the [GOV.UK Design System](https://design-system.service.gov.uk/).
21
17
 
22
- We use `npm` to download the govuk-frontend package. To update to a new version, change the version in [package.json](blob/master/package.json) and run `npm update`.
18
+ We use `npm` to download the govuk-frontend package. To update to a new version, change the version in the [package.json file](blob/master/package.json) and run `npm update`.
23
19
 
24
20
  ## Developing locally
25
21
 
@@ -30,19 +26,13 @@ There are 2 ways to develop with this gem. You can see your changes on either:
30
26
 
31
27
  ### Use your own Tech Docs Template website
32
28
 
33
- If you want to see how your changes to the gem affect your website, you have to point your site's Gemfile to your local checkout:
29
+ To see how your changes to the gem affect your website, point your website's Gemfile to your local checkout:
34
30
 
35
31
  ```rb
36
32
  gem 'govuk_tech_docs', path: '../tech-docs-gem'
37
33
  ```
38
34
 
39
- To view your changes locally run:
40
-
41
- ```sh
42
- bundle exec middleman server
43
- ```
44
-
45
- See your website on `http://localhost:4567` in your browser.
35
+ To preview your documentation changes locally, see the [Tech Docs Template documentation on previewing your documentation](https://tdt-documentation.london.cloudapps.digital/create_project/preview/#preview-your-documentation).
46
36
 
47
37
  ### Use the example in this repo
48
38
 
@@ -56,14 +46,16 @@ bundle exec middleman server
56
46
 
57
47
  See your website on `http://localhost:4567` in your browser.
58
48
 
49
+ For more information on previewing your documentation locally, see the [Tech Docs template documentation on previewing your documentation](https://tdt-documentation.london.cloudapps.digital/create_project/preview/#preview-your-documentation).
50
+
59
51
  ## Tests
60
52
 
61
- The repository contains automated JavaScript tests that use [Jasmine][jas] test framework.
53
+ This repository contains automated JavaScript tests that use the [Jasmine test framework][jas].
62
54
 
63
- To run the tests and see the results in your browser:
55
+ You can run these tests and see the results in your browser.
64
56
 
65
- 1. Run `bundle exec rake jasmine`
66
- 2. Go to `http://localhost:8888` in your browser
57
+ 1. Run `bundle exec rake jasmine`.
58
+ 2. Go to `http://localhost:8888` in your browser.
67
59
 
68
60
  To run the tests and see the results in your terminal, run:
69
61
 
@@ -73,14 +65,15 @@ bundle exec rake jasmine:ci
73
65
 
74
66
  ## Releasing new versions
75
67
 
76
- To release a new version, create a new Pull Request that updates [version.rb](lib/govuk_tech_docs/version.rb) and [CHANGELOG.md](CHANGELOG.md). Don't mix this in with other changes - this makes it easier to find out what was released when. See [this PR to release a new version as an example](https://github.com/alphagov/tech-docs-gem/pull/15).
68
+ To release a new version, create a new pull request (PR) that updates [version.rb](lib/govuk_tech_docs/version.rb) and [CHANGELOG.md](CHANGELOG.md).
69
+
70
+ Do not include other changes in your pull request, as this makes it easier to find out what was released when. See an example of a [PR for releasing a new version](https://github.com/alphagov/tech-docs-gem/pull/15).
77
71
 
78
72
  Travis will automatically release a [new version to Rubygems.org](https://rubygems.org/gems/govuk_tech_docs).
79
73
 
80
74
  ## Licence
81
75
 
82
- Unless stated otherwise, the codebase is released under [the MIT License][mit].
83
- This covers both the codebase and any sample code in the documentation.
76
+ Unless stated otherwise, the codebase is released under [the MIT License][mit]. This covers both the codebase and any sample code in the documentation.
84
77
 
85
78
  The documentation is [© Crown copyright][copyright] and available under the terms of the [Open Government 3.0][ogl] licence.
86
79
 
@@ -1 +1 @@
1
- 2.6.3
1
+ 2.7.2
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
33
  spec.require_paths = ["lib"]
34
34
 
35
- spec.add_dependency "activesupport"
35
+ spec.add_dependency "autoprefixer-rails", "~> 10.2"
36
36
  spec.add_dependency "chronic", "~> 0.10.2"
37
37
  spec.add_dependency "middleman", "~> 4.0"
38
38
  spec.add_dependency "middleman-autoprefixer", "~> 2.10.0"
@@ -42,14 +42,9 @@ Gem::Specification.new do |spec|
42
42
  spec.add_dependency "middleman-sprockets", "~> 4.0.0"
43
43
  spec.add_dependency "middleman-syntax", "~> 3.2.0"
44
44
  spec.add_dependency "nokogiri"
45
- spec.add_dependency "openapi3_parser", "~> 0.5.0"
46
- spec.add_dependency "pry"
45
+ spec.add_dependency "openapi3_parser", "~> 0.9.0"
47
46
  spec.add_dependency "redcarpet", "~> 3.5.0"
48
- spec.add_dependency "sass"
49
- spec.add_dependency "sprockets", "~> 4.0.0"
50
47
 
51
-
52
- spec.add_development_dependency "bundler", "~> 2.1.4"
53
48
  spec.add_development_dependency "byebug"
54
49
  spec.add_development_dependency "capybara", "~> 3.32"
55
50
  spec.add_development_dependency "jasmine", "~> 3.5.0"
@@ -6,6 +6,7 @@
6
6
  Modules.Search = function Search () {
7
7
  var s = this
8
8
  var $html = $('html')
9
+ var $tocNav
9
10
  var $searchForm
10
11
  var $searchLabel
11
12
  var $searchInput
@@ -26,6 +27,7 @@
26
27
  $searchResults = $searchResultsWrapper.find('.search-results__content')
27
28
  $searchResultsTitle = $searchResultsWrapper.find('.search-results__title')
28
29
  $searchResultsClose = $searchResultsWrapper.find('.search-results__close')
30
+ $tocNav = $('#toc')
29
31
  s.downloadSearchIndex()
30
32
  attach()
31
33
  changeSearchLabel()
@@ -67,7 +69,14 @@
67
69
  $searchForm.on('submit', function (e) {
68
70
  e.preventDefault()
69
71
  showResults()
70
- $searchResults.find('.search-result__title a').first().focus()
72
+ var $firstResult = $searchResults.find('.search-result__title a').first()
73
+ if ($firstResult.length) {
74
+ $firstResult.focus()
75
+ } else {
76
+ // if there are no results, show the "0 results" state
77
+ results = []
78
+ updateTitle()
79
+ }
71
80
  })
72
81
 
73
82
  // Closing the search results, move focus back to the search input
@@ -98,7 +107,7 @@
98
107
  }
99
108
 
100
109
  function changeSearchLabel () {
101
- $searchLabel.text('Search')
110
+ $searchLabel.text('Search this documentation')
102
111
  }
103
112
 
104
113
  function getResults (query) {
@@ -192,12 +201,14 @@
192
201
  $searchResultsWrapper.addClass('is-open')
193
202
  .attr('aria-hidden', 'false')
194
203
  $html.addClass('has-search-results-open')
204
+ $tocNav.addClass('search-results-open')
195
205
  }
196
206
 
197
207
  function hideResults () {
198
208
  $searchResultsWrapper.removeClass('is-open')
199
209
  .attr('aria-hidden', 'true')
200
210
  $html.removeClass('has-search-results-open')
211
+ $tocNav.removeClass('search-results-open')
201
212
  }
202
213
 
203
214
  function sendQueryToAnalytics () {
@@ -7,23 +7,22 @@
7
7
  var $toc
8
8
  var $tocList
9
9
 
10
- var $openLink
11
- var $closeLink
10
+ var $openButton
11
+ var $closeButton
12
12
 
13
13
  this.start = function ($element) {
14
14
  $toc = $element
15
15
  $tocList = $toc.find('.js-toc-list')
16
-
17
16
  // Open link is not inside the module
18
- $openLink = $html.find('.js-toc-show')
19
- $closeLink = $toc.find('.js-toc-close')
17
+ $openButton = $html.find('.js-toc-show')
18
+ $closeButton = $toc.find('.js-toc-close')
20
19
 
21
20
  fixRubberBandingInIOS()
22
21
  updateAriaAttributes()
23
22
 
24
23
  // Need delegated handler for show link as sticky polyfill recreates element
25
- $openLink.on('click.toc', preventingScrolling(openNavigation))
26
- $closeLink.on('click.toc', preventingScrolling(closeNavigation))
24
+ $openButton.on('click.toc', preventingScrolling(openNavigation))
25
+ $closeButton.on('click.toc', preventingScrolling(closeNavigation))
27
26
  $tocList.on('click.toc', 'a', closeNavigation)
28
27
 
29
28
  // Allow aria hidden to be updated when resizing from mobile to desktop or
@@ -65,21 +64,17 @@
65
64
 
66
65
  toggleBackgroundVisiblity(false)
67
66
  updateAriaAttributes()
68
-
69
- focusFirstLinkInToc()
67
+ $toc.focus()
70
68
  }
71
69
 
72
70
  function closeNavigation () {
73
71
  $html.removeClass('toc-open')
72
+ $html.removeClass('has-search-results-open')
74
73
 
75
74
  toggleBackgroundVisiblity(true)
76
75
  updateAriaAttributes()
77
76
  }
78
77
 
79
- function focusFirstLinkInToc () {
80
- $('a', $tocList).first().focus()
81
- }
82
-
83
78
  function toggleBackgroundVisiblity (visibility) {
84
79
  $('.toc-open-disabled').attr('aria-hidden', visibility ? '' : 'true')
85
80
  }
@@ -87,7 +82,7 @@
87
82
  function updateAriaAttributes () {
88
83
  var tocIsVisible = $toc.is(':visible')
89
84
 
90
- $($openLink).add($closeLink)
85
+ $($openButton).add($closeButton)
91
86
  .attr('aria-expanded', tocIsVisible ? 'true' : 'false')
92
87
 
93
88
  $toc.attr('aria-hidden', tocIsVisible ? 'false' : 'true')
@@ -1,20 +1,19 @@
1
1
  $govuk-assets-path: "/assets/govuk/assets/";
2
2
 
3
3
  // Include only the bits of GOV.UK Frontend we need
4
- @import "govuk/settings/all";
5
- @import "govuk/tools/all";
6
- @import "govuk/helpers/all";
4
+ $govuk-new-link-styles: true;
5
+ @import "govuk/base";
7
6
 
8
7
  @import "govuk/core/all";
9
8
  @import "govuk/objects/all";
10
9
 
11
- @import "govuk/components/footer/footer";
12
- @import "govuk/components/header/header";
13
- @import "govuk/components/inset-text/inset-text";
14
- @import "govuk/components/input/input";
15
- @import "govuk/components/tag/tag";
16
- @import "govuk/components/skip-link/skip-link";
17
- @import "govuk/components/warning-text/warning-text";
10
+ @import "govuk/components/footer/index";
11
+ @import "govuk/components/header/index";
12
+ @import "govuk/components/inset-text/index";
13
+ @import "govuk/components/input/index";
14
+ @import "govuk/components/tag/index";
15
+ @import "govuk/components/skip-link/index";
16
+ @import "govuk/components/warning-text/index";
18
17
 
19
18
  @import "govuk/utilities/all";
20
19
  @import "govuk/overrides/all";
@@ -13,11 +13,9 @@
13
13
 
14
14
  a:link,
15
15
  a:visited {
16
- color: inherit;
17
- }
18
-
19
- a:hover {
20
- color: $govuk-link-hover-colour;
16
+ &:not(:focus) {
17
+ color: inherit;
18
+ }
21
19
  }
22
20
 
23
21
  a:active {
@@ -1,16 +1,9 @@
1
+ $input-size: 40px;
2
+
1
3
  @include govuk-media-query($media-type: screen) {
2
4
  .page-title + .search {
3
5
  margin-top: govuk-spacing(6);
4
6
  }
5
-
6
- .js .search__label {
7
- position: absolute;
8
- left: -9999em;
9
- top: auto;
10
- width: 1px;
11
- height: 1px;
12
- overflow: hidden;
13
- }
14
7
  }
15
8
 
16
9
  @include govuk-media-query($media-type: print) {
@@ -19,11 +12,55 @@
19
12
  }
20
13
  }
21
14
 
15
+ .js .search__label {
16
+ @extend .govuk-visually-hidden;
17
+ }
18
+
19
+ .search__form {
20
+ position: relative;
21
+ }
22
+
23
+ .search__input {
24
+ width: 230px;
25
+ width: calc(100% - #{$input-size});
26
+ }
27
+
28
+ .search__button {
29
+ position: absolute;
30
+ bottom: 0;
31
+ right: 0;
32
+ border: 0;
33
+ background-color: govuk-colour('blue');
34
+ color: #fff;
35
+ cursor: pointer;
36
+ padding: 0;
37
+ width: $input-size;
38
+ height: 100%;
39
+ background-image: url('/images/search-button.png');
40
+ background-repeat: no-repeat;
41
+ background-position: 2px 50%;
42
+ text-indent: -5000px;
43
+ overflow: hidden;
44
+ &:focus {
45
+ outline: $govuk-focus-width solid $govuk-focus-colour;
46
+ outline-offset: 0;
47
+ box-shadow: inset 0 0 0 $govuk-border-width-form-element * 2 govuk-colour("black");
48
+
49
+ @include govuk-if-ie8 {
50
+ border-width: $govuk-border-width-form-element * 2;
51
+ }
52
+ }
53
+ }
54
+
22
55
  html.has-search-results-open {
23
56
  overflow: hidden;
24
57
  .app-pane__content {
25
58
  overflow: hidden;
26
59
  }
60
+
61
+ .toc__close{
62
+ display: none;
63
+ }
27
64
  }
28
65
  .search-results {
29
66
  display: none;
@@ -47,23 +84,12 @@ html.has-search-results-open {
47
84
  top: 0;
48
85
  // The width of the sidebar
49
86
  left: 330px;
87
+ min-height: auto;
50
88
  }
51
89
 
52
- a:link, a:visited {
53
- text-decoration: none;
54
- color: $govuk-link-colour;
55
- }
56
-
57
- a:hover {
58
- text-decoration: underline;
59
-
60
- &:focus {
61
- text-decoration: none;
62
- }
63
- }
64
- a:focus {
65
- outline: none;
66
- @include govuk-focused-text;
90
+ a {
91
+ @include govuk-link-common;
92
+ @include govuk-link-style-no-visited-state;
67
93
  }
68
94
  }
69
95
  .search-results__inner {