metadata_presenter 2.17.6 → 2.17.9
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/README.md +0 -12
- data/app/controllers/metadata_presenter/engine_controller.rb +9 -8
- data/app/views/layouts/metadata_presenter/application.html.erb +2 -2
- data/app/views/metadata_presenter/analytics/_ga4.html.erb +6 -14
- data/app/views/metadata_presenter/analytics/_global_analytics.html.erb +2 -3
- data/app/views/metadata_presenter/analytics/_gtm.html.erb +2 -2
- data/app/views/metadata_presenter/analytics/_ua.html.erb +2 -2
- data/app/views/metadata_presenter/analytics/analytics.html.erb +7 -3
- data/app/views/metadata_presenter/component/_autocomplete.html.erb +3 -1
- data/default_metadata/component/upload.json +3 -1
- data/fixtures/version.json +2 -1
- data/lib/metadata_presenter/version.rb +1 -1
- data/schemas/validations/validations.json +2 -1
- metadata +2 -17
- data/lib/tasks/metadata_presenter_tasks.rake +0 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f753356995076aa70b70538d34770ce68b03aa2fe866208cac8cd5b4ad861e9
|
4
|
+
data.tar.gz: 7ed63dece8665708989288145f64518c5a7c925c3c8e5ec55f5bc44487728b97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f8629f5c3a5cb9e4be7ac9fc7abf2868f45a7e44f10249fdcc8d47e7ee9ceb848c6e3cafa9683f02137fcddd78391e521f19a6a8e2f55dea5218f46da60d003
|
7
|
+
data.tar.gz: ad83b314cdaa5eb1d2f2babcbe2be7d358305fed7b474f194a73fb1c41829e4e578e4c8bdf8cd7ebcd8ca5d040372943aaa94ef76b8b673b6f3458a36216aadc
|
data/README.md
CHANGED
@@ -83,15 +83,3 @@ service.
|
|
83
83
|
## Generate documentation
|
84
84
|
|
85
85
|
Run `rake doc` and open the doc/index.html
|
86
|
-
|
87
|
-
## Flow diagrams
|
88
|
-
|
89
|
-
You can generate flow diagrams calling a rake task:
|
90
|
-
|
91
|
-
```
|
92
|
-
brew install graphviz
|
93
|
-
SERVICE_METADATA="some-form-metadata" rails metadata:flow
|
94
|
-
```
|
95
|
-
|
96
|
-
This will generate an image with the flow for that metadata. Open that image
|
97
|
-
and profit!
|
@@ -41,15 +41,22 @@ module MetadataPresenter
|
|
41
41
|
helper_method :analytics_cookie_name
|
42
42
|
|
43
43
|
def allow_analytics?
|
44
|
-
|
44
|
+
cookies[analytics_cookie_name] == 'accepted'
|
45
45
|
end
|
46
46
|
helper_method :allow_analytics?
|
47
47
|
|
48
48
|
def show_cookie_banner?
|
49
|
-
no_analytics_cookie?
|
49
|
+
no_analytics_cookie?
|
50
50
|
end
|
51
51
|
helper_method :show_cookie_banner?
|
52
52
|
|
53
|
+
def analytics_tags_present?
|
54
|
+
Rails.application.config.supported_analytics.values.flatten.any? do |analytic|
|
55
|
+
ENV[analytic].present?
|
56
|
+
end
|
57
|
+
end
|
58
|
+
helper_method :analytics_tags_present?
|
59
|
+
|
53
60
|
private
|
54
61
|
|
55
62
|
def not_found
|
@@ -60,12 +67,6 @@ module MetadataPresenter
|
|
60
67
|
redirect_to File.join(request.script_name, url)
|
61
68
|
end
|
62
69
|
|
63
|
-
def analytics_tags_present?
|
64
|
-
Rails.application.config.supported_analytics.values.flatten.any? do |analytic|
|
65
|
-
ENV[analytic].present?
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
70
|
def no_analytics_cookie?
|
70
71
|
cookies[analytics_cookie_name].blank?
|
71
72
|
end
|
@@ -6,6 +6,7 @@
|
|
6
6
|
<%= csp_meta_tag %>
|
7
7
|
|
8
8
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
9
|
+
<meta name="robots" content="noindex">
|
9
10
|
<link rel="shortcut icon" sizes="16x16 32x32 48x48" href="<%= asset_pack_url('media/images/favicon.ico') %>" type="image/x-icon" />
|
10
11
|
<link rel="mask-icon" href="<%= asset_pack_url('media/images/govuk-mask-icon.svg') %>" color="blue">
|
11
12
|
<link rel="apple-touch-icon" sizes="180x180" href="<%= asset_pack_url('media/images/govuk-apple-touch-icon-180x180.png') %>">
|
@@ -37,8 +38,7 @@
|
|
37
38
|
</main>
|
38
39
|
</div>
|
39
40
|
<%= render template: 'metadata_presenter/footer/footer' %>
|
40
|
-
|
41
|
-
<%= javascript_pack_tag 'application' %>
|
41
|
+
<%= javascript_pack_tag 'runner_application' %>
|
42
42
|
<%= javascript_pack_tag 'govuk' %>
|
43
43
|
</body>
|
44
44
|
</html>
|
@@ -1,16 +1,8 @@
|
|
1
|
-
<!-- Google Analytics 4 -->
|
1
|
+
<!-- Form Owner Google Analytics 4 -->
|
2
2
|
<% if Rails.application.config.respond_to?(:global_ga4) %>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= measurement_id %>"></script>
|
8
|
-
<script>
|
9
|
-
window.dataLayer = window.dataLayer || [];
|
10
|
-
function gtag(){dataLayer.push(arguments);}
|
11
|
-
gtag('js', new Date());
|
12
|
-
|
13
|
-
gtag('config', '<%= measurement_id %>');
|
14
|
-
</script>
|
3
|
+
<%# Global Google Analytics (GA4) should be included before this point so we only need a config setting %>
|
4
|
+
<script>
|
5
|
+
gtag('config', '<%= measurement_id %>');
|
6
|
+
</script>
|
15
7
|
<% end %>
|
16
|
-
<!-- End Google Analytics 4 -->
|
8
|
+
<!-- End Form Owner Google Analytics 4 -->
|
@@ -1,10 +1,9 @@
|
|
1
1
|
<!-- Global MoJ Forms site tag (gtag.js) - Google Analytics 4 -->
|
2
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id
|
2
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=#{global_measurement_id}"></script>
|
3
3
|
<script>
|
4
4
|
window.dataLayer = window.dataLayer || [];
|
5
5
|
function gtag(){dataLayer.push(arguments);}
|
6
6
|
gtag('js', new Date());
|
7
|
-
|
8
|
-
gtag('config', '<%= measurement_id %>');
|
7
|
+
gtag('config', '<%= global_measurement_id %>');
|
9
8
|
</script>
|
10
9
|
<!-- End Global MoJ Forms site tag (gtag.js) - Google Analytics 4 -->
|
@@ -1,7 +1,7 @@
|
|
1
|
-
<!-- Google Tag Manager -->
|
1
|
+
<!-- Google Tag Manager for Form Owner -->
|
2
2
|
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
3
3
|
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
4
4
|
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
5
5
|
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
6
6
|
})(window,document,'script','dataLayer','<%= measurement_id %>');</script>
|
7
|
-
<!-- End Google Tag Manager -->
|
7
|
+
<!-- End Google Tag Manager for Form Owner -->
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<!-- Google Universal Analytics -->
|
1
|
+
<!-- Google Universal Analytics for Form Owner -->
|
2
2
|
<script>
|
3
3
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
4
4
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
@@ -8,4 +8,4 @@
|
|
8
8
|
ga('create', '<%= measurement_id %>', 'auto');
|
9
9
|
ga('send', 'pageview');
|
10
10
|
</script>
|
11
|
-
<!-- End Google Universal Analytics -->
|
11
|
+
<!-- End Google Universal Analytics for Form Owner -->
|
@@ -1,7 +1,11 @@
|
|
1
|
+
<%# MoJ Forms Google Analytic Reporting %>
|
1
2
|
<% if Rails.application.config.respond_to?(:global_ga4) %>
|
2
|
-
<%= render partial: 'metadata_presenter/analytics/global_analytics', locals: {
|
3
|
+
<%= render partial: 'metadata_presenter/analytics/global_analytics', locals: { global_measurement_id: Rails.application.config.global_ga4 } %>
|
3
4
|
<% end %>
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
<%# Analytic reporting set by form owners %>
|
7
|
+
<% if analytics_tags_present? %>
|
8
|
+
<% Rails.application.config.supported_analytics.each do |provider, analytics| %>
|
9
|
+
<%= render partial: "metadata_presenter/analytics/#{provider}", locals: { analytics: analytics } %>
|
10
|
+
<% end %>
|
7
11
|
<% end %>
|
@@ -11,4 +11,6 @@
|
|
11
11
|
class: "govuk-!-width-two-thirds"
|
12
12
|
%>
|
13
13
|
|
14
|
-
|
14
|
+
<% if editable? %>
|
15
|
+
<%= render partial: '/partials/editable_autocomplete', locals: { component: component } %>
|
16
|
+
<% end %>
|
@@ -18,9 +18,11 @@
|
|
18
18
|
"application/vnd.oasis.opendocument.text",
|
19
19
|
"application/pdf",
|
20
20
|
"application/rtf",
|
21
|
+
"application/csv",
|
21
22
|
"image/jpeg",
|
22
23
|
"image/png",
|
23
|
-
"application/vnd.ms-excel"
|
24
|
+
"application/vnd.ms-excel",
|
25
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
24
26
|
]
|
25
27
|
}
|
26
28
|
}
|
data/fixtures/version.json
CHANGED
@@ -559,7 +559,8 @@
|
|
559
559
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
560
560
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
|
561
561
|
"application/vnd.ms-word.document.macroEnabled.12",
|
562
|
-
"application/vnd.ms-word.template.macroEnabled.12"
|
562
|
+
"application/vnd.ms-word.template.macroEnabled.12",
|
563
|
+
"application/csv"
|
563
564
|
],
|
564
565
|
"max_size": 7340032,
|
565
566
|
"virus_scan": true
|
@@ -345,7 +345,8 @@
|
|
345
345
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
346
346
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
|
347
347
|
"application/vnd.ms-word.document.macroEnabled.12",
|
348
|
-
"application/vnd.ms-word.template.macroEnabled.12"
|
348
|
+
"application/vnd.ms-word.template.macroEnabled.12",
|
349
|
+
"application/csv"
|
349
350
|
]
|
350
351
|
}
|
351
352
|
},
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metadata_presenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.17.
|
4
|
+
version: 2.17.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MoJ Forms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_design_system_formbuilder
|
@@ -128,20 +128,6 @@ dependencies:
|
|
128
128
|
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
|
-
- !ruby/object:Gem::Dependency
|
132
|
-
name: ruby-graphviz
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - ">="
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: '0'
|
138
|
-
type: :development
|
139
|
-
prerelease: false
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- - ">="
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: '0'
|
145
131
|
- !ruby/object:Gem::Dependency
|
146
132
|
name: rspec-rails
|
147
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -458,7 +444,6 @@ files:
|
|
458
444
|
- lib/metadata_presenter/engine.rb
|
459
445
|
- lib/metadata_presenter/test_helpers.rb
|
460
446
|
- lib/metadata_presenter/version.rb
|
461
|
-
- lib/tasks/metadata_presenter_tasks.rake
|
462
447
|
- schemas/component/autocomplete.json
|
463
448
|
- schemas/component/checkboxes.json
|
464
449
|
- schemas/component/content.json
|
@@ -1,89 +0,0 @@
|
|
1
|
-
require 'metadata_presenter/test_helpers'
|
2
|
-
|
3
|
-
namespace :metadata do
|
4
|
-
include MetadataPresenter::TestHelpers
|
5
|
-
|
6
|
-
desc 'Represent the flow objects in human readable form'
|
7
|
-
task flow: :environment do
|
8
|
-
require 'ruby-graphviz'
|
9
|
-
metadata = ENV['SERVICE_METADATA'] || metadata_fixture('branching')
|
10
|
-
service = MetadataPresenter::Service.new(metadata)
|
11
|
-
|
12
|
-
graph = MetadataPresenter::Graph.new(service)
|
13
|
-
|
14
|
-
graph.draw.generate_image
|
15
|
-
puts "Generated file #{graph.filename}"
|
16
|
-
system("open #{graph.filename}")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
module MetadataPresenter
|
21
|
-
class Graph
|
22
|
-
attr_reader :service, :filename, :nodes
|
23
|
-
|
24
|
-
delegate :metadata, :start_page, :find_page_by_uuid, :service_slug, to: :service
|
25
|
-
|
26
|
-
def initialize(service)
|
27
|
-
@service = service
|
28
|
-
@graphviz = GraphViz.new(:G, type: :digraph)
|
29
|
-
@filename = Rails.root.join('tmp', "#{service_slug}.png")
|
30
|
-
@nodes = {}
|
31
|
-
end
|
32
|
-
|
33
|
-
def draw
|
34
|
-
draw_nodes
|
35
|
-
draw_edges
|
36
|
-
|
37
|
-
self
|
38
|
-
end
|
39
|
-
|
40
|
-
def generate_image
|
41
|
-
@graphviz.output(png: filename)
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
|
46
|
-
def draw_nodes
|
47
|
-
flow.each do |id, _value|
|
48
|
-
flow_object = service.flow_object(id)
|
49
|
-
|
50
|
-
if flow_object.branch?
|
51
|
-
full_description = flow_object.conditionals.map.each_with_index do |conditional, _index|
|
52
|
-
conditional.expressions.map { |expression|
|
53
|
-
expression.service = service
|
54
|
-
|
55
|
-
"#{expression.expression_component.humanised_title} #{expression.operator} #{expression.field_label}"
|
56
|
-
}.join(" #{conditional.type} ")
|
57
|
-
end
|
58
|
-
nodes[id] = @graphviz.add_nodes(full_description.flatten.join(' / '))
|
59
|
-
else
|
60
|
-
current_page = find_page_by_uuid(id)
|
61
|
-
nodes[id] = @graphviz.add_nodes(current_page.url)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def draw_edges
|
67
|
-
flow.each do |id, _value|
|
68
|
-
flow_object = service.flow_object(id)
|
69
|
-
current_node = nodes[id]
|
70
|
-
node_next = nodes[flow_object.default_next]
|
71
|
-
|
72
|
-
if flow_object.branch?
|
73
|
-
@graphviz.add_edges(current_node, node_next, label: 'Conditions are not met', labelfontsize: 8) if node_next
|
74
|
-
|
75
|
-
flow_object.group_by_page.each do |page_uuid, _conditionals|
|
76
|
-
conditionals_node = nodes[page_uuid]
|
77
|
-
@graphviz.add_edges(current_node, conditionals_node, label: 'Conditions are met', labelfontsize: 8) if conditionals_node
|
78
|
-
end
|
79
|
-
elsif node_next
|
80
|
-
@graphviz.add_edges(current_node, node_next)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def flow
|
86
|
-
service.flow
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|