govuk_publishing_components 28.6.0 → 28.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +3 -3
- data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +7 -6
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +1796 -911
- data/app/models/govuk_publishing_components/component_docs.rb +4 -1
- data/app/views/govuk_publishing_components/components/_attachment.html.erb +3 -1
- data/app/views/govuk_publishing_components/components/_button.html.erb +3 -3
- data/app/views/govuk_publishing_components/components/_input.html.erb +3 -3
- data/app/views/govuk_publishing_components/components/_intervention.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_search.html.erb +2 -4
- data/app/views/govuk_publishing_components/components/_select.html.erb +15 -43
- data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +7 -8
- data/app/views/govuk_publishing_components/components/docs/attachment.yml +11 -0
- data/app/views/govuk_publishing_components/components/docs/select.yml +1 -1
- data/config/initializers/assets.rb +1 -0
- data/lib/govuk_publishing_components/presenters/attachment.rb +23 -0
- data/lib/govuk_publishing_components/presenters/select_helper.rb +85 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/govuk_publishing_components.rb +1 -1
- metadata +7 -37
- data/app/assets/javascripts/govuk_publishing_components/lib/header-navigation.js +0 -100
- data/lib/govuk_publishing_components/presenters/select.rb +0 -43
- data/lib/tasks/govuk_publishing_components_tasks.rake +0 -49
@@ -1,49 +0,0 @@
|
|
1
|
-
namespace :component do
|
2
|
-
desc "warns if component view files exist without corresponding documentation"
|
3
|
-
task :validate_documentation_exists do
|
4
|
-
print "Validating that each component has documentation... "
|
5
|
-
components_missing_docs = []
|
6
|
-
component_views = Dir["app/views/#{GovukPublishingComponents::Config.component_directory_name}/**/*.html.erb"]
|
7
|
-
component_views.each do |partial|
|
8
|
-
expected_component_docs_file = partial.split("/")[-1].gsub("html.erb", "yml")
|
9
|
-
expected_component_docs_file.sub!(/^_/, "")
|
10
|
-
|
11
|
-
expected_component_docs_path = "app/views/#{GovukPublishingComponents::Config.component_directory_name}/docs/#{expected_component_docs_file}"
|
12
|
-
components_missing_docs << partial unless File.exist?(expected_component_docs_path)
|
13
|
-
end
|
14
|
-
|
15
|
-
if components_missing_docs.any?
|
16
|
-
error = "You have components which are missing documentation. These components will not be displayed in the component guide:\n"
|
17
|
-
components_missing_docs.each { |component| error += "\t#{component}\n" }
|
18
|
-
error += "\n"
|
19
|
-
raise NotImplementedError, error
|
20
|
-
end
|
21
|
-
puts "✔︎"
|
22
|
-
end
|
23
|
-
|
24
|
-
desc "warns if component is missing accessibility criteria"
|
25
|
-
task :validate_accessibility_criteria_exist do
|
26
|
-
print "Validating that each component has accessibility criteria... "
|
27
|
-
errors = []
|
28
|
-
|
29
|
-
component_docs = Dir["app/views/#{GovukPublishingComponents::Config.component_directory_name}/**/*.yml"]
|
30
|
-
component_docs.each do |doc_file|
|
31
|
-
file = YAML.load_file(doc_file)
|
32
|
-
|
33
|
-
if file["accessibility_criteria"].nil? && file["shared_accessibility_criteria"].nil?
|
34
|
-
errors << file["name"]
|
35
|
-
end
|
36
|
-
end
|
37
|
-
if errors.any?
|
38
|
-
error = "The following components need accessibility criteria:\n#{errors.join("\n")}"
|
39
|
-
raise NotImplementedError, error
|
40
|
-
end
|
41
|
-
puts "✔︎"
|
42
|
-
end
|
43
|
-
|
44
|
-
desc "warns if component view files exist without corresponding documentation or accessibility critera"
|
45
|
-
task :validate_documentation do
|
46
|
-
Rake::Task["component:validate_documentation_exists"].invoke
|
47
|
-
Rake::Task["component:validate_accessibility_criteria_exist"].invoke
|
48
|
-
end
|
49
|
-
end
|