metadata_presenter 0.13.5 → 0.14.2
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 +4 -0
- data/app/controllers/metadata_presenter/submissions_controller.rb +12 -0
- data/app/views/metadata_presenter/component/_text.html.erb +8 -6
- data/app/views/metadata_presenter/component/_textarea.html.erb +12 -10
- data/app/views/metadata_presenter/page/checkanswers.html.erb +19 -9
- data/app/views/metadata_presenter/page/singlequestion.html.erb +2 -1
- data/app/views/metadata_presenter/page/start.html.erb +1 -1
- 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: e734af87f9a4682f32efe7a2b91aac95f11cbbb7ad64381fb8c65577618d6ebc
|
4
|
+
data.tar.gz: 427c3c1799e4052526343ef30589ca289bd513fb6c80ad13c6f6e449783fae1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c34c9b019d624f74b8924f04a9a01d22891d86d5f3bb4f803c25f0a15c8d56cc59d58fe4a51c5f968946f435aeaecba24c235453853dca00e31d034109b113f
|
7
|
+
data.tar.gz: 2df23b52496f0a3d37eab244b79d365f59d124fd46d390b5041fffea198709ecaf402d29a92cbce669055803c337c0809b8497d1e7d3967c24584764e5594165
|
data/README.md
CHANGED
@@ -48,6 +48,7 @@ that you need to write the following methods in your controller:
|
|
48
48
|
1. save_user_data
|
49
49
|
2. load_user_data
|
50
50
|
3. editable?
|
51
|
+
4. create_submission
|
51
52
|
|
52
53
|
The user answers can be accessed via `params[:answers]`.
|
53
54
|
|
@@ -76,6 +77,9 @@ mountable app:
|
|
76
77
|
end
|
77
78
|
```
|
78
79
|
|
80
|
+
The `create_submission` is related to process the submission in a backend
|
81
|
+
service.
|
82
|
+
|
79
83
|
## Generate documentation
|
80
84
|
|
81
85
|
Run `rake doc` and open the doc/index.html
|
@@ -4,10 +4,22 @@ module MetadataPresenter
|
|
4
4
|
@page = service.confirmation_page
|
5
5
|
|
6
6
|
if @page
|
7
|
+
create_submission
|
7
8
|
redirect_to_page @page.url
|
8
9
|
else
|
9
10
|
not_found
|
10
11
|
end
|
11
12
|
end
|
13
|
+
|
14
|
+
def create_submission
|
15
|
+
# The runner is the only app that sends the submission.
|
16
|
+
# and it is not needed on the editor app (editing & previewing).
|
17
|
+
# So in the Runner we defined the #create_submission in the parent
|
18
|
+
# controller and in the Editor we don't.
|
19
|
+
#
|
20
|
+
if defined? super
|
21
|
+
super
|
22
|
+
end
|
23
|
+
end
|
12
24
|
end
|
13
25
|
end
|
@@ -1,6 +1,8 @@
|
|
1
|
-
<%=
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<div class="fb-editable" data-fb-content-type="<%= component._type %>" data-fb-content-id="<%= component_id %>" data-fb-content-data="<%= component.to_json %>">
|
2
|
+
<%=
|
3
|
+
f.govuk_text_field component.id.to_sym,
|
4
|
+
label: { text: input_title },
|
5
|
+
hint: { text: component.hint },
|
6
|
+
name: "answers[#{component.name}]"
|
7
|
+
%>
|
8
|
+
</div>
|
@@ -1,10 +1,12 @@
|
|
1
|
-
<%=
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
<div class="fb-editable" data-fb-content-type="<%= component._type %>" data-fb-content-id="<%= component_id %>" data-fb-content-data="<%= component.to_json %>">
|
2
|
+
<%=
|
3
|
+
f.govuk_text_area component.id.to_sym,
|
4
|
+
label: { text: input_title },
|
5
|
+
hint: { text: component.hint },
|
6
|
+
name: "answers[#{component.name}]",
|
7
|
+
max_chars: component.maxchars,
|
8
|
+
max_words: component.maxwords,
|
9
|
+
threshold: component.threshold,
|
10
|
+
rows: component.rows
|
11
|
+
%>
|
12
|
+
</div>
|
@@ -1,25 +1,33 @@
|
|
1
1
|
<div class="govuk-grid-row">
|
2
2
|
<div class="govuk-grid-column-two-thirds">
|
3
3
|
<% if @page.section_heading.present? %>
|
4
|
-
<p class="govuk-caption-l fb-section-heading"
|
4
|
+
<p class="govuk-caption-l fb-section-heading"
|
5
|
+
data-fb-content-type="element"
|
6
|
+
data-fb-content-id="page[section_heading]">
|
5
7
|
<%= @page.section_heading %>
|
6
8
|
</p>
|
7
9
|
<% end %>
|
8
10
|
|
9
11
|
<% if @page.heading.present? %>
|
10
|
-
<h1 class="
|
12
|
+
<h1 class="fb-editable fb-editable govuk-heading-xl"
|
13
|
+
data-fb-content-type="element"
|
14
|
+
data-fb-content-id="page[heading]">
|
11
15
|
<%= @page.heading %>
|
12
16
|
</h1>
|
13
17
|
<% end %>
|
14
18
|
|
15
19
|
<% if @page.lede.present? %>
|
16
|
-
<p class="govuk-body-l"
|
20
|
+
<p class="fb-editable govuk-body-l"
|
21
|
+
data-fb-content-type="element"
|
22
|
+
data-fb-content-id="page[lede]">
|
17
23
|
<%= @page.lede %>
|
18
24
|
</p>
|
19
25
|
<% end %>
|
20
26
|
|
21
27
|
<% if @page.body.present? %>
|
22
|
-
<div class="fb-body govuk-prose-scope"
|
28
|
+
<div class="fb-editable fb-body govuk-prose-scope"
|
29
|
+
data-fb-content-type="content"
|
30
|
+
data-fb-content-id="page[body]">
|
23
31
|
<p><%= @page.body %></p>
|
24
32
|
</div>
|
25
33
|
<% end %>
|
@@ -51,16 +59,18 @@
|
|
51
59
|
</div>
|
52
60
|
|
53
61
|
<% if @page.send_heading.present? %>
|
54
|
-
<h2 class="fb-send-heading govuk-heading-m"
|
62
|
+
<h2 class="fb-editable fb-send-heading govuk-heading-m"
|
63
|
+
data-fb-content-type="element"
|
64
|
+
data-fb-content-id="page[send_heading]">
|
55
65
|
<%= @page.send_heading %>
|
56
66
|
</h2>
|
57
67
|
<% end %>
|
58
68
|
|
59
69
|
<% if @page.send_body.present? %>
|
60
|
-
<div class="fb-send-body"
|
61
|
-
|
62
|
-
|
63
|
-
|
70
|
+
<div class="fb-editable fb-send-body"
|
71
|
+
data-fb-content-type="content"
|
72
|
+
data-fb-content-id="page[send_body]">
|
73
|
+
<%= @page.send_body %>
|
64
74
|
</div>
|
65
75
|
<% end %>
|
66
76
|
|
@@ -3,9 +3,10 @@
|
|
3
3
|
<div class="govuk-grid-column-two-thirds">
|
4
4
|
<%= form_for @page_answers, as: :answers, url: @page.url, method: :post do |f| %>
|
5
5
|
<%= f.govuk_error_summary %>
|
6
|
-
<% @page.components.
|
6
|
+
<% @page.components.each_with_index do |component, index| %>
|
7
7
|
<%= render partial: component, locals: {
|
8
8
|
component: component,
|
9
|
+
component_id: "page[components[#{index}]]",
|
9
10
|
f: f,
|
10
11
|
input_title: main_h1(component) }
|
11
12
|
%>
|
@@ -35,7 +35,7 @@
|
|
35
35
|
|
36
36
|
<%= form_tag(root_path, method: :post) do %>
|
37
37
|
<button <%= 'disabled' if editable? %> class='govuk-button govuk-button--start govuk-!-margin-top-2'>
|
38
|
-
|
38
|
+
Start now
|
39
39
|
<svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" aria-hidden="true" focusable="false">
|
40
40
|
<path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
|
41
41
|
</svg>
|
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: 0.
|
4
|
+
version: 0.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MoJ Online
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|