govuk_publishing_components 1.11.0 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/application.scss +17 -0
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +6 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/tasks/govuk_publishing_components_tasks.rake +44 -16
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04b3957a214548180a22d3921bcc25b1fa69163e
|
4
|
+
data.tar.gz: 5a593705b493da4e2cf8cd098201a8acd4751b21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26c42d56b90861b235c351040bffa9a8e9297ba50a83b2500f6557d9929c38d02148911217d6fb051807b4e8c4825f01c6cc8305ea4bd29e56682df833c2476e
|
7
|
+
data.tar.gz: aea09284f8bedd1969ab41eb3a9acfd433133a3a3534a748522b31bf26cc46d8e52069ae7d726c0aae2553b495aa03539ecbb33365c172af44327ec0f99ddf61
|
data/Rakefile
CHANGED
@@ -19,11 +19,11 @@ end
|
|
19
19
|
namespace :assets do
|
20
20
|
desc "Test precompiling assets through dummy application"
|
21
21
|
|
22
|
-
task :precompile do
|
22
|
+
task :precompile do
|
23
23
|
Rake::Task['app:assets:precompile'].invoke
|
24
24
|
end
|
25
25
|
|
26
|
-
task :clean do
|
26
|
+
task :clean do
|
27
27
|
Rake::Task['app:assets:clean'].invoke
|
28
28
|
end
|
29
29
|
end
|
@@ -46,6 +46,23 @@ $border-color: #ccc;
|
|
46
46
|
}
|
47
47
|
}
|
48
48
|
|
49
|
+
.component-violation {
|
50
|
+
border: 3px solid $error-colour;
|
51
|
+
margin: 0 0 $gutter;
|
52
|
+
padding: $gutter $gutter;
|
53
|
+
|
54
|
+
.component-violation__title {
|
55
|
+
@include bold-24;
|
56
|
+
}
|
57
|
+
|
58
|
+
.component-violation__link {
|
59
|
+
display: block;
|
60
|
+
@include bold-19;
|
61
|
+
color: $error-colour;
|
62
|
+
margin: $gutter-half 0;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
49
66
|
.component-doc-h2 {
|
50
67
|
@include bold-27;
|
51
68
|
margin: ($gutter * 1.5) 0 $gutter;
|
@@ -4,6 +4,12 @@
|
|
4
4
|
<div class="component-show">
|
5
5
|
<div class="grid-row">
|
6
6
|
<div class="column-two-thirds">
|
7
|
+
<% if !@component_doc.accessibility_criteria.present? %>
|
8
|
+
<div class="component-violation">
|
9
|
+
<h2 class="component-violation__title">This component is not valid</h2>
|
10
|
+
<p><a class="component-violation__link" href="https://github.com/alphagov/govuk_publishing_components/blob/master/docs/accessibility_acceptance_criteria.md">Please define accessibility acceptance criteria for this component.</a></p>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
7
13
|
<p class="component-description">
|
8
14
|
<%= @component_doc.description %>
|
9
15
|
</p>
|
@@ -1,22 +1,50 @@
|
|
1
|
-
desc 'warns if component view files exist without corresponding documentation'
|
2
|
-
task :validate_component_documentation do
|
3
|
-
components_missing_docs = []
|
4
|
-
component_views = Dir["app/views/#{GovukPublishingComponents::Config.component_directory_name}/**/*.html.erb"]
|
5
1
|
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
namespace :component do
|
3
|
+
desc 'warns if component view files exist without corresponding documentation'
|
4
|
+
task :validate_documentation_exists do
|
5
|
+
print "Validating that each component has documentation... "
|
6
|
+
components_missing_docs = []
|
7
|
+
component_views = Dir["app/views/#{GovukPublishingComponents::Config.component_directory_name}/**/*.html.erb"]
|
8
|
+
component_views.each do |partial|
|
9
|
+
expected_component_docs_file = partial.split('/')[-1].gsub('html.erb', 'yml')
|
10
|
+
expected_component_docs_file.sub!(/^_/, '')
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
+
expected_component_docs_path = "app/views/#{GovukPublishingComponents::Config.component_directory_name}/docs/#{expected_component_docs_file}"
|
13
|
+
components_missing_docs << partial unless File.exist?(expected_component_docs_path)
|
14
|
+
end
|
15
|
+
|
16
|
+
if components_missing_docs.any?
|
17
|
+
error = "You have components which are missing documentation. These components will not be displayed in the component guide:\n"
|
18
|
+
components_missing_docs.each { |component| error += "\t" + component + "\n" }
|
19
|
+
error += "\n"
|
20
|
+
raise NotImplementedError, error
|
21
|
+
end
|
22
|
+
puts "✔︎"
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'warns if component is missing accessibility criteria'
|
26
|
+
task :validate_accessibility_criteria_exist do
|
27
|
+
print "Validating that each component has accessibility criteria... "
|
28
|
+
errors = []
|
29
|
+
|
30
|
+
component_docs = Dir["app/views/#{GovukPublishingComponents::Config.component_directory_name}/**/*.yml"]
|
31
|
+
component_docs.each do |doc_file|
|
32
|
+
file = YAML.load_file(doc_file)
|
33
|
+
|
34
|
+
if file['accessibility_criteria'].nil? && file['shared_accessibility_criteria'].nil?
|
35
|
+
errors << file['name']
|
36
|
+
end
|
37
|
+
end
|
38
|
+
if errors.any?
|
39
|
+
error = "The following components need accessibility criteria:\n#{errors.join("\n")}"
|
40
|
+
raise NotImplementedError, error
|
41
|
+
end
|
42
|
+
puts "✔︎"
|
12
43
|
end
|
13
44
|
|
14
|
-
if
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
raise NotImplementedError, error
|
45
|
+
desc 'warns if component view files exist without corresponding documentation or accessibility critera'
|
46
|
+
task :validate_documentation do
|
47
|
+
Rake::Task["component:validate_documentation_exists"].invoke
|
48
|
+
Rake::Task["component:validate_accessibility_criteria_exist"].invoke
|
19
49
|
end
|
20
50
|
end
|
21
|
-
|
22
|
-
Rake::Task["validate_component_documentation"].invoke
|
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.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '3.3'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '3.3'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|