metadata_presenter 3.3.21 → 3.3.23
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/models/metadata_presenter/evaluate_content_conditionals.rb +12 -18
- data/app/views/metadata_presenter/component/_components.html.erb +53 -51
- data/app/views/metadata_presenter/page/multiplequestions.html.erb +1 -2
- data/lib/metadata_presenter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6854382610b99865f2af30a38c5807393211a160d3ab4af1000964daf082caa9
|
4
|
+
data.tar.gz: 6c9cd5e2ecd9c4057cb59f12fdc34fb551398b490f52f020cea167838011f6f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9924fc2c8e9b45e8f75468b474c166f78251faa4083d060acacff409c0a96da4b3be773d87970f13affa03d81ebda56c06a071dc7d897ca90254c395ebedf13
|
7
|
+
data.tar.gz: 0261d65fac2f0f0a07236abe4cfad1fdf06b3199ddebb4ad2c408597ae90bf2c46f08ff7ab1af18137f177ed7cd40d64c393e4599f7f167236032a1e0398b40f
|
@@ -22,26 +22,20 @@ module MetadataPresenter
|
|
22
22
|
|
23
23
|
def uuid_to_include?(candidate_component)
|
24
24
|
evaluation_conditions = []
|
25
|
-
|
26
|
-
|
25
|
+
|
26
|
+
if candidate_component.conditionals.count > 1
|
27
|
+
candidate_component.conditionals.each do |conditional|
|
28
|
+
evaluation_conditions << if conditional[:_type] == 'and'
|
29
|
+
evaluate_condition(conditional).flatten.all?
|
30
|
+
else
|
31
|
+
evaluate_condition(conditional)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
candidate_component.uuid if evaluation_conditions.flatten.any?
|
36
|
+
else
|
27
37
|
evaluation_conditions << evaluate_condition(candidate_component.conditionals[0])
|
28
38
|
candidate_component.uuid if evaluation_conditions.flatten.all?
|
29
|
-
elsif candidate_component.conditionals.count > 1
|
30
|
-
# if there are or rule
|
31
|
-
if candidate_component.conditionals[0][:_type] == 'and'
|
32
|
-
# if there are 'and' in conditions between the 'or' rule
|
33
|
-
candidate_component.conditionals.map do |conditional|
|
34
|
-
evaluation_conditions << evaluate_condition(conditional).flatten.all?
|
35
|
-
end
|
36
|
-
return candidate_component.uuid if evaluation_conditions.flatten.any?
|
37
|
-
end
|
38
|
-
if candidate_component.conditionals[0][:_type] == 'if'
|
39
|
-
# then this is an 'or' condition between conditionals
|
40
|
-
candidate_component.conditionals.map do |conditional|
|
41
|
-
evaluation_conditions << evaluate_condition(conditional)
|
42
|
-
end
|
43
|
-
candidate_component.uuid if evaluation_conditions.flatten.any?
|
44
|
-
end
|
45
39
|
end
|
46
40
|
end
|
47
41
|
|
@@ -1,54 +1,56 @@
|
|
1
|
-
|
2
|
-
<%
|
3
|
-
<%
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
1
|
+
<div class="components" data-controller="orderable-items">
|
2
|
+
<% components.each_with_index do |component, index| %>
|
3
|
+
<% if component.type == 'content' %>
|
4
|
+
<% next unless (editable? || @page.show_conditional_component?(component.uuid) || single_page_preview?) %>
|
5
|
+
<editable-content id="<%= component.id %>"
|
6
|
+
class="fb-editable govuk-!-margin-top-8"
|
7
|
+
type="<%= component.type %>"
|
8
|
+
default-content="<%= default_text('content') %>"
|
9
|
+
content="<%= component.content %>"
|
10
|
+
data-fb-content-id="<%= "page[#{component.collection}[#{index}]]" %>"
|
11
|
+
data-config="<%= component.to_json %>"
|
12
|
+
data-conditional-api-path="<%= editable? ? URI.decode_www_form_component(api_service_edit_conditional_content_path(service.service_id, component.uuid)) : '' %>"
|
13
|
+
data-controller="orderable-item component"
|
14
|
+
data-orderable-item-order-value="<%= component.order || index %>"
|
15
|
+
data-orderable-items-target="orderableItem"
|
16
|
+
data-action="orderable-item:move->orderable-items#reorder
|
17
|
+
orderable-item:move->component#focus
|
18
|
+
orderable-item:orderUpdated->component#update
|
19
|
+
questionRemove->component#destroy"
|
20
|
+
data-orderable-item-moving-class="moving">
|
21
|
+
<div class="html">
|
22
|
+
<%= to_html(component.content) %>
|
23
|
+
</div>
|
24
|
+
</editable-content>
|
25
|
+
<% else %>
|
26
|
+
<div class="fb-editable govuk-!-margin-top-8"
|
27
|
+
id="<%= component.id %>"
|
28
|
+
data-fb-content-type="<%= component.type %>"
|
29
|
+
data-fb-content-id="<%= "page[#{component.collection}[#{index}]]" %>"
|
30
|
+
data-fb-content-data="<%= component.to_json %>"
|
31
|
+
data-fb-default-value="<%= default_title(component.type) %>"
|
32
|
+
data-fb-default-item-value="<%= default_item_title(component.type) %>"
|
33
|
+
data-controller="orderable-item component"
|
34
|
+
data-orderable-item-order-value="<%= component.order || index %>"
|
35
|
+
data-orderable-items-target="orderableItem"
|
36
|
+
data-action="orderable-item:move->orderable-items#reorder
|
37
|
+
orderable-item:move->component#focus
|
38
|
+
orderable-item:orderUpdated->component#update
|
39
|
+
questionRemove->component#destroy"
|
40
|
+
data-orderable-item-moving-class="moving">
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
component: component,
|
44
|
-
component_id: "page[#{component.collection}[#{index}]]",
|
45
|
-
input_title: main_title(
|
42
|
+
<%= render partial: component, locals: {
|
43
|
+
f: f,
|
46
44
|
component: component,
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
component_id: "page[#{component.collection}[#{index}]]",
|
46
|
+
input_title: main_title(
|
47
|
+
component: component,
|
48
|
+
tag: :h2,
|
49
|
+
classes: classes
|
50
|
+
)
|
51
|
+
}
|
52
|
+
%>
|
53
|
+
</div>
|
54
|
+
<% end %>
|
53
55
|
<% end %>
|
54
|
-
|
56
|
+
</div>
|
@@ -14,7 +14,6 @@
|
|
14
14
|
<%= hidden_field_tag :authenticity_token, form_authenticity_token -%>
|
15
15
|
<%= f.govuk_error_summary(t('presenter.errors.summary_heading')) %>
|
16
16
|
|
17
|
-
<div class="components" data-controller="orderable-items">
|
18
17
|
<%= render partial: 'metadata_presenter/component/components', locals: {
|
19
18
|
f: f,
|
20
19
|
components: @page.components,
|
@@ -24,7 +23,7 @@
|
|
24
23
|
content_components: @page.supported_content_components
|
25
24
|
}
|
26
25
|
%>
|
27
|
-
|
26
|
+
|
28
27
|
<div class="govuk-button-group">
|
29
28
|
<%= f.govuk_submit(t('presenter.actions.continue'), disabled: editable?) %>
|
30
29
|
|
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: 3.3.
|
4
|
+
version: 3.3.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MoJ Forms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_design_system_formbuilder
|