govuk_frontend_toolkit 0.41.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. data/.gitignore +3 -0
  2. data/.gitmodules +3 -0
  3. data/CONTRIBUTING.md +13 -0
  4. data/Gemfile +4 -0
  5. data/LICENCE +20 -0
  6. data/README.md +46 -0
  7. data/Rakefile +16 -0
  8. data/app/assets/.gitignore +1 -0
  9. data/app/assets/.travis.yml +3 -0
  10. data/app/assets/CONTRIBUTING.md +18 -0
  11. data/app/assets/Gruntfile.js +19 -0
  12. data/app/assets/LICENCE +20 -0
  13. data/app/assets/README.md +675 -0
  14. data/app/assets/images/crests/bis_crest_13px.png +0 -0
  15. data/app/assets/images/crests/bis_crest_13px_x2.png +0 -0
  16. data/app/assets/images/crests/bis_crest_18px.png +0 -0
  17. data/app/assets/images/crests/bis_crest_18px_x2.png +0 -0
  18. data/app/assets/images/crests/bis_crest_27px.png +0 -0
  19. data/app/assets/images/crests/bis_crest_27px_x2.png +0 -0
  20. data/app/assets/images/crests/coastguard_13px.png +0 -0
  21. data/app/assets/images/crests/coastguard_13px_x2.png +0 -0
  22. data/app/assets/images/crests/coastguard_18px.png +0 -0
  23. data/app/assets/images/crests/coastguard_18px_x2.png +0 -0
  24. data/app/assets/images/crests/coastguard_27px.png +0 -0
  25. data/app/assets/images/crests/coastguard_27px_x2.png +0 -0
  26. data/app/assets/images/crests/hmrc_crest_13px.png +0 -0
  27. data/app/assets/images/crests/hmrc_crest_13px_x2.png +0 -0
  28. data/app/assets/images/crests/hmrc_crest_18px.png +0 -0
  29. data/app/assets/images/crests/hmrc_crest_18px_x2.png +0 -0
  30. data/app/assets/images/crests/hmrc_crest_27px.png +0 -0
  31. data/app/assets/images/crests/hmrc_crest_27px_x2.png +0 -0
  32. data/app/assets/images/crests/ho_crest_13px.png +0 -0
  33. data/app/assets/images/crests/ho_crest_13px_x2.png +0 -0
  34. data/app/assets/images/crests/ho_crest_18px.png +0 -0
  35. data/app/assets/images/crests/ho_crest_18px_x2.png +0 -0
  36. data/app/assets/images/crests/ho_crest_27px.png +0 -0
  37. data/app/assets/images/crests/ho_crest_27px_x2.png +0 -0
  38. data/app/assets/images/crests/mod_crest_13px.png +0 -0
  39. data/app/assets/images/crests/mod_crest_13px_x2.png +0 -0
  40. data/app/assets/images/crests/mod_crest_18px.png +0 -0
  41. data/app/assets/images/crests/mod_crest_18px_x2.png +0 -0
  42. data/app/assets/images/crests/mod_crest_27px.png +0 -0
  43. data/app/assets/images/crests/mod_crest_27px_x2.png +0 -0
  44. data/app/assets/images/crests/org_crest_13px.png +0 -0
  45. data/app/assets/images/crests/org_crest_13px_x2.png +0 -0
  46. data/app/assets/images/crests/org_crest_18px.png +0 -0
  47. data/app/assets/images/crests/org_crest_18px_x2.png +0 -0
  48. data/app/assets/images/crests/org_crest_27px.png +0 -0
  49. data/app/assets/images/crests/org_crest_27px_x2.png +0 -0
  50. data/app/assets/images/crests/portcullis_13px.png +0 -0
  51. data/app/assets/images/crests/portcullis_13px_x2.png +0 -0
  52. data/app/assets/images/crests/portcullis_18px.png +0 -0
  53. data/app/assets/images/crests/portcullis_18px_x2.png +0 -0
  54. data/app/assets/images/crests/portcullis_27px.png +0 -0
  55. data/app/assets/images/crests/portcullis_27px_x2.png +0 -0
  56. data/app/assets/images/crests/so_crest_13px.png +0 -0
  57. data/app/assets/images/crests/so_crest_13px_x2.png +0 -0
  58. data/app/assets/images/crests/so_crest_18px.png +0 -0
  59. data/app/assets/images/crests/so_crest_18px_x2.png +0 -0
  60. data/app/assets/images/crests/so_crest_27px.png +0 -0
  61. data/app/assets/images/crests/so_crest_27px_x2.png +0 -0
  62. data/app/assets/images/crests/ukaea_crest_13px.png +0 -0
  63. data/app/assets/images/crests/ukaea_crest_13px_x2.png +0 -0
  64. data/app/assets/images/crests/ukaea_crest_18px.png +0 -0
  65. data/app/assets/images/crests/ukaea_crest_18px_x2.png +0 -0
  66. data/app/assets/images/crests/ukaea_crest_27px.png +0 -0
  67. data/app/assets/images/crests/ukaea_crest_27px_x2.png +0 -0
  68. data/app/assets/images/crests/ukho_13px.png +0 -0
  69. data/app/assets/images/crests/ukho_13px_x2.png +0 -0
  70. data/app/assets/images/crests/ukho_18px.png +0 -0
  71. data/app/assets/images/crests/ukho_18px_x2.png +0 -0
  72. data/app/assets/images/crests/ukho_27px.png +0 -0
  73. data/app/assets/images/crests/ukho_27px_x2.png +0 -0
  74. data/app/assets/images/crests/wales_crest_13px.png +0 -0
  75. data/app/assets/images/crests/wales_crest_13px_x2.png +0 -0
  76. data/app/assets/images/crests/wales_crest_18px.png +0 -0
  77. data/app/assets/images/crests/wales_crest_18px_x2.png +0 -0
  78. data/app/assets/images/crests/wales_crest_27px.png +0 -0
  79. data/app/assets/images/crests/wales_crest_27px_x2.png +0 -0
  80. data/app/assets/images/external-links/external-link-24x24.png +0 -0
  81. data/app/assets/images/external-links/external-link-black-12x12.png +0 -0
  82. data/app/assets/images/external-links/external-link-black-24x24.png +0 -0
  83. data/app/assets/images/external-links/external-link.png +0 -0
  84. data/app/assets/images/icon-steps/icon-step-1-2x.png +0 -0
  85. data/app/assets/images/icon-steps/icon-step-1.png +0 -0
  86. data/app/assets/images/icon-steps/icon-step-10-2x.png +0 -0
  87. data/app/assets/images/icon-steps/icon-step-10.png +0 -0
  88. data/app/assets/images/icon-steps/icon-step-11-2x.png +0 -0
  89. data/app/assets/images/icon-steps/icon-step-11.png +0 -0
  90. data/app/assets/images/icon-steps/icon-step-12-2x.png +0 -0
  91. data/app/assets/images/icon-steps/icon-step-12.png +0 -0
  92. data/app/assets/images/icon-steps/icon-step-13-2x.png +0 -0
  93. data/app/assets/images/icon-steps/icon-step-13.png +0 -0
  94. data/app/assets/images/icon-steps/icon-step-14-2x.png +0 -0
  95. data/app/assets/images/icon-steps/icon-step-14.png +0 -0
  96. data/app/assets/images/icon-steps/icon-step-2-2x.png +0 -0
  97. data/app/assets/images/icon-steps/icon-step-2.png +0 -0
  98. data/app/assets/images/icon-steps/icon-step-3-2x.png +0 -0
  99. data/app/assets/images/icon-steps/icon-step-3.png +0 -0
  100. data/app/assets/images/icon-steps/icon-step-4-2x.png +0 -0
  101. data/app/assets/images/icon-steps/icon-step-4.png +0 -0
  102. data/app/assets/images/icon-steps/icon-step-5-2x.png +0 -0
  103. data/app/assets/images/icon-steps/icon-step-5.png +0 -0
  104. data/app/assets/images/icon-steps/icon-step-6-2x.png +0 -0
  105. data/app/assets/images/icon-steps/icon-step-6.png +0 -0
  106. data/app/assets/images/icon-steps/icon-step-7-2x.png +0 -0
  107. data/app/assets/images/icon-steps/icon-step-7.png +0 -0
  108. data/app/assets/images/icon-steps/icon-step-8-2x.png +0 -0
  109. data/app/assets/images/icon-steps/icon-step-8.png +0 -0
  110. data/app/assets/images/icon-steps/icon-step-9-2x.png +0 -0
  111. data/app/assets/images/icon-steps/icon-step-9.png +0 -0
  112. data/app/assets/images/player-icon-forward.png +0 -0
  113. data/app/assets/images/player-icon-pause.png +0 -0
  114. data/app/assets/images/player-icon-play.png +0 -0
  115. data/app/assets/images/player-icon-rewind.png +0 -0
  116. data/app/assets/images/player-icon-volume.png +0 -0
  117. data/app/assets/javascripts/govuk/multivariate-test.js +101 -0
  118. data/app/assets/javascripts/govuk/stop-scrolling-at-footer.js +138 -0
  119. data/app/assets/javascripts/govuk_toolkit.js +1 -0
  120. data/app/assets/javascripts/stageprompt.js +63 -0
  121. data/app/assets/javascripts/vendor/jquery/jquery.player.min.js +25 -0
  122. data/app/assets/jenkins.sh +5 -0
  123. data/app/assets/package.json +14 -0
  124. data/app/assets/spec/MultivariateTestSpec.js +166 -0
  125. data/app/assets/stylesheets/.gitkeep +0 -0
  126. data/app/assets/stylesheets/_colours.scss +104 -0
  127. data/app/assets/stylesheets/_conditionals.scss +85 -0
  128. data/app/assets/stylesheets/_css3.scss +61 -0
  129. data/app/assets/stylesheets/_device-pixels.scss +11 -0
  130. data/app/assets/stylesheets/_font_stack.scss +40 -0
  131. data/app/assets/stylesheets/_measurements.scss +7 -0
  132. data/app/assets/stylesheets/_shims.scss +57 -0
  133. data/app/assets/stylesheets/_typography.scss +400 -0
  134. data/app/assets/stylesheets/design-patterns/_alpha-beta.scss +49 -0
  135. data/app/assets/stylesheets/design-patterns/_buttons.scss +142 -0
  136. data/app/assets/stylesheets/design-patterns/_media-player.scss +232 -0
  137. data/govuk_frontend_toolkit.gemspec +50 -0
  138. data/jenkins.sh +8 -0
  139. data/lib/govuk_frontend_toolkit.rb +4 -0
  140. data/lib/govuk_frontend_toolkit/engine.rb +4 -0
  141. data/lib/govuk_frontend_toolkit/version.rb +3 -0
  142. metadata +273 -0
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ Gemfile.lock
2
+ .bundle
3
+ *.gem
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "app/assets"]
2
+ path = app/assets
3
+ url = https://github.com/alphagov/govuk_frontend_toolkit.git
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,13 @@
1
+ # Contribution Guidelines
2
+
3
+ We welcome patches to the toolkit, as long as you follow these
4
+ guidelines:
5
+
6
+ ## Indentation and whitespace
7
+
8
+ 2-space, soft-tabs only. No trailing whitespace.
9
+
10
+ ## Versioning
11
+
12
+ We use [semantic versioning](http://semver.org/), and bump the version
13
+ on master only. Please don't submit your own proposed version numbers.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ source 'https://BnrJb6FZyzspBboNJzYZ@gem.fury.io/govuk/'
3
+
4
+ gemspec
data/LICENCE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 HM Government
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.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # GOV.UK Frontend Toolkit
2
+
3
+ A gem wrapper around the [govuk_frontend_toolkit](http://github.com/alphagov/govuk_frontend_toolkit).
4
+
5
+ ## Installing
6
+
7
+ Just include `govuk_frontend_toolkit` in your `Gemfile`. It
8
+ automatically attaches itself to your asset path so the static/SCSS
9
+ files will be available to the asset pipeline.
10
+
11
+ You will need to check that the gem is included while in development. Often
12
+ asset related gems are in a bundler group called `assets`. Old Rails projects
13
+ do not inluded this in development by default so you need to ensure bundler is
14
+ included using the following lines at the top of the `/config/application.rb`:
15
+
16
+ if defined?(Bundler)
17
+ # If you precompile assets before deploying to production, use this line
18
+ Bundler.require *Rails.groups(assets: %w(development test))
19
+ # If you want your assets lazily compiled in production, use this line
20
+ # Bundler.require(:default, :assets, Rails.env)
21
+ end
22
+
23
+ You will also need to ensure that the correct assets are precompiled for
24
+ production. These are set using the variable `config.assets.precompile` in
25
+ `/config/application.rb`. An example of what this may look like is:
26
+
27
+ config.assets.precompile += %w(
28
+ application.css
29
+ application-ie8.css
30
+ application-ie7.css
31
+ application-ie6.css
32
+ application.js
33
+ )
34
+
35
+ ## Usage
36
+
37
+ At the top of a Sass file in your Rails project you should use an `@import` rule
38
+ to include the file for the mixins you require. For example if you want the
39
+ conditionals and typography mixins you should add:
40
+
41
+ @import '_conditionals';
42
+ @import '_typography';
43
+
44
+ ## Licence
45
+
46
+ Released under the MIT Licence, a copy of which can be found in the file `LICENCE`.
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $:.unshift lib unless $:.include?(lib)
3
+
4
+ require "rake"
5
+
6
+ require "gem_publisher"
7
+ task :publish_gem do |t|
8
+ gem = GemPublisher.publish_if_updated("govuk_frontend_toolkit.gemspec", :gemfury, :as => 'govuk')
9
+ puts "Published #{gem}" if gem
10
+ end
11
+
12
+ task :test do |t|
13
+ true
14
+ end
15
+
16
+ task :default => :test
@@ -0,0 +1 @@
1
+ node_modules/
@@ -0,0 +1,3 @@
1
+ language: node_js
2
+ node_js:
3
+ - "0.10"
@@ -0,0 +1,18 @@
1
+ # Contribution Guidelines
2
+
3
+ We welcome patches to the toolkit, as long as you follow these
4
+ guidelines:
5
+
6
+ ## Indentation and whitespace
7
+
8
+ 2-space, soft-tabs only. No trailing whitespace.
9
+
10
+ ## Versioning
11
+
12
+ We use [semantic versioning](http://semver.org/), and bump the version
13
+ on master only. Please don't submit your own proposed version numbers.
14
+
15
+ ## Commit hygiene
16
+
17
+ Please see our [git style guide](https://github.com/alphagov/styleguides/blob/master/git.md)
18
+ which describes how we prefer git history and commit messages to read.
@@ -0,0 +1,19 @@
1
+ module.exports = function(grunt) {
2
+ grunt.initConfig({
3
+ jasmine: {
4
+ javascripts: {
5
+ src: [
6
+ 'node_modules/jquery-browser/lib/jquery.js',
7
+ 'javascripts/**/*.js',
8
+ ],
9
+ options: {
10
+ specs: 'spec/*Spec.js',
11
+ helpers: 'spec/*Helper.js'
12
+ }
13
+ }
14
+ }
15
+ });
16
+ grunt.loadNpmTasks('grunt-contrib-jasmine');
17
+ grunt.registerTask('test', ['jasmine']);
18
+ grunt.registerTask('default', ['test']);
19
+ };
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 HM Government
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,675 @@
1
+ # GOV.UK Frontend Toolkit
2
+
3
+ A collection of Sass and Javascript tools for generating frontend
4
+ code.
5
+
6
+ ## Installing
7
+
8
+ ### Ruby on Rails
9
+
10
+ We recommend you use the [govuk_frontend_toolkit_gem][toolkit_gem_github] and
11
+ follow the [installation instructions][toolkit_gem_github_readme].
12
+
13
+ [toolkit_gem_github]: https://github.com/alphagov/govuk_frontend_toolkit_gem
14
+ [toolkit_gem_github_readme]: https://github.com/alphagov/govuk_frontend_toolkit_gem#readme
15
+
16
+ ### Node.js
17
+
18
+ [govuk_frontend_toolkit_npm][toolkit_npm_github] is an NPM package that can be
19
+ [installed or included in your package.json][toolkit_npm].
20
+
21
+ [toolkit_npm_github]: https://github.com/alphagov/govuk_frontend_toolkit_npm
22
+ [toolkit_npm]: https://npmjs.org/package/govuk_frontend_toolkit
23
+
24
+ ### Other projects
25
+
26
+ You can include the toolkit as a [git submodule][].
27
+
28
+ [git submodule]: https://www.kernel.org/pub/software/scm/git/docs/git-submodule.html
29
+
30
+ To add the submodule to your project run the following command substituting the path to a subdirectory in your project's assets directory:
31
+
32
+ $ git submodule add https://github.com/alphagov/govuk_frontend_toolkit.git ./path/to/assets/govuk_toolkit
33
+
34
+ We recommend you use `https` rather than `ssh` for submodules as they don't require key exchanges when deploying to remote servers.
35
+
36
+ If you clone a project with the toolkit submodule installed you will need to initialise the submodule with the following command:
37
+
38
+ $ git submodule init
39
+
40
+ To update the toolkit to the latest version you can use:
41
+
42
+ $ git submodule update
43
+
44
+ ## Running tests
45
+
46
+ Install Node 0.8 or higher and PhantomJS.
47
+
48
+ $ npm install
49
+ $ npm test
50
+
51
+ ## Usage
52
+
53
+ At the top of a Sass file in your project you should use an `@import` rule
54
+ to include the file for the mixins you require, eg if you want the
55
+ conditionals and typography mixins you should add:
56
+
57
+ @import '_conditionals';
58
+ @import '_typography';
59
+
60
+ You may need to include the relative path to the toolkit if it is installed as a submodule:
61
+
62
+ @import '../toolkit/_conditionals';
63
+
64
+ 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.
65
+
66
+ In development:
67
+
68
+ sass --style expanded --line-numbers --load-path [path to]/govuk_toolkit/stylesheets input.scss output.css
69
+
70
+ In production:
71
+
72
+ sass --style compressed --load-path [path to]/govuk_toolkit/stylesheets input.scss output.css
73
+
74
+
75
+
76
+ ## Mixin-sets
77
+
78
+ * [`_colours.scss`](#colours)
79
+ * [`_conditionals.scss`](#conditionals)
80
+ * [`_css3.scss`](#css3)
81
+ * [`_typography.scss`](#typography)
82
+ * [`design-patterns/_buttons.scss`](#buttons)
83
+ * [`design-patterns/_alpha-beta.scss`](#alpha-beta)
84
+
85
+ ### <a id="conditionals"></a>Conditionals
86
+
87
+ Media query and IE helpers. These make producing responsive layouts and
88
+ attaching IE specific styles to elements really easy.
89
+
90
+ To use the IE conditionals you will need to add extra stylesheets for each IE which look like:
91
+
92
+ // BASE STYLESHEET FOR IE 6 COMPILER
93
+
94
+ $is-ie: true;
95
+ $ie-version: 6;
96
+
97
+ @import "application.scss";
98
+
99
+ Where `application.scss` is the name of your base stylesheet.
100
+
101
+ #### media
102
+
103
+ ##### Description
104
+
105
+ `@mixin media($size: false, $max-width: false, $min-width: false)`
106
+
107
+ ##### Parameters
108
+
109
+ ***note: the parameters are mutually exclusive and the first one found will be
110
+ used.***
111
+
112
+ `$size`
113
+
114
+ `size` can be one of `desktop`, `tablet`, `mobile`. `desktop` and `tablet`
115
+ should be used to add styles to a mobile first stylesheet. `mobile` should be
116
+ used to add styles to a desktop first stylesheet.
117
+
118
+ It is recommended that you primarily use `desktop` for new stylesheets to
119
+ enhance mobile first when serving to mobile devices.
120
+
121
+ `$min-width`
122
+ `$max-width`
123
+
124
+ These should be set to an absolute pixel value. They will get added directly to
125
+ their respective @media queries.
126
+
127
+ `$ignore-for-ie`
128
+
129
+ Styles that would normally be wrapped in @media queries by this mixin will be instead
130
+ added to the main block if the `$is-ie` variable is true.
131
+
132
+ Setting `$ignore-for-ie` to `true` means those styles will not be added.
133
+
134
+ ##### Usage
135
+
136
+ div.columns {
137
+ border: 1px solid;
138
+
139
+ @include media(desktop){
140
+ width: 30%;
141
+ float: left;
142
+ }
143
+ @include media($min-width: 500px){
144
+ width: 25%;
145
+ }
146
+ @include media($max-width: 400px){
147
+ width: 25%;
148
+ }
149
+ }
150
+
151
+ #### ie-lte
152
+
153
+ Conditially send CSS to IE browsers less than or equal to the named version.
154
+
155
+ ##### Description
156
+
157
+ `@include ie-lte($version)`
158
+
159
+ ##### Parameters
160
+
161
+ `$version`
162
+
163
+ `version` is an integer value. Possible values are `6`, `7`, `8`.
164
+
165
+ ##### Usage
166
+
167
+ div.columns {
168
+ border: 1px solid;
169
+
170
+ @include ie-lte(7){
171
+ border: 0;
172
+ }
173
+ }
174
+
175
+
176
+ #### ie
177
+
178
+ Send CSS to a named IE version.
179
+
180
+ ##### Description
181
+
182
+ `@include ie($version)`
183
+
184
+ ##### Parameters
185
+
186
+ `$version`
187
+
188
+ `version` is an integer value. Possible values are `6`, `7`, `8`.
189
+
190
+ ##### Usage
191
+
192
+ div.columns {
193
+ border: 1px solid;
194
+
195
+ @include ie(6){
196
+ border: 0;
197
+ }
198
+ }
199
+
200
+ ### <a id="colours"></a>Colours
201
+
202
+ A collection of colour variables.
203
+
204
+ #### Departmental colours
205
+
206
+ * `$treasury` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #af292e" />
207
+ * `$cabinet-office` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #005abb" />
208
+ * `$department-for-education` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #003a69" />
209
+ * `$department-for-transport` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #006c56" />
210
+ * `$home-office` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #9325b2" />
211
+ * `$department-of-health` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #00ad93" />
212
+ * `$ministry-of-justice` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #231f20" />
213
+ * `$ministry-of-defence` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #4d2942" />
214
+ * `$foreign-and-commonwealth-office` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #003e74" />
215
+ * `$department-for-communities-and-local-government` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #00857e" />
216
+ * `$department-for-energy-and-climate-change` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #009ddb" />
217
+ * `$department-for-culture-media-and-sport` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #d40072" />
218
+ * `$department-for-environment-food-and-rural-affairs` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #898700" />
219
+ * `$department-for-work-and-pensions` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #00beb7" />
220
+ * `$department-for-business-innovation-and-skills` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #003479" />
221
+ * `$department-for-international-development` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #002878" />
222
+ * `$government-equalities-office` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #9325b2" />
223
+ * `$attorney-generals-office` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #9f1888" />
224
+ * `$scotland-office` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #002663" />
225
+ * `$wales-office` <span style="display:inline-block; width: 60px; height: 10px; float: right; background-color: #a33038" />
226
+
227
+ #### Standard palette, colours
228
+
229
+ * `$purple` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #2e358b" />
230
+ * `$purple-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #9799c4" />
231
+ * `$purple-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #d5d6e7" />
232
+ * `$mauve` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #6f72af" />
233
+ * `$mauve-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #b7b9d7" />
234
+ * `$mauve-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #e2e2ef" />
235
+ * `$fuschia` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #912b88" />
236
+ * `$fuschia-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #c994c3" />
237
+ * `$fuschia-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #e9d4e6" />
238
+ * `$pink` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #d53880" />
239
+ * `$pink-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #eb9bbe" />
240
+ * `$pink-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #f6d7e5" />
241
+ * `$baby-pink` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #f499be" />
242
+ * `$baby-pink-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #faccdf" />
243
+ * `$baby-pink-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #fdebf2" />
244
+ * `$red` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #b10e1e" />
245
+ * `$red-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #d9888c" />
246
+ * `$red-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #efcfd1" />
247
+ * `$mellow-red` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #df3034" />
248
+ * `$mellow-red-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #ef9998" />
249
+ * `$mellow-red-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #f9d6d6" />
250
+ * `$orange` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #f47738" />
251
+ * `$orange-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #fabb96" />
252
+ * `$orange-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #fde4d4" />
253
+ * `$brown` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #b58840" />
254
+ * `$brown-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #dac39c" />
255
+ * `$brown-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #f0e7d7" />
256
+ * `$yellow` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #ffbf47" />
257
+ * `$yellow-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #ffdf94" />
258
+ * `$yellow-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #fff2d3" />
259
+ * `$grass-green` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #85994b" />
260
+ * `$grass-green-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #c2cca3" />
261
+ * `$grass-green-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #e7ebda" />
262
+ * `$green` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #006435" />
263
+ * `$green-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #7fb299" />
264
+ * `$green-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #cce0d6" />
265
+ * `$turquoise` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #28a197" />
266
+ * `$turquoise-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #95d0cb" />
267
+ * `$turquoise-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #d5ecea" />
268
+ * `$light-blue` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #2b8cc4" />
269
+ * `$light-blue-50` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #96c6e2" />
270
+ * `$light-blue-25` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #d5e8f3" />
271
+
272
+ #### Standard palette, greys
273
+
274
+ * `$black` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #0b0c0c" />
275
+ * `$grey-1` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #6f777b" />
276
+ * `$grey-2` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #bfc1c3" />
277
+ * `$grey-3` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #dee0e2" />
278
+ * `$grey-4` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #f8f8f8" />
279
+ * `$white` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #fff" />
280
+
281
+ #### Semantic colour names
282
+
283
+ * `$link-colour` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #2e3191" />
284
+ * `$link-active-colour` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #2e8aca" />
285
+ * `$link-hover-colour` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #2e8aca" />
286
+ * `$link-visited-colour` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #2e3191" />
287
+ * `$text-colour: $black` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #0b0c0c" />
288
+ * `$secondary-text-colour` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #6f777b" />
289
+ * `$border-colour` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #bfc1c3" />
290
+ * `$panel-colour` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #dee0e2" />
291
+ * `$canvas-colour` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #f8f8f8" />
292
+ * `$highlight-colour` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #f8f8f8" />
293
+ * `$page-colour` <span style="display: inline-block; width: 60px; height: 10px; float: right; background-color: #fff" />
294
+
295
+ #### Usage:
296
+
297
+ .column {
298
+ background: $green;
299
+ }
300
+
301
+ ### <a id="typography"></a>Typography
302
+
303
+ A collection of font-mixins. There are two different types of font mixins.
304
+
305
+ 1. Heading and Copy styles which are the font with added paddings to ensure a
306
+ consistent baseline vertical grid.
307
+ 2. Core styles which are base font styles with no extra padding.
308
+
309
+ #### Heading and Copy styles
310
+
311
+ The following heading and copy styles exist:
312
+
313
+ * `heading-80`
314
+ * `heading-48`
315
+ * `heading-36`
316
+ * `heading-27`
317
+ * `heading-24`
318
+ * `copy-19`
319
+ * `copy-16`
320
+ * `copy-14`
321
+
322
+ ##### Usage
323
+
324
+ h2 {
325
+ @include heading-27;
326
+ }
327
+
328
+ #### Core styles
329
+
330
+ The following core styles exist:
331
+
332
+ * `core-80`
333
+ * `core-48`
334
+ * `core-36`
335
+ * `core-27`
336
+ * `core-24`
337
+ * `core-19`
338
+ * `core-16`
339
+ * `core-14`
340
+
341
+ ##### Description
342
+
343
+ `@include core-[size]($line-height, $line-height-640)`
344
+
345
+ ##### Parameters
346
+
347
+ `$line-height` and `$line-height-640` are both optional. When used it is
348
+ recomended to pass a fraction in for readability.
349
+
350
+ ##### Usage
351
+
352
+ h1 {
353
+ @include core-48;
354
+ }
355
+ h2 {
356
+ @include core-24($line-height: (50/24), $line-height-640: (18/16));
357
+ }
358
+
359
+ #### Tabular numbers
360
+
361
+ Tabular numbers have numerals of a standard fixed width. As all numbers have the same width, sets of numbers may be more easily compared. We recommend using them where different numbers are likely to be compared, or where different numbers should line up with each other, eg in tables.
362
+
363
+ `$tabular-numbers` is an optional variable that may be passed to the heading, copy and core styles to use (or explicitly not use) tabular numbers. When no variable is passed, the default is non-tabular.
364
+
365
+ ##### Usage
366
+
367
+ h1 {
368
+ @include core-48;
369
+ }
370
+ h2 {
371
+ @include core-24($tabular-numbers: true);
372
+ }
373
+
374
+ #### external links
375
+
376
+ `external-link-default` sets up the background image for all external links.
377
+ This should be included on the default link style for a project.
378
+
379
+ After setting the default, apply includes from the following for different font sizes:
380
+
381
+ * `external-link-12`
382
+ * `external-link-12-no-hover`
383
+ * `external-link-13`
384
+ * `external-link-13-no-hover`
385
+ * `external-link-14`
386
+ * `external-link-14-bold-no-hover`
387
+ * `external-link-16`
388
+ * `external-link-16-bold-no-hover`
389
+ * `external-link-19`
390
+ * `external-link-19-no-hover`
391
+
392
+ `external-link-heading` is a unique style a background image for headings to groups of external links.
393
+
394
+ #### Description
395
+
396
+ For a set style:
397
+
398
+ `@include external-link-[style]`
399
+
400
+ For a specific font size:
401
+
402
+ `@include external-link-[size]-[weight]-[no-hover]`
403
+
404
+ #### Usage
405
+
406
+ /* Default link style */
407
+ a[rel="external"] {
408
+ @include external-link-default;
409
+ @include external-link-19;
410
+ }
411
+
412
+ th.external-link {
413
+ @include external-link-heading;
414
+ }
415
+
416
+ .inner a[rel="external"] {
417
+ @include external-link-16;
418
+ }
419
+
420
+ .departments a[rel="external"] {
421
+ @include external-link-16-bold-no-hover;
422
+ }
423
+
424
+ ### <a id="css3"></a>css3
425
+
426
+ CSS3 helpers to abstract vendor prefixes.
427
+
428
+ #### border-radius
429
+
430
+ ##### Description
431
+
432
+ `@mixin border-radius($radius)`
433
+
434
+ ##### Parameters
435
+
436
+ `$radius` a pixel value.
437
+
438
+ ##### Usage
439
+
440
+ .column {
441
+ @include border-radius(5px);
442
+ }
443
+
444
+ #### box-shadow
445
+
446
+ ##### Description
447
+
448
+ `@mixin box-shadow($shadow)`
449
+
450
+ ##### Parameters
451
+
452
+ `$shadow` a value set to pass into [`box-shadow`](https://developer.mozilla.org/en-US/docs/CSS/box-shadow).
453
+
454
+ ##### Usage
455
+
456
+ .column {
457
+ @include box-shadow(0 0 5px black);
458
+ }
459
+
460
+ #### translate
461
+
462
+ ##### Description
463
+
464
+ `@mixin translate($x, $y)`
465
+
466
+ ##### Parameters
467
+
468
+ `$x` and `$y` are css values.
469
+
470
+ ##### Usage
471
+
472
+ .column {
473
+ @include translate(2px, 3px);
474
+ }
475
+
476
+ #### gradient
477
+
478
+ This can currently only handle linear top to bottom gradients.
479
+
480
+ ##### Description
481
+
482
+ `@mixin gradient($from, $to)`
483
+
484
+ ##### Parameters
485
+
486
+ `$from` and `$to` are colour values.
487
+
488
+ ##### Usage
489
+
490
+ .column {
491
+ @include gradient(#000, #fff);
492
+ }
493
+
494
+ #### transition
495
+
496
+ ##### Description
497
+
498
+ `@mixin transition($property, $duration, $function, $delay:0s)`
499
+
500
+ ##### Parameters
501
+
502
+ Match up with the respective properties from [`transition`](https://developer.mozilla.org/en-US/docs/CSS/transition).
503
+
504
+ ##### Usage
505
+
506
+ .column {
507
+ @include transition(left, 3s, ease);
508
+ }
509
+
510
+ #### box-sizing
511
+
512
+ ##### Description
513
+
514
+ `@mixin box-sizing($type)`
515
+
516
+ ##### Parameters
517
+
518
+ `$type` is one of `border-box`, `content-box` and `padding-box`.
519
+
520
+ ##### Usage
521
+
522
+ .column {
523
+ @include box-sizing(border-box);
524
+ }
525
+
526
+ #### calc
527
+
528
+ ##### Description
529
+
530
+ `@mixin calc($property, $calc)`
531
+
532
+ ##### Parameters
533
+
534
+ `$property` the property to apply the calc to.
535
+ `$calc` the calculation to.
536
+
537
+ ##### Usage
538
+
539
+ .column {
540
+ @include calc(width, "300% - 20px");
541
+ }
542
+
543
+ ### <a id="buttons"></a>Buttons
544
+
545
+ A mixin for creating buttons in the GOV.UK style.
546
+
547
+ ##### Description
548
+
549
+ `@mixin button($colour)`
550
+
551
+ ##### Parameters
552
+
553
+ `$colour` the background colour of the button (default is `$green`).
554
+
555
+ ##### Usage
556
+
557
+ .button{
558
+ @include button;
559
+ }
560
+ .button-secondary{
561
+ @include button($grey-3);
562
+ }
563
+ .button-warning{
564
+ @include button($red);
565
+ }
566
+
567
+ ##### Notes
568
+
569
+ The button text colour is set by the mixin to either light or dark, depending on the button background colour.
570
+
571
+ If you're applying these styles to non form elements, adding a class of 'disabled' to the element will emulate the disabled button style.
572
+
573
+ ### <a id="alpha-beta"></a>Alpha/Beta
574
+
575
+ Mixins for creating alpha/beta banners and tags for services on GOV.UK
576
+
577
+ ##### Description
578
+
579
+ `@mixin phase-banner($state)`
580
+ `@mixin phase-tag($state)`
581
+
582
+ ##### Parameters
583
+
584
+ `$state` either `alpha` or `beta`. This will set the background colour of the element to the appropriate colour.
585
+
586
+ ##### Usage
587
+
588
+ .alpha-banner {
589
+ @include phase-banner(alpha);
590
+ }
591
+ .beta-banner {
592
+ @include phase-banner(beta);
593
+ }
594
+ .beta-tag{
595
+ @include phase-tag(beta);
596
+ }
597
+
598
+ ## JavaScript
599
+
600
+ The gem also includes some JavaScript which by itself will have no effect on a
601
+ page. It can be included with the asset_pipeline by adding the line:
602
+
603
+ //=require govuk_toolkit
604
+
605
+ ## Media player
606
+
607
+ There is a forked version of the Nomensa video player included and custom
608
+ GOV.UK styles to be used with it. To use it you will need to include the script
609
+ on your page and include the styles nested under an appropriate selector. For
610
+ example:
611
+
612
+ @import "design-patterns/media-player";
613
+
614
+ .media-player {
615
+ @include media-player;
616
+ }
617
+
618
+ You will also need to create your own initalizer to target the links you want
619
+ to turn into videoss. There are examples of how this works in the [Nomensa
620
+ Accesible Media Player][nomensa] repository.
621
+
622
+ [nomensa]: https://github.com/nomensa/Accessible-Media-Player/tree/master/example
623
+
624
+ ## Multivariate test framework
625
+
626
+ `GOVUK.MultiVariateTest` runs split tests to display different content, layouts etc to users.
627
+
628
+ It randomly assigns a user a cohort on first execution by setting a cookie, and on every execution sets a session level custom variable on Google Analytics to mark which cohort a user is in. This can be used to segment users in GA.
629
+
630
+ A simple content replacement test can be done by defining a set of cohorts with content. E.g.:
631
+
632
+ ```javascript
633
+ var test = new GOVUK.MultivariateTest({
634
+ el: '.car-tax-button',
635
+ name: 'car_tax_button_text',
636
+ customVarIndex: 555,
637
+ cohorts: {
638
+ pay_your_car_tax: {html: "Pay Your Car Tax"},
639
+ give_us_money: {html: "Give Us Money Or We Will Crush Your Car"},
640
+ }
641
+ });
642
+ ```
643
+
644
+ A more complex test can be done by defining callbacks for what to do
645
+ when a user is in each cohort:
646
+
647
+ ```javascript
648
+ var test = new GOVUK.MultivariateTest({
649
+ name: 'car_tax_button_text',
650
+ customVarIndex: 555,
651
+ cohorts: {
652
+ pay_your_car_tax: {callback: function() { ... }},
653
+ give_us_money: {callback: function() { ... }},
654
+ }
655
+ });
656
+ ```
657
+
658
+ If you have a complex test, it may be worth extending MultivariateTest with
659
+ your own. Callbacks can be strings which will call a method of that name
660
+ on the current object.
661
+
662
+ Takes these options:
663
+ - `el`: Element to run this test on (optional)
664
+ - `name`: The name of the text (alphanumeric and underscores)
665
+ - `customVarIndex`: The index of the custom variable in Google Analytics. GA only gives 50 integer slots to each account, and it is important that a unique integer is assigned to each test. Current contact for assigning a custom var slot for GOV.UK is: Ashraf Chohan <ashraf.chohan@digital.cabinet-office.gov.uk>
666
+ - `cohorts`: An object that maps cohort name to an object that defines the cohort. Name must be same format as test name. Object contains keys (both optional):
667
+ - `html`: HTML to fill element with when this cohort is picked.
668
+ - `callback`: Function to call when this cohort is chosen. If it is a string, that method on the test object is called.
669
+
670
+ Full documentation on how to design multivariate tests, use the data in GA and construct hypothesis tests is on its way soon.
671
+
672
+
673
+ ## Licence
674
+
675
+ Released under the MIT Licence, a copy of which can be found in the file `LICENCE`.