govuk_publishing_components 24.6.1 → 24.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/component_guide/application.js +3 -0
- data/app/assets/javascripts/govuk_publishing_components/components/details.js +2 -1
- data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +1 -0
- data/app/assets/javascripts/govuk_publishing_components/modules.js +3 -1
- data/app/assets/stylesheets/component_guide/application.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +0 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +10 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +8 -7
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +15 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +1 -32
- data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +0 -5
- data/app/controllers/govuk_publishing_components/audit_controller.rb +21 -17
- data/app/controllers/govuk_publishing_components/component_guide_controller.rb +9 -0
- data/app/helpers/govuk_publishing_components/application_helper.rb +3 -0
- data/app/models/govuk_publishing_components/audit_applications.rb +3 -3
- data/app/models/govuk_publishing_components/audit_comparer.rb +16 -8
- data/app/models/govuk_publishing_components/audit_components.rb +6 -3
- data/app/views/govuk_publishing_components/audit/_applications.html.erb +126 -0
- data/app/views/govuk_publishing_components/audit/_components.html.erb +142 -0
- data/app/views/govuk_publishing_components/audit/show.html.erb +22 -277
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +16 -0
- data/app/views/govuk_publishing_components/components/_image_card.html.erb +14 -11
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +7 -2
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +48 -7
- data/app/views/govuk_publishing_components/components/_layout_header.html.erb +15 -12
- data/app/views/govuk_publishing_components/components/_success_alert.html.erb +24 -8
- data/app/views/govuk_publishing_components/components/_title.html.erb +6 -2
- data/app/views/govuk_publishing_components/components/docs/button.yml +7 -6
- data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +3 -0
- data/app/views/govuk_publishing_components/components/docs/image_card.yml +12 -0
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +26 -0
- data/app/views/govuk_publishing_components/components/docs/modal_dialogue.yml +3 -0
- data/app/views/govuk_publishing_components/components/docs/success_alert.yml +12 -1
- data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +8 -1
- data/config/locales/ar.yml +1 -0
- data/config/locales/az.yml +1 -0
- data/config/locales/be.yml +1 -0
- data/config/locales/bg.yml +1 -0
- data/config/locales/bn.yml +1 -0
- data/config/locales/cs.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +1 -0
- data/config/locales/dr.yml +1 -0
- data/config/locales/el.yml +1 -0
- data/config/locales/en.yml +2 -0
- data/config/locales/es-419.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/config/locales/fa.yml +1 -0
- data/config/locales/fi.yml +1 -0
- data/config/locales/gd.yml +1 -0
- data/config/locales/gu.yml +1 -0
- data/config/locales/he.yml +1 -0
- data/config/locales/hi.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +1 -0
- data/config/locales/hy.yml +1 -0
- data/config/locales/id.yml +1 -0
- data/config/locales/is.yml +1 -0
- data/config/locales/it.yml +1 -0
- data/config/locales/ja.yml +1 -0
- data/config/locales/ka.yml +1 -0
- data/config/locales/kk.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +1 -0
- data/config/locales/ms.yml +1 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +1 -0
- data/config/locales/no.yml +1 -0
- data/config/locales/pa-pk.yml +1 -0
- data/config/locales/pa.yml +1 -0
- data/config/locales/pl.yml +1 -0
- data/config/locales/ps.yml +1 -0
- data/config/locales/pt.yml +1 -0
- data/config/locales/ro.yml +1 -0
- data/config/locales/ru.yml +1 -0
- data/config/locales/si.yml +1 -0
- data/config/locales/sk.yml +1 -0
- data/config/locales/sl.yml +1 -0
- data/config/locales/so.yml +1 -0
- data/config/locales/sq.yml +1 -0
- data/config/locales/sr.yml +1 -0
- data/config/locales/sv.yml +1 -0
- data/config/locales/sw.yml +1 -0
- data/config/locales/ta.yml +1 -0
- data/config/locales/th.yml +1 -0
- data/config/locales/tk.yml +1 -0
- data/config/locales/tr.yml +1 -0
- data/config/locales/uk.yml +1 -0
- data/config/locales/ur.yml +1 -0
- data/config/locales/uz.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-hk.yml +1 -0
- data/config/locales/zh-tw.yml +1 -0
- data/config/locales/zh.yml +1 -0
- data/lib/govuk_publishing_components/presenters/button_helper.rb +13 -2
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +5 -4
- data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +15 -31
- data/lib/govuk_publishing_components/presenters/shared_helper.rb +10 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +68 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ed769524a5b5079bce70c275a1cb341e287f5575bdb669b389b045f3aa79e50c
|
|
4
|
+
data.tar.gz: bf256f385c94da52726c3685d92f42239f08347d9f6506930f5773839ea81b8e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b95c734d8d88b6193ce60fb522787b947b6cefd2d5d35dfa13eb681786155689714b1838f7d67aa6a3fcdf222388a72216a1ec9db78bdf854429356673225026
|
|
7
|
+
data.tar.gz: f94cb6822b42112e4bc47516a27ffdc302163da8b27c01f9be865f06bdaad146e6d346609bd570f6197993af8e9044aec51deb59042e1a33aa2b1ef0732169c2
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-env jquery */
|
|
2
2
|
// = require govuk/components/details/details.js
|
|
3
3
|
window.GOVUK = window.GOVUK || {}
|
|
4
|
-
window.GOVUK.Modules = window.GOVUK.Modules || {}
|
|
4
|
+
window.GOVUK.Modules = window.GOVUK.Modules || {}
|
|
5
|
+
window.GOVUK.Modules.Details = window.GOVUKFrontend;
|
|
5
6
|
|
|
6
7
|
(function (Modules) {
|
|
7
8
|
function GovukDetails () { }
|
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
module = new GOVUK.Modules[moduleName]()
|
|
41
41
|
module.start(element)
|
|
42
42
|
element.data('module-started', true)
|
|
43
|
-
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if ( // GOV.UK Frontend Modules
|
|
44
46
|
typeof GOVUK.Modules[frontendModuleName] === 'function' &&
|
|
45
47
|
GOVUK.Modules[frontendModuleName].prototype.init &&
|
|
46
48
|
!started
|
|
@@ -59,12 +59,10 @@
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.gem-c-image-card__title {
|
|
62
|
-
@include govuk-font(19, $weight: bold);
|
|
63
62
|
margin: 0;
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
.gem-c-image-card__title-link {
|
|
67
|
-
@extend %govuk-link;
|
|
68
66
|
text-decoration: none;
|
|
69
67
|
|
|
70
68
|
&:hover {
|
|
@@ -136,7 +134,6 @@
|
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
.gem-c-image-card__list-item-link {
|
|
139
|
-
@extend %govuk-link;
|
|
140
137
|
line-height: 1.35em;
|
|
141
138
|
}
|
|
142
139
|
|
|
@@ -193,7 +190,6 @@
|
|
|
193
190
|
}
|
|
194
191
|
|
|
195
192
|
.gem-c-image-card__title {
|
|
196
|
-
@include govuk-font(24, $weight: bold);
|
|
197
193
|
padding-bottom: govuk-spacing(2);
|
|
198
194
|
}
|
|
199
195
|
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
.gem-c-layout-for-public {
|
|
2
|
-
margin: 0;
|
|
3
2
|
font-family: $govuk-font-family;
|
|
4
3
|
}
|
|
4
|
+
|
|
5
|
+
.gem-c-layout-for-public__blue-bar {
|
|
6
|
+
background: $govuk-brand-colour;
|
|
7
|
+
height: govuk-spacing(2);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.js-enabled .gem-c-layout-for-public__global-banner-wrapper {
|
|
11
|
+
margin-top: - govuk-spacing(2);
|
|
12
|
+
position: relative;
|
|
13
|
+
}
|
|
@@ -78,12 +78,14 @@
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
.gem-c-layout-
|
|
83
|
-
.gem-c-layout-
|
|
84
|
-
.gem-c-layout-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
@include govuk-compatibility(govuk_template) {
|
|
82
|
+
.gem-c-layout-header__search.govuk-grid-column-one-third-from-desktop,
|
|
83
|
+
.gem-c-layout-header__logo.govuk-grid-column-one-third-from-desktop,
|
|
84
|
+
.gem-c-layout-header__search.govuk-grid-column-one-third,
|
|
85
|
+
.gem-c-layout-header__logo.govuk-grid-column-two-thirds {
|
|
86
|
+
padding-right: 0;
|
|
87
|
+
padding-left: 0;
|
|
88
|
+
}
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
.gem-c-layout-header__logo,
|
|
@@ -104,7 +106,6 @@
|
|
|
104
106
|
|
|
105
107
|
.gem-c-header__content.govuk-header__content {
|
|
106
108
|
width: auto;
|
|
107
|
-
padding-left: 0;
|
|
108
109
|
|
|
109
110
|
@include govuk-media-query($from: desktop) {
|
|
110
111
|
float: right;
|
|
@@ -9,7 +9,6 @@ $large-input-size: 50px;
|
|
|
9
9
|
.gem-c-search__label {
|
|
10
10
|
@include govuk-font($size: 19, $line-height: $input-size);
|
|
11
11
|
display: block;
|
|
12
|
-
background: govuk-colour("white");
|
|
13
12
|
color: $govuk-text-colour;
|
|
14
13
|
|
|
15
14
|
h1 {
|
|
@@ -25,6 +24,7 @@ $large-input-size: 50px;
|
|
|
25
24
|
padding-left: govuk-spacing(3);
|
|
26
25
|
z-index: 1;
|
|
27
26
|
color: $govuk-secondary-text-colour;
|
|
27
|
+
background: govuk-colour("white");
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// match label colour with the label component colour
|
|
@@ -144,6 +144,10 @@ $large-input-size: 50px;
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
.gem-c-search--on-govuk-blue {
|
|
147
|
+
.gem-c-search__label {
|
|
148
|
+
color: govuk-colour("white");
|
|
149
|
+
}
|
|
150
|
+
|
|
147
151
|
.gem-c-search__input {
|
|
148
152
|
border-width: 0;
|
|
149
153
|
|
|
@@ -191,9 +195,19 @@ $large-input-size: 50px;
|
|
|
191
195
|
}
|
|
192
196
|
|
|
193
197
|
.gem-c-search--no-border {
|
|
198
|
+
.gem-c-search__label {
|
|
199
|
+
color: govuk-colour("white");
|
|
200
|
+
}
|
|
201
|
+
|
|
194
202
|
.gem-c-search__input[type="search"] {
|
|
195
203
|
border: 0;
|
|
196
204
|
}
|
|
205
|
+
|
|
206
|
+
.js-enabled & {
|
|
207
|
+
.gem-c-search__label {
|
|
208
|
+
color: $govuk-secondary-text-colour;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
197
211
|
}
|
|
198
212
|
|
|
199
213
|
.gem-c-search--large {
|
|
@@ -1,36 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
color: $govuk-text-colour;
|
|
3
|
-
padding: govuk-spacing(3);
|
|
4
|
-
border: $govuk-border-width-narrow solid $govuk-success-colour;
|
|
5
|
-
@include govuk-responsive-margin(8, "bottom");
|
|
6
|
-
|
|
7
|
-
@include govuk-media-query($from: tablet) {
|
|
8
|
-
padding: govuk-spacing(4);
|
|
9
|
-
border-width: $govuk-border-width;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
@import "govuk/components/notification-banner/notification-banner";
|
|
12
2
|
|
|
13
3
|
.gem-c-success-alert__message {
|
|
14
4
|
@include govuk-font(19, $weight: bold);
|
|
15
|
-
margin: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.gem-c-success-summary__title {
|
|
19
|
-
margin-top: 0;
|
|
20
|
-
margin-bottom: govuk-spacing(3);
|
|
21
|
-
|
|
22
|
-
@include govuk-media-query($from: tablet) {
|
|
23
|
-
margin-bottom: govuk-spacing(4);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@include govuk-font(24, $weight: bold);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.gem-c-success-summary__body {
|
|
30
|
-
@include govuk-font(19);
|
|
31
|
-
margin: 0;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.gem-c-success-alert:focus {
|
|
35
|
-
outline: $govuk-focus-width solid $govuk-focus-colour;
|
|
36
5
|
}
|
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
module GovukPublishingComponents
|
|
2
2
|
class AuditController < GovukPublishingComponents::ApplicationController
|
|
3
3
|
def show
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
components = AuditComponents.new(path)
|
|
7
|
-
applications = analyse_applications(File.expand_path("..", path))
|
|
8
|
-
compared_data = AuditComparer.new(components.data, applications)
|
|
9
|
-
|
|
10
|
-
@applications = compared_data.applications_data || []
|
|
11
|
-
@components = compared_data.gem_data || []
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def analyse_applications(path)
|
|
17
|
-
results = []
|
|
18
|
-
applications = %w[
|
|
19
|
-
calculators
|
|
4
|
+
application_dirs = %w[
|
|
20
5
|
collections
|
|
21
6
|
collections-publisher
|
|
22
7
|
content-data-admin
|
|
@@ -42,10 +27,29 @@ module GovukPublishingComponents
|
|
|
42
27
|
travel-advice-publisher
|
|
43
28
|
whitehall
|
|
44
29
|
].sort
|
|
30
|
+
application_dirs = [GovukPublishingComponents::ApplicationHelper.get_application_name_from_path(Rails.root)] unless ENV["MAIN_COMPONENT_GUIDE"]
|
|
31
|
+
|
|
32
|
+
gem_path = Gem.loaded_specs["govuk_publishing_components"].full_gem_path
|
|
33
|
+
gem_path = Dir.pwd if ENV["MAIN_COMPONENT_GUIDE"]
|
|
34
|
+
|
|
35
|
+
components = AuditComponents.new(gem_path, false)
|
|
36
|
+
applications = analyse_applications(File.expand_path("..", gem_path), application_dirs)
|
|
37
|
+
compared_data = AuditComparer.new(components.data, applications, false)
|
|
38
|
+
|
|
39
|
+
@applications = compared_data.applications_data || []
|
|
40
|
+
@components = compared_data.gem_data || []
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
def analyse_applications(path, application_dirs)
|
|
46
|
+
results = []
|
|
47
|
+
@applications_found = false
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
application_dirs.each do |application|
|
|
47
50
|
application_path = [path, application].join("/")
|
|
48
51
|
app = AuditApplications.new(application_path, application)
|
|
52
|
+
@applications_found = true if app.data[:application_found]
|
|
49
53
|
results << app.data
|
|
50
54
|
end
|
|
51
55
|
|
|
@@ -13,6 +13,7 @@ module GovukPublishingComponents
|
|
|
13
13
|
@components_in_use_sass = components_in_use_sass(false)
|
|
14
14
|
@components_in_use_print_sass = components_in_use_sass(true)
|
|
15
15
|
@components_in_use_js = components_in_use_js
|
|
16
|
+
@index_audit_summary = index_audit_summary
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
def show
|
|
@@ -161,5 +162,13 @@ module GovukPublishingComponents
|
|
|
161
162
|
h[:url] = component_doc_path(component_doc.id) if component_example
|
|
162
163
|
end
|
|
163
164
|
end
|
|
165
|
+
|
|
166
|
+
def index_audit_summary
|
|
167
|
+
components_gem_path = Gem.loaded_specs["govuk_publishing_components"].full_gem_path
|
|
168
|
+
components = AuditComponents.new(components_gem_path, true)
|
|
169
|
+
application = AuditApplications.new(@application_path, GovukPublishingComponents::ApplicationHelper.get_application_name_from_path(@application_path))
|
|
170
|
+
compared_data = AuditComparer.new(components.data, [application.data], true)
|
|
171
|
+
compared_data.applications_data[0]
|
|
172
|
+
end
|
|
164
173
|
end
|
|
165
174
|
end
|
|
@@ -86,8 +86,8 @@ module GovukPublishingComponents
|
|
|
86
86
|
gem_style_references = find_code_references(file, src, /gem-c-[-_a-zA-Z]+/)
|
|
87
87
|
@gem_style_references << gem_style_references if gem_style_references
|
|
88
88
|
end
|
|
89
|
-
rescue StandardError
|
|
90
|
-
puts
|
|
89
|
+
rescue StandardError => e
|
|
90
|
+
puts e.message
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
components_found.flatten.uniq.sort
|
|
@@ -108,7 +108,7 @@ module GovukPublishingComponents
|
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
def find_code_references(file, src, regex)
|
|
111
|
-
clean_file_path = /(?<=#{Regexp.escape(@path)}\/)[\/a-zA-Z_-]+.[a-zA-Z.]+/
|
|
111
|
+
clean_file_path = /(?<=#{Regexp.escape(@path.to_s)}\/)[\/a-zA-Z_-]+.[a-zA-Z.]+/
|
|
112
112
|
|
|
113
113
|
return file[clean_file_path] if regex.match?(src)
|
|
114
114
|
end
|
|
@@ -2,10 +2,10 @@ module GovukPublishingComponents
|
|
|
2
2
|
class AuditComparer
|
|
3
3
|
attr_reader :applications_data, :gem_data
|
|
4
4
|
|
|
5
|
-
def initialize(gem_data, results)
|
|
5
|
+
def initialize(gem_data, results, simple)
|
|
6
6
|
if gem_data[:gem_found]
|
|
7
7
|
@gem_data = gem_data
|
|
8
|
-
@applications_data = sort_results(results)
|
|
8
|
+
@applications_data = sort_results(results, simple)
|
|
9
9
|
@gem_data[:components_by_application] = get_components_by_application || []
|
|
10
10
|
end
|
|
11
11
|
end
|
|
@@ -16,7 +16,8 @@ module GovukPublishingComponents
|
|
|
16
16
|
key.to_s.gsub("_", " ").capitalize
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def sort_results(results)
|
|
19
|
+
def sort_results(results, simple)
|
|
20
|
+
@simple = simple
|
|
20
21
|
data = []
|
|
21
22
|
|
|
22
23
|
results.each do |result|
|
|
@@ -40,10 +41,9 @@ module GovukPublishingComponents
|
|
|
40
41
|
warnings << warn_about_jquery_references(result[:jquery_references])
|
|
41
42
|
warnings = warnings.flatten
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
summary: [
|
|
44
|
+
summary = []
|
|
45
|
+
unless @simple
|
|
46
|
+
summary = [
|
|
47
47
|
{
|
|
48
48
|
name: "Components in templates",
|
|
49
49
|
value: templates[:components].flatten.uniq.sort.join(", "),
|
|
@@ -64,7 +64,13 @@ module GovukPublishingComponents
|
|
|
64
64
|
name: "Components in ruby",
|
|
65
65
|
value: ruby[:components].join(", "),
|
|
66
66
|
},
|
|
67
|
-
]
|
|
67
|
+
]
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
data << {
|
|
71
|
+
name: result[:name],
|
|
72
|
+
application_found: result[:application_found],
|
|
73
|
+
summary: summary,
|
|
68
74
|
warnings: warnings,
|
|
69
75
|
warning_count: warnings.length,
|
|
70
76
|
gem_style_references: result[:gem_style_references],
|
|
@@ -180,6 +186,8 @@ module GovukPublishingComponents
|
|
|
180
186
|
end
|
|
181
187
|
|
|
182
188
|
def get_components_by_application
|
|
189
|
+
return [] if @simple
|
|
190
|
+
|
|
183
191
|
results = []
|
|
184
192
|
found_something = false
|
|
185
193
|
|
|
@@ -2,16 +2,17 @@ module GovukPublishingComponents
|
|
|
2
2
|
class AuditComponents
|
|
3
3
|
attr_reader :data
|
|
4
4
|
|
|
5
|
-
def initialize(path)
|
|
5
|
+
def initialize(path, simple)
|
|
6
6
|
@data = {
|
|
7
7
|
gem_found: false,
|
|
8
8
|
}
|
|
9
|
-
@data = compile_data(path) if Dir.exist?(path)
|
|
9
|
+
@data = compile_data(path, simple) if Dir.exist?(path)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
private
|
|
13
13
|
|
|
14
|
-
def compile_data(path)
|
|
14
|
+
def compile_data(path, simple)
|
|
15
|
+
@simple = simple
|
|
15
16
|
templates_path = "app/views/govuk_publishing_components/components"
|
|
16
17
|
stylesheets_path = "app/assets/stylesheets/govuk_publishing_components/components"
|
|
17
18
|
print_stylesheets_path = "app/assets/stylesheets/govuk_publishing_components/components/print"
|
|
@@ -128,6 +129,8 @@ module GovukPublishingComponents
|
|
|
128
129
|
end
|
|
129
130
|
|
|
130
131
|
def list_all_component_details
|
|
132
|
+
return [] if @simple
|
|
133
|
+
|
|
131
134
|
all_component_information = []
|
|
132
135
|
|
|
133
136
|
@components.each do |component|
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<%
|
|
2
|
+
title = "Applications"
|
|
3
|
+
title = "This application" unless ENV["MAIN_COMPONENT_GUIDE"]
|
|
4
|
+
%>
|
|
5
|
+
<%= render "govuk_publishing_components/components/heading", {
|
|
6
|
+
text: title,
|
|
7
|
+
font_size: "l",
|
|
8
|
+
margin_bottom: 6
|
|
9
|
+
} %>
|
|
10
|
+
|
|
11
|
+
<% if @applications.any? %>
|
|
12
|
+
<%= render "govuk_publishing_components/components/details", {
|
|
13
|
+
title: "How to use this information"
|
|
14
|
+
} do %>
|
|
15
|
+
<p class="govuk-body">This page shows information about component use on GOV.UK. This information has been cross referenced with the components in the gem to produce warnings where e.g. a print stylesheet for a component exists but has not been included in an application.</p>
|
|
16
|
+
<p class="govuk-body">Warnings should be investigated, although there may be a reason why the application has been configured as it is. Note that 'code' can refer to templates or ruby code.</p>
|
|
17
|
+
<% end %>
|
|
18
|
+
|
|
19
|
+
<%
|
|
20
|
+
accordion_content = nil
|
|
21
|
+
summary = nil
|
|
22
|
+
%>
|
|
23
|
+
<% application_items = @applications.map do |application| %>
|
|
24
|
+
<%
|
|
25
|
+
summary = '<strong class="govuk-tag govuk-tag--red">Application not found</strong>'
|
|
26
|
+
|
|
27
|
+
if application[:application_found]
|
|
28
|
+
summary = "Warnings: 0"
|
|
29
|
+
summary = "Warnings: <strong class=\"govuk-tag govuk-tag--red\">#{application[:warning_count]}</strong>" if application[:warning_count] > 0
|
|
30
|
+
end
|
|
31
|
+
%>
|
|
32
|
+
|
|
33
|
+
<% accordion_content = capture do %>
|
|
34
|
+
<% if application[:application_found] %>
|
|
35
|
+
<% application[:warnings].each do |warning| %>
|
|
36
|
+
<p class="govuk-body">
|
|
37
|
+
<strong class="govuk-tag">Warn</strong>
|
|
38
|
+
<strong><%= warning[:component] %></strong> - <%= warning[:message] %>
|
|
39
|
+
</p>
|
|
40
|
+
<% end %>
|
|
41
|
+
|
|
42
|
+
<%= render "govuk_publishing_components/components/heading", {
|
|
43
|
+
text: "Components used",
|
|
44
|
+
font_size: "m",
|
|
45
|
+
margin_bottom: 4,
|
|
46
|
+
heading_level: 3,
|
|
47
|
+
} %>
|
|
48
|
+
|
|
49
|
+
<dl class="govuk-summary-list">
|
|
50
|
+
<% application[:summary].each do |item| %>
|
|
51
|
+
<div class="govuk-summary-list__row">
|
|
52
|
+
<dt class="govuk-summary-list__key">
|
|
53
|
+
<%= item[:name] %>
|
|
54
|
+
</dt>
|
|
55
|
+
<dd class="govuk-summary-list__value">
|
|
56
|
+
<% if item[:value].length > 0 %>
|
|
57
|
+
<%= item[:value] %>
|
|
58
|
+
<% else %>
|
|
59
|
+
None
|
|
60
|
+
<% end %>
|
|
61
|
+
</dd>
|
|
62
|
+
</div>
|
|
63
|
+
<% end %>
|
|
64
|
+
</dl>
|
|
65
|
+
|
|
66
|
+
<% if application[:gem_style_references].any? %>
|
|
67
|
+
<%= render "govuk_publishing_components/components/heading", {
|
|
68
|
+
text: "Component references",
|
|
69
|
+
font_size: "m",
|
|
70
|
+
margin_bottom: 4,
|
|
71
|
+
heading_level: 3,
|
|
72
|
+
} %>
|
|
73
|
+
|
|
74
|
+
<p class="govuk-body">This shows instances of `gem-c-` classes found in the application. If a reference is found in a stylesheet or in code a warning is created, as this could be a style override or hard coded component markup.</p>
|
|
75
|
+
<ul class="govuk-list govuk-list--bullet">
|
|
76
|
+
<% application[:gem_style_references].each do |ref| %>
|
|
77
|
+
<li><%= ref %></li>
|
|
78
|
+
<% end %>
|
|
79
|
+
</ul>
|
|
80
|
+
<% end %>
|
|
81
|
+
|
|
82
|
+
<% if application[:jquery_references].any? %>
|
|
83
|
+
<%= render "govuk_publishing_components/components/heading", {
|
|
84
|
+
text: "jQuery references",
|
|
85
|
+
font_size: "m",
|
|
86
|
+
margin_bottom: 4,
|
|
87
|
+
heading_level: 3,
|
|
88
|
+
} %>
|
|
89
|
+
<p class="govuk-body">This shows JavaScript files that might contain jQuery, which we are trying to remove our dependency on.</p>
|
|
90
|
+
<ul class="govuk-list govuk-list--bullet">
|
|
91
|
+
<% application[:jquery_references].each do |ref| %>
|
|
92
|
+
<li><%= ref %></li>
|
|
93
|
+
<% end %>
|
|
94
|
+
</ul>
|
|
95
|
+
<% end %>
|
|
96
|
+
<% else %>
|
|
97
|
+
<p class="govuk-body">This application was not found. This could be because you do not have this repository checked out locally.</p>
|
|
98
|
+
<% end %>
|
|
99
|
+
<% end %>
|
|
100
|
+
|
|
101
|
+
<%
|
|
102
|
+
{
|
|
103
|
+
heading: {
|
|
104
|
+
text: application[:name]
|
|
105
|
+
},
|
|
106
|
+
summary: {
|
|
107
|
+
text: sanitize(summary)
|
|
108
|
+
},
|
|
109
|
+
content: {
|
|
110
|
+
html: sanitize(accordion_content)
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
%>
|
|
114
|
+
<% end %>
|
|
115
|
+
|
|
116
|
+
<% if ENV["MAIN_COMPONENT_GUIDE"] %>
|
|
117
|
+
<%= render "govuk_publishing_components/components/accordion", {
|
|
118
|
+
items: application_items
|
|
119
|
+
} %>
|
|
120
|
+
<% else %>
|
|
121
|
+
<p class="govuk-body"><%= sanitize(summary) %></p>
|
|
122
|
+
<%= accordion_content %>
|
|
123
|
+
<% end %>
|
|
124
|
+
<% else %>
|
|
125
|
+
<p class="govuk-body">No applications found.</p>
|
|
126
|
+
<% end %>
|