govuk_publishing_components 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/application.scss +173 -1
- data/app/controllers/govuk_publishing_components/component_guide_controller.rb +1 -1
- data/app/models/govuk_publishing_components/component_doc.rb +1 -1
- data/app/models/govuk_publishing_components/component_doc_resolver.rb +6 -2
- data/lib/generators/govuk_publishing_components/component_generator.rb +15 -5
- data/lib/generators/govuk_publishing_components/templates/_component.html.erb +1 -1
- data/lib/generators/govuk_publishing_components/templates/_component.scss +1 -1
- data/lib/govuk_publishing_components.rb +1 -2
- data/lib/govuk_publishing_components/config.rb +10 -0
- data/lib/govuk_publishing_components/engine.rb +1 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -3
- data/app/assets/stylesheets/govuk_publishing_components/component_guide.scss +0 -173
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af16bdb3cf4e7f4353eb49094b958b1ad1eab6f6
|
4
|
+
data.tar.gz: 211f3d355a205409e8217c7bdb088ddda67a0a08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48333dcb9f5ca4f68cce6b8ef536a8c01640450cf27892b784f455900cb6fbb58cfa072e785a8b816be068c0f1db1e07d35562b25fa1925523f465daf868fd65
|
7
|
+
data.tar.gz: cc2659ab75afb0723c95c6f100c8dbb49be917cf6b849e478e4fb8d812306dbcc1a011c0bb52f8f6693bea134d91aa518a70755bb8aa52d5ac925024952d3e17
|
@@ -4,4 +4,176 @@
|
|
4
4
|
@import "typography";
|
5
5
|
@import "colours";
|
6
6
|
|
7
|
-
|
7
|
+
$prism-background: #f5f2f0;
|
8
|
+
$border-color: #ccc;
|
9
|
+
|
10
|
+
.govuk-component-guide-wrapper {
|
11
|
+
padding-bottom: $gutter * 1.5;
|
12
|
+
}
|
13
|
+
|
14
|
+
.component-list {
|
15
|
+
li {
|
16
|
+
@include core-19;
|
17
|
+
margin-bottom: $gutter-half;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
.component-description {
|
22
|
+
@include core-24;
|
23
|
+
max-width: 30em;
|
24
|
+
margin-bottom: $gutter * 1.5;
|
25
|
+
}
|
26
|
+
|
27
|
+
.component-body {
|
28
|
+
margin-bottom: $gutter * 1.5;
|
29
|
+
}
|
30
|
+
|
31
|
+
.component-doc {
|
32
|
+
@include core-16;
|
33
|
+
|
34
|
+
.component-doc-h2:first-child {
|
35
|
+
margin-top: 0;
|
36
|
+
}
|
37
|
+
|
38
|
+
p {
|
39
|
+
margin: $gutter-half 0;
|
40
|
+
}
|
41
|
+
|
42
|
+
ol,
|
43
|
+
ul {
|
44
|
+
margin: 0 0 0 $gutter;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
.component-doc-h2 {
|
49
|
+
@include bold-27;
|
50
|
+
margin: ($gutter * 1.5) 0 $gutter;
|
51
|
+
|
52
|
+
small {
|
53
|
+
@include bold-16;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
.component-doc-h3 {
|
58
|
+
margin: $gutter 0 $gutter-half;
|
59
|
+
@include bold-19;
|
60
|
+
}
|
61
|
+
|
62
|
+
.component-guide-preview {
|
63
|
+
padding: 30px 0;
|
64
|
+
|
65
|
+
.preview-title {
|
66
|
+
margin-bottom: 1em;
|
67
|
+
@include bold-16;
|
68
|
+
|
69
|
+
a {
|
70
|
+
color: $black;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
.code-block {
|
76
|
+
margin: 30px 0;
|
77
|
+
@extend %outdent-to-full-width;
|
78
|
+
|
79
|
+
// Match Prism styles to avoid a flash as it renders
|
80
|
+
background: $prism-background;
|
81
|
+
font-family: Consolas, Monaco, 'Andale Mono', monospace;
|
82
|
+
font-size: 16px;
|
83
|
+
line-height: 1.5;
|
84
|
+
|
85
|
+
&[contenteditable]:hover {
|
86
|
+
cursor: text;
|
87
|
+
}
|
88
|
+
|
89
|
+
&[contenteditable]:focus {
|
90
|
+
outline: 3px solid $focus-colour;
|
91
|
+
}
|
92
|
+
|
93
|
+
pre[class*=language-] {
|
94
|
+
padding: $gutter;
|
95
|
+
max-height: 300px;
|
96
|
+
}
|
97
|
+
|
98
|
+
code {
|
99
|
+
display: block;
|
100
|
+
}
|
101
|
+
|
102
|
+
.token.operator {
|
103
|
+
background: none;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
.component-guide-preview {
|
108
|
+
&.direction-rtl {
|
109
|
+
direction: rtl;
|
110
|
+
text-align: start;
|
111
|
+
}
|
112
|
+
|
113
|
+
padding: ($gutter * 1.5) $gutter $gutter;
|
114
|
+
border: 1px solid $border-colour;
|
115
|
+
position: relative;
|
116
|
+
|
117
|
+
&:before {
|
118
|
+
@include core-14;
|
119
|
+
content: "EXAMPLE";
|
120
|
+
position: absolute;
|
121
|
+
top: 0;
|
122
|
+
left: 0;
|
123
|
+
padding: 0.21053em 0.78947em;
|
124
|
+
background: $border-colour;
|
125
|
+
color: $white;
|
126
|
+
}
|
127
|
+
|
128
|
+
div[class^="govuk-"] {
|
129
|
+
&:hover {
|
130
|
+
outline: 1px solid $border-color;
|
131
|
+
box-shadow: 0 0 10px $border-color;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
.examples {
|
137
|
+
.component-example {
|
138
|
+
margin: 0 0 $gutter * 1.5;
|
139
|
+
|
140
|
+
.example-title {
|
141
|
+
@include bold-24;
|
142
|
+
margin: $gutter-half 0;
|
143
|
+
|
144
|
+
small {
|
145
|
+
@include bold-16;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
// Preview Page Styling
|
152
|
+
html {
|
153
|
+
background: $white;
|
154
|
+
}
|
155
|
+
|
156
|
+
.hide-header-and-footer {
|
157
|
+
// scss-lint:disable IdSelector
|
158
|
+
#global-header,
|
159
|
+
#global-header-bar,
|
160
|
+
#global-breadcrumb,
|
161
|
+
#footer {
|
162
|
+
display: none;
|
163
|
+
}
|
164
|
+
// scss-lint:enable IdSelector
|
165
|
+
}
|
166
|
+
|
167
|
+
.component-guide-preview-page {
|
168
|
+
padding: ($gutter * 1.5) 0;
|
169
|
+
position: relative;
|
170
|
+
|
171
|
+
.preview-title {
|
172
|
+
margin-bottom: 1em;
|
173
|
+
@include bold-16;
|
174
|
+
|
175
|
+
a {
|
176
|
+
color: $black;
|
177
|
+
}
|
178
|
+
}
|
179
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module GovukPublishingComponents
|
2
2
|
class ComponentGuideController < GovukPublishingComponents::ApplicationController
|
3
|
-
append_view_path File.join(Rails.root, "app", "views",
|
3
|
+
append_view_path File.join(Rails.root, "app", "views", GovukPublishingComponents::Config.component_directory_name)
|
4
4
|
|
5
5
|
def index
|
6
6
|
@component_docs = component_documentation_resolver.all
|
@@ -26,17 +26,21 @@ module GovukPublishingComponents
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def fetch_component_docs
|
29
|
-
doc_files = Rails.root.join(
|
29
|
+
doc_files = Rails.root.join(documentation_directory, "*.yml")
|
30
30
|
Dir[doc_files].sort.map { |file| parse_documentation(file) }
|
31
31
|
end
|
32
32
|
|
33
33
|
def fetch_component_doc(id)
|
34
|
-
file = Rails.root.join(
|
34
|
+
file = Rails.root.join(documentation_directory, "#{id}.yml")
|
35
35
|
parse_documentation(file)
|
36
36
|
end
|
37
37
|
|
38
38
|
def parse_documentation(file)
|
39
39
|
{ id: File.basename(file, ".yml") }.merge(YAML::load_file(file)).with_indifferent_access
|
40
40
|
end
|
41
|
+
|
42
|
+
def documentation_directory
|
43
|
+
Rails.root.join("app", "views", GovukPublishingComponents::Config.component_directory_name, "docs")
|
44
|
+
end
|
41
45
|
end
|
42
46
|
end
|
@@ -6,18 +6,28 @@ module GovukPublishingComponents
|
|
6
6
|
source_root File.expand_path('../templates', __FILE__)
|
7
7
|
|
8
8
|
def copy_component_files
|
9
|
+
static = GovukPublishingComponents::Config.static
|
10
|
+
|
9
11
|
@public_name = file_name.dasherize
|
12
|
+
@component_prefix = static ? 'pub-c-' : 'app-c-'
|
13
|
+
component_directory_name = GovukPublishingComponents::Config.component_directory_name
|
10
14
|
|
11
|
-
template_dir = "app/views/
|
12
|
-
docs_dir = "app/views/
|
13
|
-
scss_dir = "app/assets/stylesheets/
|
15
|
+
template_dir = "app/views/#{component_directory_name}/"
|
16
|
+
docs_dir = "app/views/#{component_directory_name}/docs/"
|
17
|
+
scss_dir = "app/assets/stylesheets/#{component_directory_name.dasherize}/"
|
14
18
|
|
15
19
|
create_directory_if_not_exists(template_dir)
|
16
20
|
create_directory_if_not_exists(docs_dir)
|
17
21
|
create_directory_if_not_exists(scss_dir)
|
18
22
|
|
19
|
-
|
20
|
-
|
23
|
+
if static
|
24
|
+
template '_component.html.erb', "#{template_dir}#{@public_name.underscore}.raw.html.erb"
|
25
|
+
template 'component.yml.erb', "#{docs_dir}#{@public_name.underscore}.yml"
|
26
|
+
else
|
27
|
+
template '_component.html.erb', "#{template_dir}_#{@public_name}.html.erb"
|
28
|
+
template 'component.yml.erb', "#{docs_dir}#{@public_name}.yml"
|
29
|
+
end
|
30
|
+
|
21
31
|
template '_component.scss', "#{scss_dir}_#{@public_name}.scss"
|
22
32
|
end
|
23
33
|
|
@@ -4,6 +4,9 @@ module GovukPublishingComponents
|
|
4
4
|
end
|
5
5
|
|
6
6
|
module Config
|
7
|
+
STATIC_COMPONENT_DIRECTORY = "govuk_component".freeze
|
8
|
+
APP_COMPONENT_DIRECTORY = "components".freeze
|
9
|
+
|
7
10
|
mattr_accessor :component_guide_title
|
8
11
|
self.component_guide_title = "GOV.UK Component Guide"
|
9
12
|
|
@@ -15,5 +18,12 @@ module GovukPublishingComponents
|
|
15
18
|
|
16
19
|
mattr_accessor :application_javascript
|
17
20
|
self.application_javascript = "application"
|
21
|
+
|
22
|
+
mattr_accessor :static
|
23
|
+
self.static = false
|
24
|
+
|
25
|
+
def self.component_directory_name
|
26
|
+
static ? STATIC_COMPONENT_DIRECTORY : APP_COMPONENT_DIRECTORY
|
27
|
+
end
|
18
28
|
end
|
19
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -180,7 +180,6 @@ files:
|
|
180
180
|
- app/assets/javascripts/govuk_publishing_components/application.js
|
181
181
|
- app/assets/javascripts/govuk_publishing_components/vendor/axe.min.js
|
182
182
|
- app/assets/stylesheets/govuk_publishing_components/application.scss
|
183
|
-
- app/assets/stylesheets/govuk_publishing_components/component_guide.scss
|
184
183
|
- app/controllers/govuk_publishing_components/application_controller.rb
|
185
184
|
- app/controllers/govuk_publishing_components/component_guide_controller.rb
|
186
185
|
- app/helpers/govuk_publishing_components/application_helper.rb
|
@@ -1,173 +0,0 @@
|
|
1
|
-
$prism-background: #f5f2f0;
|
2
|
-
$border-color: #ccc;
|
3
|
-
|
4
|
-
.govuk-component-guide-wrapper {
|
5
|
-
padding-bottom: $gutter * 1.5;
|
6
|
-
}
|
7
|
-
|
8
|
-
.component-list {
|
9
|
-
li {
|
10
|
-
@include core-19;
|
11
|
-
margin-bottom: $gutter-half;
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
.component-description {
|
16
|
-
@include core-24;
|
17
|
-
max-width: 30em;
|
18
|
-
margin-bottom: $gutter * 1.5;
|
19
|
-
}
|
20
|
-
|
21
|
-
.component-body {
|
22
|
-
margin-bottom: $gutter * 1.5;
|
23
|
-
}
|
24
|
-
|
25
|
-
.component-doc {
|
26
|
-
@include core-16;
|
27
|
-
|
28
|
-
.component-doc-h2:first-child {
|
29
|
-
margin-top: 0;
|
30
|
-
}
|
31
|
-
|
32
|
-
p {
|
33
|
-
margin: $gutter-half 0;
|
34
|
-
}
|
35
|
-
|
36
|
-
ol,
|
37
|
-
ul {
|
38
|
-
margin: 0 0 0 $gutter;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
.component-doc-h2 {
|
43
|
-
@include bold-27;
|
44
|
-
margin: ($gutter * 1.5) 0 $gutter;
|
45
|
-
|
46
|
-
small {
|
47
|
-
@include bold-16;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
.component-doc-h3 {
|
52
|
-
margin: $gutter 0 $gutter-half;
|
53
|
-
@include bold-19;
|
54
|
-
}
|
55
|
-
|
56
|
-
.component-guide-preview {
|
57
|
-
padding: 30px 0;
|
58
|
-
|
59
|
-
.preview-title {
|
60
|
-
margin-bottom: 1em;
|
61
|
-
@include bold-16;
|
62
|
-
|
63
|
-
a {
|
64
|
-
color: $black;
|
65
|
-
}
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
.code-block {
|
70
|
-
margin: 30px 0;
|
71
|
-
@extend %outdent-to-full-width;
|
72
|
-
|
73
|
-
// Match Prism styles to avoid a flash as it renders
|
74
|
-
background: $prism-background;
|
75
|
-
font-family: Consolas, Monaco, 'Andale Mono', monospace;
|
76
|
-
font-size: 16px;
|
77
|
-
line-height: 1.5;
|
78
|
-
|
79
|
-
&[contenteditable]:hover {
|
80
|
-
cursor: text;
|
81
|
-
}
|
82
|
-
|
83
|
-
&[contenteditable]:focus {
|
84
|
-
outline: 3px solid $focus-colour;
|
85
|
-
}
|
86
|
-
|
87
|
-
pre[class*=language-] {
|
88
|
-
padding: $gutter;
|
89
|
-
max-height: 300px;
|
90
|
-
}
|
91
|
-
|
92
|
-
code {
|
93
|
-
display: block;
|
94
|
-
}
|
95
|
-
|
96
|
-
.token.operator {
|
97
|
-
background: none;
|
98
|
-
}
|
99
|
-
}
|
100
|
-
|
101
|
-
.component-guide-preview {
|
102
|
-
&.direction-rtl {
|
103
|
-
direction: rtl;
|
104
|
-
text-align: start;
|
105
|
-
}
|
106
|
-
|
107
|
-
padding: ($gutter * 1.5) $gutter $gutter;
|
108
|
-
border: 1px solid $border-colour;
|
109
|
-
position: relative;
|
110
|
-
|
111
|
-
&:before {
|
112
|
-
@include core-14;
|
113
|
-
content: "EXAMPLE";
|
114
|
-
position: absolute;
|
115
|
-
top: 0;
|
116
|
-
left: 0;
|
117
|
-
padding: 0.21053em 0.78947em;
|
118
|
-
background: $border-colour;
|
119
|
-
color: $white;
|
120
|
-
}
|
121
|
-
|
122
|
-
div[class^="govuk-"] {
|
123
|
-
&:hover {
|
124
|
-
outline: 1px solid $border-color;
|
125
|
-
box-shadow: 0 0 10px $border-color;
|
126
|
-
}
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
|
-
.examples {
|
131
|
-
.component-example {
|
132
|
-
margin: 0 0 $gutter * 1.5;
|
133
|
-
|
134
|
-
.example-title {
|
135
|
-
@include bold-24;
|
136
|
-
margin: $gutter-half 0;
|
137
|
-
|
138
|
-
small {
|
139
|
-
@include bold-16;
|
140
|
-
}
|
141
|
-
}
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
|
-
// Preview Page Styling
|
146
|
-
html {
|
147
|
-
background: $white;
|
148
|
-
}
|
149
|
-
|
150
|
-
.hide-header-and-footer {
|
151
|
-
// scss-lint:disable IdSelector
|
152
|
-
#global-header,
|
153
|
-
#global-header-bar,
|
154
|
-
#global-breadcrumb,
|
155
|
-
#footer {
|
156
|
-
display: none;
|
157
|
-
}
|
158
|
-
// scss-lint:enable IdSelector
|
159
|
-
}
|
160
|
-
|
161
|
-
.component-guide-preview-page {
|
162
|
-
padding: ($gutter * 1.5) 0;
|
163
|
-
position: relative;
|
164
|
-
|
165
|
-
.preview-title {
|
166
|
-
margin-bottom: 1em;
|
167
|
-
@include bold-16;
|
168
|
-
|
169
|
-
a {
|
170
|
-
color: $black;
|
171
|
-
}
|
172
|
-
}
|
173
|
-
}
|