idsk_frontend_toolkit 7.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/.gitmodules +3 -0
  4. data/.ruby-version +1 -0
  5. data/.travis/govuk_frontend_toolkit_gem_push.enc +0 -0
  6. data/.travis/govuk_frontend_toolkit_gem_push.pub +1 -0
  7. data/.travis.yml +23 -0
  8. data/CONTRIBUTING.md +13 -0
  9. data/Gemfile +3 -0
  10. data/LICENCE +20 -0
  11. data/README.md +61 -0
  12. data/Rakefile +10 -0
  13. data/app/assets/.gitignore +5 -0
  14. data/app/assets/.ruby-version +1 -0
  15. data/app/assets/.travis/README.md +23 -0
  16. data/app/assets/.travis/govuk_frontend_toolkit_push.enc +0 -0
  17. data/app/assets/.travis/govuk_frontend_toolkit_push.pub +1 -0
  18. data/app/assets/.travis.yml +18 -0
  19. data/app/assets/CHANGELOG.md +381 -0
  20. data/app/assets/CONTRIBUTING.md +23 -0
  21. data/app/assets/Gemfile +4 -0
  22. data/app/assets/Gemfile.lock +48 -0
  23. data/app/assets/Gruntfile.js +68 -0
  24. data/app/assets/LICENCE +20 -0
  25. data/app/assets/README.md +170 -0
  26. data/app/assets/VERSION.txt +1 -0
  27. data/app/assets/create-release.sh +38 -0
  28. data/app/assets/docs/analytics.md +270 -0
  29. data/app/assets/docs/functions.md +62 -0
  30. data/app/assets/docs/javascript.md +337 -0
  31. data/app/assets/docs/mixins.md +617 -0
  32. data/app/assets/images/accordion-arrow-2x.png +0 -0
  33. data/app/assets/images/accordion-arrow.png +0 -0
  34. data/app/assets/images/arrow-sprite.png +0 -0
  35. data/app/assets/images/crests/bis_crest_13px.png +0 -0
  36. data/app/assets/images/crests/bis_crest_13px_x2.png +0 -0
  37. data/app/assets/images/crests/bis_crest_18px.png +0 -0
  38. data/app/assets/images/crests/bis_crest_18px_x2.png +0 -0
  39. data/app/assets/images/crests/bis_crest_27px.png +0 -0
  40. data/app/assets/images/crests/bis_crest_27px_x2.png +0 -0
  41. data/app/assets/images/crests/coastguard_13px.png +0 -0
  42. data/app/assets/images/crests/coastguard_13px_x2.png +0 -0
  43. data/app/assets/images/crests/coastguard_18px.png +0 -0
  44. data/app/assets/images/crests/coastguard_18px_x2.png +0 -0
  45. data/app/assets/images/crests/coastguard_27px.png +0 -0
  46. data/app/assets/images/crests/coastguard_27px_x2.png +0 -0
  47. data/app/assets/images/crests/dit_crest_13px.png +0 -0
  48. data/app/assets/images/crests/dit_crest_13px_x2.png +0 -0
  49. data/app/assets/images/crests/dit_crest_18px.png +0 -0
  50. data/app/assets/images/crests/dit_crest_18px_x2.png +0 -0
  51. data/app/assets/images/crests/dit_crest_27px.png +0 -0
  52. data/app/assets/images/crests/dit_crest_27px_x2.png +0 -0
  53. data/app/assets/images/crests/hmrc_crest_13px.png +0 -0
  54. data/app/assets/images/crests/hmrc_crest_13px_x2.png +0 -0
  55. data/app/assets/images/crests/hmrc_crest_18px.png +0 -0
  56. data/app/assets/images/crests/hmrc_crest_18px_x2.png +0 -0
  57. data/app/assets/images/crests/hmrc_crest_27px.png +0 -0
  58. data/app/assets/images/crests/hmrc_crest_27px_x2.png +0 -0
  59. data/app/assets/images/crests/ho_crest_13px.png +0 -0
  60. data/app/assets/images/crests/ho_crest_13px_x2.png +0 -0
  61. data/app/assets/images/crests/ho_crest_18px.png +0 -0
  62. data/app/assets/images/crests/ho_crest_18px_x2.png +0 -0
  63. data/app/assets/images/crests/ho_crest_27px.png +0 -0
  64. data/app/assets/images/crests/ho_crest_27px_x2.png +0 -0
  65. data/app/assets/images/crests/mod_crest_13px.png +0 -0
  66. data/app/assets/images/crests/mod_crest_13px_x2.png +0 -0
  67. data/app/assets/images/crests/mod_crest_18px.png +0 -0
  68. data/app/assets/images/crests/mod_crest_18px_x2.png +0 -0
  69. data/app/assets/images/crests/mod_crest_27px.png +0 -0
  70. data/app/assets/images/crests/mod_crest_27px_x2.png +0 -0
  71. data/app/assets/images/crests/org_crest_13px.png +0 -0
  72. data/app/assets/images/crests/org_crest_13px_x2.png +0 -0
  73. data/app/assets/images/crests/org_crest_18px.png +0 -0
  74. data/app/assets/images/crests/org_crest_18px_x2.png +0 -0
  75. data/app/assets/images/crests/org_crest_27px.png +0 -0
  76. data/app/assets/images/crests/org_crest_27px_x2.png +0 -0
  77. data/app/assets/images/crests/portcullis_13px.png +0 -0
  78. data/app/assets/images/crests/portcullis_13px_x2.png +0 -0
  79. data/app/assets/images/crests/portcullis_18px.png +0 -0
  80. data/app/assets/images/crests/portcullis_18px_x2.png +0 -0
  81. data/app/assets/images/crests/portcullis_27px.png +0 -0
  82. data/app/assets/images/crests/portcullis_27px_x2.png +0 -0
  83. data/app/assets/images/crests/so_crest_13px.png +0 -0
  84. data/app/assets/images/crests/so_crest_13px_x2.png +0 -0
  85. data/app/assets/images/crests/so_crest_18px.png +0 -0
  86. data/app/assets/images/crests/so_crest_18px_x2.png +0 -0
  87. data/app/assets/images/crests/so_crest_27px.png +0 -0
  88. data/app/assets/images/crests/so_crest_27px_x2.png +0 -0
  89. data/app/assets/images/crests/ukaea_crest_13px.png +0 -0
  90. data/app/assets/images/crests/ukaea_crest_13px_x2.png +0 -0
  91. data/app/assets/images/crests/ukaea_crest_18px.png +0 -0
  92. data/app/assets/images/crests/ukaea_crest_18px_x2.png +0 -0
  93. data/app/assets/images/crests/ukaea_crest_27px.png +0 -0
  94. data/app/assets/images/crests/ukaea_crest_27px_x2.png +0 -0
  95. data/app/assets/images/crests/ukho_13px.png +0 -0
  96. data/app/assets/images/crests/ukho_13px_x2.png +0 -0
  97. data/app/assets/images/crests/ukho_18px.png +0 -0
  98. data/app/assets/images/crests/ukho_18px_x2.png +0 -0
  99. data/app/assets/images/crests/ukho_27px.png +0 -0
  100. data/app/assets/images/crests/ukho_27px_x2.png +0 -0
  101. data/app/assets/images/crests/wales_crest_13px.png +0 -0
  102. data/app/assets/images/crests/wales_crest_13px_x2.png +0 -0
  103. data/app/assets/images/crests/wales_crest_18px.png +0 -0
  104. data/app/assets/images/crests/wales_crest_18px_x2.png +0 -0
  105. data/app/assets/images/crests/wales_crest_27px.png +0 -0
  106. data/app/assets/images/crests/wales_crest_27px_x2.png +0 -0
  107. data/app/assets/images/icon-arrow-left.png +0 -0
  108. data/app/assets/images/icon-calendar-2x.png +0 -0
  109. data/app/assets/images/icon-calendar.png +0 -0
  110. data/app/assets/images/icon-file-download-2x.png +0 -0
  111. data/app/assets/images/icon-file-download.png +0 -0
  112. data/app/assets/images/icon-important-2x.png +0 -0
  113. data/app/assets/images/icon-important.png +0 -0
  114. data/app/assets/images/icon-information-2x.png +0 -0
  115. data/app/assets/images/icon-information.png +0 -0
  116. data/app/assets/images/icon-locator-2x.png +0 -0
  117. data/app/assets/images/icon-locator.png +0 -0
  118. data/app/assets/images/icon-pointer-2x.png +0 -0
  119. data/app/assets/images/icon-pointer-black-2x.png +0 -0
  120. data/app/assets/images/icon-pointer-black.png +0 -0
  121. data/app/assets/images/icon-pointer-indexed.png +0 -0
  122. data/app/assets/images/icon-pointer.png +0 -0
  123. data/app/assets/images/icon-search-2x.png +0 -0
  124. data/app/assets/images/icon-search.png +0 -0
  125. data/app/assets/images/icon-steps/icon-step-1-2x.png +0 -0
  126. data/app/assets/images/icon-steps/icon-step-1.png +0 -0
  127. data/app/assets/images/icon-steps/icon-step-10-2x.png +0 -0
  128. data/app/assets/images/icon-steps/icon-step-10.png +0 -0
  129. data/app/assets/images/icon-steps/icon-step-11-2x.png +0 -0
  130. data/app/assets/images/icon-steps/icon-step-11.png +0 -0
  131. data/app/assets/images/icon-steps/icon-step-12-2x.png +0 -0
  132. data/app/assets/images/icon-steps/icon-step-12.png +0 -0
  133. data/app/assets/images/icon-steps/icon-step-13-2x.png +0 -0
  134. data/app/assets/images/icon-steps/icon-step-13.png +0 -0
  135. data/app/assets/images/icon-steps/icon-step-14-2x.png +0 -0
  136. data/app/assets/images/icon-steps/icon-step-14.png +0 -0
  137. data/app/assets/images/icon-steps/icon-step-2-2x.png +0 -0
  138. data/app/assets/images/icon-steps/icon-step-2.png +0 -0
  139. data/app/assets/images/icon-steps/icon-step-3-2x.png +0 -0
  140. data/app/assets/images/icon-steps/icon-step-3.png +0 -0
  141. data/app/assets/images/icon-steps/icon-step-4-2x.png +0 -0
  142. data/app/assets/images/icon-steps/icon-step-4.png +0 -0
  143. data/app/assets/images/icon-steps/icon-step-5-2x.png +0 -0
  144. data/app/assets/images/icon-steps/icon-step-5.png +0 -0
  145. data/app/assets/images/icon-steps/icon-step-6-2x.png +0 -0
  146. data/app/assets/images/icon-steps/icon-step-6.png +0 -0
  147. data/app/assets/images/icon-steps/icon-step-7-2x.png +0 -0
  148. data/app/assets/images/icon-steps/icon-step-7.png +0 -0
  149. data/app/assets/images/icon-steps/icon-step-8-2x.png +0 -0
  150. data/app/assets/images/icon-steps/icon-step-8.png +0 -0
  151. data/app/assets/images/icon-steps/icon-step-9-2x.png +0 -0
  152. data/app/assets/images/icon-steps/icon-step-9.png +0 -0
  153. data/app/assets/images/player-icon-forward.png +0 -0
  154. data/app/assets/images/player-icon-pause.png +0 -0
  155. data/app/assets/images/player-icon-play.png +0 -0
  156. data/app/assets/images/player-icon-rewind.png +0 -0
  157. data/app/assets/images/player-icon-volume.png +0 -0
  158. data/app/assets/images/separator-2x.png +0 -0
  159. data/app/assets/images/separator.png +0 -0
  160. data/app/assets/javascripts/govuk/analytics/analytics.js +143 -0
  161. data/app/assets/javascripts/govuk/analytics/download-link-tracker.js +41 -0
  162. data/app/assets/javascripts/govuk/analytics/error-tracking.js +51 -0
  163. data/app/assets/javascripts/govuk/analytics/external-link-tracker.js +56 -0
  164. data/app/assets/javascripts/govuk/analytics/google-analytics-universal-tracker.js +166 -0
  165. data/app/assets/javascripts/govuk/analytics/govuk-tracker.js +134 -0
  166. data/app/assets/javascripts/govuk/analytics/mailto-link-tracker.js +38 -0
  167. data/app/assets/javascripts/govuk/analytics/print-intent.js +39 -0
  168. data/app/assets/javascripts/govuk/details.polyfill.js +240 -0
  169. data/app/assets/javascripts/govuk/modules/auto-track-event.js +30 -0
  170. data/app/assets/javascripts/govuk/modules.js +61 -0
  171. data/app/assets/javascripts/govuk/primary-links.js +57 -0
  172. data/app/assets/javascripts/govuk/selection-buttons.js +116 -0
  173. data/app/assets/javascripts/govuk/shim-links-with-button-role.js +34 -0
  174. data/app/assets/javascripts/govuk/show-hide-content.js +172 -0
  175. data/app/assets/javascripts/govuk/stick-at-top-when-scrolling.js +128 -0
  176. data/app/assets/javascripts/govuk/stop-scrolling-at-footer.js +139 -0
  177. data/app/assets/javascripts/govuk_toolkit.js +1 -0
  178. data/app/assets/javascripts/stageprompt.js +69 -0
  179. data/app/assets/javascripts/vendor/jquery/jquery.player.min.js +25 -0
  180. data/app/assets/javascripts/vendor/polyfills/bind.js +40 -0
  181. data/app/assets/package.json +25 -0
  182. data/app/assets/spec/manifest.js +41 -0
  183. data/app/assets/spec/stylesheets/_colour_contrast_spec.scss +12 -0
  184. data/app/assets/spec/support/LocalTestRunner.html +21 -0
  185. data/app/assets/spec/support/console-runner.js +102 -0
  186. data/app/assets/spec/support/load.js +47 -0
  187. data/app/assets/spec/support/run_jasmine_test.js +62 -0
  188. data/app/assets/spec/unit/analytics/analytics.spec.js +315 -0
  189. data/app/assets/spec/unit/analytics/download-link-tracker.spec.js +72 -0
  190. data/app/assets/spec/unit/analytics/error-tracking.spec.js +65 -0
  191. data/app/assets/spec/unit/analytics/external-link-tracker.spec.js +109 -0
  192. data/app/assets/spec/unit/analytics/google-analytics-universal-tracker.spec.js +180 -0
  193. data/app/assets/spec/unit/analytics/govuk-tracker.spec.js +171 -0
  194. data/app/assets/spec/unit/analytics/mailto-link-tracker.spec.js +62 -0
  195. data/app/assets/spec/unit/details.polyfill.spec.js +91 -0
  196. data/app/assets/spec/unit/modules/auto-track-event.spec.js +54 -0
  197. data/app/assets/spec/unit/modules.spec.js +93 -0
  198. data/app/assets/spec/unit/primary-links.spec.js +55 -0
  199. data/app/assets/spec/unit/selection-button.spec.js +761 -0
  200. data/app/assets/spec/unit/shim-links-with-button-role.spec.js +41 -0
  201. data/app/assets/spec/unit/show-hide-content.spec.js +306 -0
  202. data/app/assets/spec/unit/stick-at-top-when-scrolling.spec.js +137 -0
  203. data/app/assets/stylesheets/.gitkeep +0 -0
  204. data/app/assets/stylesheets/_colours.scss +2 -0
  205. data/app/assets/stylesheets/_conditionals.scss +81 -0
  206. data/app/assets/stylesheets/_css3.scss +90 -0
  207. data/app/assets/stylesheets/_device-pixels.scss +10 -0
  208. data/app/assets/stylesheets/_font_stack.scss +25 -0
  209. data/app/assets/stylesheets/_grid_layout.scss +136 -0
  210. data/app/assets/stylesheets/_helpers.scss +16 -0
  211. data/app/assets/stylesheets/_measurements.scss +14 -0
  212. data/app/assets/stylesheets/_shims.scss +55 -0
  213. data/app/assets/stylesheets/_typography.scss +249 -0
  214. data/app/assets/stylesheets/_url-helpers.scss +16 -0
  215. data/app/assets/stylesheets/colours/_organisation.scss +104 -0
  216. data/app/assets/stylesheets/colours/_palette.scss +77 -0
  217. data/app/assets/stylesheets/design-patterns/_alpha-beta.scss +67 -0
  218. data/app/assets/stylesheets/design-patterns/_breadcrumbs.scss +53 -0
  219. data/app/assets/stylesheets/design-patterns/_buttons.scss +145 -0
  220. data/app/assets/stylesheets/design-patterns/_media-player.scss +264 -0
  221. data/app/assets/trigger.sh +24 -0
  222. data/idsk_frontend_toolkit.gemspec +49 -0
  223. data/lib/idsk_frontend_toolkit/engine.rb +4 -0
  224. data/lib/idsk_frontend_toolkit/version.rb +5 -0
  225. data/lib/idsk_frontend_toolkit.rb +4 -0
  226. data/publish.sh +30 -0
  227. metadata +314 -0
@@ -0,0 +1,48 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ ast (2.3.0)
5
+ ffi (1.9.18)
6
+ govuk-lint (3.6.0)
7
+ rubocop (~> 0.51.0)
8
+ rubocop-rspec (~> 1.19.0)
9
+ scss_lint
10
+ parallel (1.12.1)
11
+ parser (2.4.0.2)
12
+ ast (~> 2.3)
13
+ powerpack (0.1.1)
14
+ rainbow (2.2.2)
15
+ rake
16
+ rake (12.3.0)
17
+ rb-fsevent (0.10.2)
18
+ rb-inotify (0.9.10)
19
+ ffi (>= 0.5.0, < 2)
20
+ rubocop (0.51.0)
21
+ parallel (~> 1.10)
22
+ parser (>= 2.3.3.1, < 3.0)
23
+ powerpack (~> 0.1)
24
+ rainbow (>= 2.2.2, < 3.0)
25
+ ruby-progressbar (~> 1.7)
26
+ unicode-display_width (~> 1.0, >= 1.0.1)
27
+ rubocop-rspec (1.19.0)
28
+ rubocop (>= 0.51.0)
29
+ ruby-progressbar (1.9.0)
30
+ sass (3.5.5)
31
+ sass-listen (~> 4.0.0)
32
+ sass-listen (4.0.0)
33
+ rb-fsevent (~> 0.9, >= 0.9.4)
34
+ rb-inotify (~> 0.9, >= 0.9.7)
35
+ scss_lint (0.56.0)
36
+ rake (>= 0.9, < 13)
37
+ sass (~> 3.5.3)
38
+ unicode-display_width (1.3.0)
39
+
40
+ PLATFORMS
41
+ ruby
42
+
43
+ DEPENDENCIES
44
+ govuk-lint (= 3.6.0)
45
+ sass (= 3.5.5)
46
+
47
+ BUNDLED WITH
48
+ 1.14.6
@@ -0,0 +1,68 @@
1
+ module.exports = function (grunt) {
2
+ var allSassFiles = []
3
+
4
+ grunt.file.recurse(
5
+ './stylesheets/',
6
+ function (abspath, rootdir, subdir, filename) {
7
+ var relpath
8
+ if (typeof subdir !== 'undefined') {
9
+ relpath = subdir + '/' + filename
10
+ } else {
11
+ relpath = filename
12
+ }
13
+ if (filename.match(/\.scss/)) {
14
+ allSassFiles.push("@import '" + relpath + "';")
15
+ }
16
+ }
17
+ )
18
+
19
+ allSassFiles.push("@import '_colour_contrast_spec.scss';")
20
+
21
+ grunt.file.write(
22
+ './spec/stylesheets/test.scss',
23
+ allSassFiles.join('\n')
24
+ )
25
+
26
+ grunt.initConfig({
27
+ clean: {
28
+ sass: ['spec/stylesheets/test*css']
29
+ },
30
+ jasmine: {
31
+ javascripts: {
32
+ src: [
33
+ 'node_modules/jquery/dist/jquery.js',
34
+ 'javascripts/govuk/analytics/google-analytics-universal-tracker.js',
35
+ 'javascripts/govuk/analytics/govuk-tracker.js',
36
+ 'javascripts/govuk/analytics/analytics.js',
37
+ 'javascripts/**/*.js'
38
+ ],
39
+ options: {
40
+ specs: 'spec/unit/**/*.spec.js',
41
+ helpers: 'spec/unit/*.helper.js'
42
+ }
43
+ }
44
+ },
45
+ sass: {
46
+ development: {
47
+ files: {
48
+ './spec/stylesheets/test-out.css': './spec/stylesheets/test.scss'
49
+ },
50
+ options: {
51
+ loadPath: [
52
+ './node_modules',
53
+ './stylesheets',
54
+ './spec/stylesheets'
55
+ ],
56
+ style: 'nested'
57
+ }
58
+ }
59
+ }
60
+ })
61
+
62
+ grunt.loadNpmTasks('grunt-contrib-clean')
63
+ grunt.loadNpmTasks('grunt-contrib-jasmine')
64
+ grunt.loadNpmTasks('grunt-contrib-sass')
65
+
66
+ grunt.registerTask('test', ['sass', 'clean', 'jasmine'])
67
+ grunt.registerTask('default', ['test'])
68
+ }
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Crown Copyright (Government Digital Service)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,170 @@
1
+ # GOV.UK frontend toolkit
2
+
3
+ A collection of Sass and JavaScript files for using as part of your
4
+ application's frontend.
5
+
6
+ This project is not tied to a specific language and is designed to be used
7
+ as a dependency in as many different languages as needed.
8
+
9
+ There's a `Gemfile` and a `package.json` in this directory, but they are only
10
+ for running tests and are not an indication that this project prefers
11
+ Ruby or Node.js.
12
+
13
+ ## Installing
14
+
15
+ ### Ruby on Rails
16
+
17
+ We recommend you use the [govuk_frontend_toolkit_gem][toolkit_gem_github] and
18
+ follow the [installation instructions][toolkit_gem_github_readme].
19
+
20
+ [toolkit_gem_github]: https://github.com/alphagov/govuk_frontend_toolkit_gem
21
+ [toolkit_gem_github_readme]: https://github.com/alphagov/govuk_frontend_toolkit_gem#readme
22
+
23
+ ### Node.js
24
+
25
+ [govuk_frontend_toolkit_npm][toolkit_npm_github] is an NPM package that can be
26
+ [installed or included in your package.json][toolkit_npm].
27
+
28
+ [toolkit_npm_github]: https://github.com/alphagov/govuk_frontend_toolkit_npm
29
+ [toolkit_npm]: https://npmjs.org/package/govuk_frontend_toolkit
30
+
31
+ If you are using a build tool that depends on Libsass then you
32
+ may need to upgrade to a more recent version to use the grid helpers. Minimal
33
+ compatible versions include `node-sass` 1.0.0, `grunt-sass` 0.16.0,
34
+ `gulp-sass` 1.2.0 and `libsass` 3.0.0.
35
+
36
+ ### Django
37
+
38
+ Requirement: [NodeJS](https://nodejs.org/en/) installed. This gives you [Node Package Manager](https://docs.npmjs.com/getting-started/installing-node)(NPM) which is required to install npm packages.
39
+
40
+ The easiest way to integrate it would be to create a `package.json` file in your application with `npm init`
41
+
42
+ You then install the toolkit with `npm install --save govuk_frontend_toolkit`.
43
+ If you need javascript files, they will live in (`node_modules/govuk_frontend_toolkit/javascripts`).
44
+ If you need stylesheets they will live in (`node_modules/govuk_frontend_toolkit/stylesheets`).
45
+
46
+ With Django you can use https://github.com/jrief/django-sass-processor to compile Sass files.
47
+
48
+ Note: if you need complete styles you might want to install govuk-elements-sass package that also installs toolkit
49
+
50
+ ### Composer
51
+
52
+ [govuk_frontend_toolkit_composer][toolkit_composer_github] is an composer package that can be
53
+ [added to your composer.json][toolkit_composer_github_usage]
54
+
55
+ [toolkit_composer_github]: https://github.com/PurpleBooth/govuk_frontend_toolkit_composer
56
+ [toolkit_composer_github_usage]: https://github.com/PurpleBooth/govuk_frontend_toolkit_composer#installing
57
+
58
+ ### Other projects
59
+
60
+ #### Using the tagged versions
61
+
62
+ Each version of the toolkit is tagged with the version number in this format:
63
+
64
+ `v*version number*`, for example `v4.1.1` for version 4.1.1.
65
+
66
+ If your dependency management tool allows the use of Git repositories as dependencies, you can point to a version by using its tag.
67
+
68
+ For example, if you are using [bower](http://bower.io), you can add the toolkit to your `bower.json` like so:
69
+
70
+ `"govuk_frontend_toolkit": "git://github.com/alphagov/govuk_frontend_toolkit#v4.1.1"` (assuming you want version 4.1.1)
71
+
72
+ #### Using git submodules
73
+
74
+ You can include the toolkit as a [git submodule][git submodule].
75
+
76
+ [git submodule]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
77
+
78
+ To add the submodule to your project run the following command substituting the path to a subdirectory in your project's assets directory:
79
+
80
+ $ git submodule add https://github.com/alphagov/govuk_frontend_toolkit.git ./path/to/assets/govuk_frontend_toolkit
81
+
82
+ We recommend you use `https` rather than `ssh` for submodules as they don't require key exchanges when deploying to remote servers.
83
+
84
+ If you clone a project with the toolkit submodule installed you will need to initialise the submodule with the following command:
85
+
86
+ $ git submodule init
87
+
88
+ To update the toolkit to the latest version you can use:
89
+
90
+ $ git submodule update
91
+
92
+ ## Running tests
93
+
94
+ Tests for this project use Jasmine for the JavaScript and Ruby's `scss` and `scss-lint`
95
+ to check the stylesheets.
96
+
97
+ The requirements are Node.js 0.8 or higher and PhantomJS, and Ruby:
98
+
99
+ ```bash
100
+ bundle install
101
+ npm install
102
+ npm test
103
+ ```
104
+
105
+ ### Standard JavaScript
106
+ `govuk_frontend_toolkit` uses [standardjs](http://standardjs.com/), an opinionated JavaScript linter.
107
+ All JavaScript files follow its conventions. [Read more](https://github.com/alphagov/govuk_prototype_kit/blob/master/docs/linting.md)
108
+
109
+ ### Using the local test runner
110
+
111
+ The test suite can be run by opening the `./spec/support/LocalTestRunner.html` file in a browser for a more detailed trace of errors.
112
+
113
+ The files for unit tests and any supporting JavaScript should be added to `./spec/manifest.js` file.
114
+
115
+ ## Usage
116
+
117
+ At the top of a Sass file in your project you should use an `@import` rule
118
+ to include the file for the mixins you require, eg if you want the
119
+ conditionals and typography mixins you should add:
120
+
121
+ @import '_conditionals';
122
+ @import '_typography';
123
+
124
+ You may need to include the relative path to the toolkit if it is installed as a submodule:
125
+
126
+ @import '../toolkit/_conditionals';
127
+
128
+ If you are compiling Sass from the [command-line tool](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#using_sass), here are some options we recommend.
129
+
130
+ In development:
131
+
132
+ sass --style expanded --line-numbers --load-path [path to]/govuk_frontend_toolkit/stylesheets input.scss output.css
133
+
134
+ In production:
135
+
136
+ sass --style compressed --load-path [path to]/govuk_frontend_toolkit/stylesheets input.scss output.css
137
+
138
+ ## Documentation
139
+
140
+ * [Mixin-sets](/docs/mixins.md)
141
+ * [Grid layout](/docs/mixins.md#grid-layout)
142
+ * [Conditionals](/docs/mixins.md#conditionals)
143
+ * [Colours](/docs/mixins.md#colours)
144
+ * [Typography](/docs/mixins.md#typography)
145
+ * [CSS3](/docs/mixins.md#css3)
146
+ * [Buttons](/docs/mixins.md#buttons)
147
+ * [Phase banner](/docs/mixins.md#-phase-banner)
148
+ * [Phase tags](/docs/mixins.md#-phase-tags)
149
+ * [JavaScript](/docs/javascript.md)
150
+ * [Modules](/docs/javascript.md#modules)
151
+ * [Media player](/docs/javascript.md#media-player)
152
+ * [Primary links](/docs/javascript.md#primary-links)
153
+ * [Stick at top when scrolling](/docs/javascript.md#stick-at-top-when-scrolling)
154
+ * [Selection buttons](/docs/javascript.md#selection-buttons)
155
+ * [Shim links with button role](/docs/javascript.md#shim-links-with-button-role)
156
+ * [Show/Hide content](/docs/javascript.md#showhide-content)
157
+ * [Analytics](/docs/analytics.md)
158
+ * [Create an analytics tracker](/docs/analytics.md#create-an-analytics-tracker)
159
+ * [Virtual pageviews](/docs/analytics.md#virtual-pageviews)
160
+ * [Custom events](/docs/analytics.md#custom-events)
161
+ * [Custom dimensions and custom variables](/docs/analytics.md#custom-dimensions-and-custom-variables)
162
+ * [Print tracking](/docs/analytics.md#print-tracking-print-intentjs)
163
+ * [Error tracking](/docs/analytics.md#error-tracking-error-trackingjs)
164
+ * [External link tracking](/docs/analytics.md#external-link-tracking-external-link-trackerjs)
165
+ * [Download link tracking](/docs/analytics.md#download-link-tracking-download-link-trackerjs)
166
+ * [Mailto link tracking](/docs/analytics.md#mailto-link-tracking-mailto-link-trackerjs)
167
+
168
+ ## Licence
169
+
170
+ Released under the MIT Licence, a copy of which can be found in the file `LICENCE`.
@@ -0,0 +1 @@
1
+ 7.4.2
@@ -0,0 +1,38 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ REPO_PATH="alphagov/govuk_frontend_toolkit"
5
+
6
+ echo "Add config for alphagov/$REPO_PATH"
7
+
8
+ git config --global user.name "GOV.UK Design System CI"
9
+ git config --global user.email "design-system-pipeline@digital.cabinet-office.gov.uk"
10
+ git remote add origin_ssh git@github.com:$REPO_PATH.git
11
+
12
+ # This openssl command was generated automatically by `travis encrypt-file`, see `.travis/README.md` for more details
13
+ openssl aes-256-cbc -K $encrypted_53be47f46000_key -iv $encrypted_53be47f46000_iv -in .travis/govuk_frontend_toolkit_push.enc -out ~/.ssh/id_rsa -d
14
+ chmod 600 ~/.ssh/id_rsa
15
+
16
+ echo "Check to see if the version file has been updated"
17
+
18
+ # get the version from the version file
19
+ VERSION_TAG="v`cat VERSION.txt`"
20
+
21
+ # Create a new tag - if the version file has been updated and a tag for that
22
+ # version doesn't already exist
23
+
24
+ # check to make sure the tag doesn't already exist
25
+ if ! git rev-parse $VERSION_TAG >/dev/null 2>&1; then
26
+ echo "Creating new tag: $VERSION_TAG"
27
+
28
+ # Create a new tag and push to Github
29
+ git tag $VERSION_TAG
30
+ git push origin_ssh $VERSION_TAG
31
+
32
+ # Alias branch for the most recently released tag, for easier diffing
33
+ # Force push local `master` branch to the `latest-release` branch on Github
34
+ git push --force origin_ssh master:latest-release
35
+ echo "Pushed latest-release branch to GitHub"
36
+ else
37
+ echo "Not creating a new tag, or updating the latest-release branch as the tag already exists..."
38
+ fi
@@ -0,0 +1,270 @@
1
+ # Analytics
2
+
3
+ The toolkit provides an abstraction around analytics to make tracking pageviews, events and dimensions across multiple analytics providers easier. Specifically it was created to ease the migration from Google’s Classic Analytics to Universal Analytics. It includes:
4
+
5
+ * a Google Analytics universal tracker wrapper
6
+ * code to asynchronously load universal analytics
7
+ * a generic Analytics wrapper that allows multiple trackers to be configured
8
+ * sensible defaults such as anonymising IPs
9
+ * data coercion into the format required by Google Analytics (eg a custom dimension’s value must be a string)
10
+ * stripping of PII from data sent to the tracker (strips email by default, can be configured to also strip UK postcodes)
11
+
12
+ ## Create an analytics tracker
13
+
14
+ The minimum you need to use the analytics function is:
15
+
16
+ 1. Include the following files from /javascripts/govuk/analytics in your project:
17
+ * google-analytics-universal-tracker.js
18
+ * analytics.js
19
+ 2. Copy the following `init` script into your own project and replace the dummy IDs with your own (they begin with `UA-`).
20
+ * This initialisation can occur immediately as this API has no dependencies.
21
+ * Load and create the analytics tracker at the earliest opportunity so that:
22
+ * the time until the first pageview is tracked is kept small and pageviews aren’t missed
23
+ * javascript that depends on `GOVUK.analytics` runs after the tracker has been created
24
+
25
+ ```js
26
+ (function() {
27
+ "use strict";
28
+
29
+ // Load Google Analytics libraries
30
+ GOVUK.Analytics.load();
31
+
32
+ // Use document.domain in dev, preview and staging so that tracking works
33
+ // Otherwise explicitly set the domain as www.gov.uk (and not gov.uk).
34
+ var cookieDomain = (document.domain === 'www.gov.uk') ? '.www.gov.uk' : document.domain;
35
+
36
+ // Configure profiles and make interface public
37
+ // for custom dimensions, virtual pageviews and events
38
+ GOVUK.analytics = new GOVUK.Analytics({
39
+ universalId: 'UA-XXXXXXXX-X',
40
+ cookieDomain: cookieDomain
41
+ });
42
+
43
+ // Set custom dimensions before tracking pageviews
44
+ // GOVUK.analytics.setDimension(…)
45
+
46
+ // Activate any event plugins eg. print intent, error tracking
47
+ // GOVUK.analyticsPlugins.error();
48
+ // GOVUK.analyticsPlugins.printIntent();
49
+
50
+ // Track initial pageview
51
+ GOVUK.analytics.trackPageview();
52
+ })();
53
+ ```
54
+
55
+ Once instantiated, the `GOVUK.analytics` object can be used to track virtual pageviews, custom events and custom dimensions.
56
+
57
+ ## Virtual pageviews
58
+
59
+ > Page tracking allows you to measure the number of views you had of a particular page on your web site.
60
+
61
+ * [Universal Analytics](https://developers.google.com/analytics/devguides/collection/analyticsjs/pages)
62
+
63
+ Argument | Description
64
+ ---------|------------
65
+ `path` (optional) | Custom path, eg `/path`
66
+ `title` (optional) | Custom page title, Universal only
67
+
68
+
69
+ ```js
70
+ // Track current page
71
+ GOVUK.analytics.trackPageview();
72
+
73
+ // Track a custom path
74
+ GOVUK.analytics.trackPageview('/path');
75
+
76
+ // Track a custom path and custom page title
77
+ GOVUK.analytics.trackPageview('/path', 'Title');
78
+
79
+ // As above, plus additional options passed into the `pageview` call
80
+ GOVUK.analytics.trackPageview('/path', 'Title', {
81
+ sessionControl: 'start'
82
+ });
83
+ ```
84
+
85
+ ## Custom events
86
+
87
+ > Event tracking allows you to measure how users interact with the content of your website. For example, you might want to measure how many times a button was pressed, or how many times a particular item was used.
88
+
89
+ * [Universal Analytics](https://developers.google.com/analytics/devguides/collection/analyticsjs/events)
90
+
91
+ Argument | Description
92
+ ---------|------------
93
+ `category` (required) | Typically the object that was interacted with, eg "JavaScript error"
94
+ `action` (required) | The type of interaction, eg a Javascript error message
95
+ `options` (optional) | Optional parameters to further describe event
96
+
97
+ Option | Description
98
+ -------|------------
99
+ `page` | Useful for sending the URL when `window.location` has been updated using JavaScript since the Analytics tracking object was created
100
+ `label` | Useful for categorising events, eg Javascript error source
101
+ `value` | Values must be non-negative. Useful to pass counts, eg error happened 5 times
102
+ `nonInteraction` | Defaults to false. When set the event will not affect bounce rate
103
+
104
+ ```js
105
+ // Track a custom event with required category and action fields
106
+ GOVUK.analytics.trackEvent('category', 'action');
107
+
108
+ // Track a custom event with optional page, label, value and nonInteraction options
109
+ GOVUK.analytics.trackEvent('category', 'action', {
110
+ page: '/path/to/page',
111
+ label: 'label',
112
+ value: 1,
113
+ nonInteraction: true // event will not affect bounce rate
114
+ });
115
+ ```
116
+
117
+ ## Custom dimensions
118
+
119
+ > Custom dimensions and metrics are a powerful way to send custom data to Google Analytics. Use custom dimensions and metrics to segment and measure differences between: logged in and logged out users, authors of pages, or any other business data you have on a page.
120
+
121
+ * [Universal Analytics](https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets)
122
+
123
+ Universal custom dimensions are configured within analytics.
124
+
125
+ ### Set custom dimensions before tracking pageviews
126
+
127
+ Many page level custom dimensions must be set before the initial pageview is tracked. Calls to `setDimension` should typically be made before the initial `trackPageview` is sent to analytics.
128
+
129
+ Argument | Description
130
+ ---------|------------
131
+ `index` (required) | The Universal dimension’s index as configured in the profile.
132
+ `value` (required) | Value of the custom dimension
133
+
134
+ ```js
135
+ // Set a custom dimension at index 1 with value and name
136
+ GOVUK.analytics.setDimension(1, 'value');
137
+ ```
138
+
139
+ ### Create custom dimension helpers
140
+
141
+ Because dimensions rely on the correct index and that index doesn’t indicate its purpose, it’s helpful to create methods that abstract away the details. For example:
142
+
143
+ ```js
144
+ function setPixelDensityDimension(pixelDensity) {
145
+ GOVUK.analytics.setDimension(1, pixelDensity);
146
+ }
147
+ ```
148
+
149
+ ## Tracking across domains
150
+
151
+ Once an Analytics instance has been created, tracking across domains can be set up
152
+ for pages like:
153
+
154
+ ```js
155
+ GOVUK.analytics.addLinkedTrackerDomain(trackerIdHere, nameForTracker, domainToLinkTo);
156
+ ```
157
+
158
+ Once this is done hits to that page will be tracked in both your local and the
159
+ named tracker, and sessions will persist to the other domain.
160
+
161
+ ## Plugins
162
+
163
+ Plugins are namespaced to `GOVUK.analyticsPlugins`. They should be pulled in by your project and initialised after `GOVUK.analytics` (see [Create an analytics tracker, above](#create-an-analytics-tracker)).
164
+
165
+ ### Print tracking (`print-intent.js`)
166
+
167
+ Track when users are attempting to print content. The plugin sends a `Print intent` event and a `/print` prefixed pageview:
168
+
169
+ Example event:
170
+
171
+ Category | Action
172
+ ---------|-------
173
+ Print Intent | `/current/page`
174
+
175
+ Example pageview:
176
+
177
+ `/print/current/page`
178
+
179
+ ### Error tracking (`error-tracking.js`)
180
+
181
+ Track JavaScript errors, capturing the error message, file and line number. These events don’t affect bounce rate. Errors can be filtered to include only files of interest by passing in an options argument with a regexp matcher (to avoid tracking errors generated by browser plugins):
182
+
183
+ ```js
184
+ GOVUK.analyticsPlugins.error({filenameMustMatch: /gov\.uk/});
185
+ ```
186
+
187
+ Category | Action | Label | Value
188
+ ---------|--------|-------|-------
189
+ JavaScript Error | The error message | file.js: line number | 1
190
+
191
+ ### External link tracking (`external-link-tracker.js`)
192
+
193
+ The tracker will send an event for clicks on links beginning, `http` and linking outside of the current host. By default the plugin uses Google Analytics’ `transport: beacon` method so that events are tracked even if the page unloads.
194
+
195
+ Category | Action | Label
196
+ ---------|--------|-------
197
+ External Link Clicked | http://www.some-external-website.com | Link text
198
+
199
+
200
+ ### Download link tracking (`download-link-tracker.js`)
201
+
202
+ The tracker will send an event for clicks on any link that matches the selector passed in. A selector must be provided. By default the plugin uses Google Analytics’ `transport: beacon` method so that events are tracked even if the page unloads.
203
+
204
+ ```js
205
+ GOVUK.analyticsPlugins.downloadTracker({selector: 'a[rel="download"]'});
206
+ ```
207
+
208
+ Category | Action | Label
209
+ ---------|--------|-------
210
+ Download Link Clicked | `/some/upload/attachment/file.pdf` | Link text
211
+
212
+ ### Mailto link tracking (`mailto-link-tracker.js`)
213
+
214
+ The tracker will send events for clicks on links beginning with `mailto`. By default the
215
+ plugin uses Google Analytics’ `transport: beacon` method so that events are tracked even if the page unloads.
216
+
217
+ Category | Action | Label
218
+ ---------|--------|-------
219
+ Mailto Link Clicked | mailto:name@email.com | Link text
220
+
221
+ ### Stripping Personally Identifiable Information (PII)
222
+
223
+ The tracker will strip any PII it detects from all arguments sent to the
224
+ tracker. If a PII is detected in the arguments it is replaced with a
225
+ placeholder value of `[<type of PII removed>]`; for example: `[email]` if an
226
+ email address was removed, or `[postcode]` if a postcode was removed.
227
+
228
+ We have to parse all arguments which means that if you don't pass a path to
229
+ `trackPageView` to track the current page we have to extract the current page
230
+ and parse it, turning all `trackPageView` calls into ones with a path argument.
231
+ We use `window.location.href.split('#')[0]` as the default path when one is
232
+ not provided. The original behaviour would have been to ignore the anchor
233
+ part of the URL anyway so this doesn't change the behaviour other than to make
234
+ the path explicit.
235
+
236
+ By default we strip email addresses, but it can also be configured to strip
237
+ postcodes too. Postcodes are off by default because they're more likely to
238
+ cause false positives. If you know you are likely to include postcodes in
239
+ the data you send to the tracker you can configure to strip postcodes at
240
+ initialize time as follows:
241
+
242
+ ```js
243
+ GOVUK.analytics = new GOVUK.Analytics({
244
+ universalId: 'UA-XXXXXXXX-X',
245
+ cookieDomain: cookieDomain,
246
+ stripPostcodePII: true
247
+ });
248
+ ````
249
+
250
+ Any value other than the JS literal `true` for `stripPostcodePII` will leave
251
+ the analytics module configured not to strip postcodes.
252
+
253
+ #### Avoding false positives
254
+
255
+ Sometimes you will have data you want to send to analytics that looks like PII
256
+ and would be stripped out. For example on GOV.UK the content_ids that belong
257
+ to every document can sometimes contain a string of characters that look like a
258
+ UK postcode: in `eed5b92e-8279-4ca9-a141-5c35ed22fcf1` the substring `c35ed` in
259
+ the final portion looks like a postcode, `C3 5ED`, and will be transformed into
260
+ `eed5b92e-8279-4ca9-a141-5[postcode]22fcf1` which breaks the `content_id`. To
261
+ send data that you know is not PII, but it looks like an email address or a UK
262
+ postcode you can provide your arguments wrapped in a `GOVUK.Analytics.PIISafe`
263
+ object. If any argument to an analytics function is an instance of one of these
264
+ objects the value contained within will be extracted and sent directly to the
265
+ analytics tracker without attempting to strip PII from it. For example:
266
+
267
+ ```js
268
+ GOVUK.analytics.setDimension(1, new GOVUK.Analytics.PIISafe('this-is-not-an@email-address-but-it-looks-like-one'));
269
+ GOVUK.analytics.trackEvent('report title clicked', new GOVUK.Analytics.PIISafe('this report title looks like it contains a P0 5TC ode but it does not really'));
270
+ ````
@@ -0,0 +1,62 @@
1
+ ## Functions
2
+
3
+ * [`_helpers.scss`](#helpers)
4
+
5
+ ### <a id="helpers"></a>Helpers
6
+
7
+ The pixel-to-em or `pem` function returns an em value.
8
+
9
+ It sets a Sass variable, $base-font-size, to 16.
10
+
11
+ A value in em is defined as em = target/context.
12
+
13
+ #### Usage:
14
+
15
+ Here the default context is 16 ($base-font-size),
16
+ so there is no need to use a second argument.
17
+
18
+ ```
19
+
20
+ .govuk-title {
21
+ margin-top: pem(30);
22
+ }
23
+
24
+ Compiled css:
25
+
26
+ .govuk-title {
27
+ margin-top: 1.875em;
28
+ }
29
+
30
+ ```
31
+
32
+ The first argument will also accept pixel units.
33
+
34
+ ```
35
+ .govuk-title {
36
+ margin-top: pem(19px);
37
+ }
38
+
39
+ Compiled css:
40
+
41
+ .govuk-title {
42
+ margin-top: 1.1875em;
43
+ }
44
+
45
+ ```
46
+
47
+ If the context changes, use the second argument.
48
+
49
+ ```
50
+ .govuk-title {
51
+ font-size: 48px;
52
+ }
53
+
54
+ .govuk-title-child {
55
+ margin-top: pem(15, 48);
56
+ }
57
+
58
+ Compiled css:
59
+
60
+ .govuk-title-child {
61
+ margin-top: 0.3125em;
62
+ }