metadata_presenter 0.13.6 → 0.15.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99966bf36bf6ab26561715bdaf04ebd5418fd384ee72c29e63a88a3d9ec66a3c
4
- data.tar.gz: 17bb64ca45b15dc5744c668fcb8d24d8795876b1d97a6e111aae530a64a55cc1
3
+ metadata.gz: a57847bf1b54066efd54ee0b129eb32c6cceb29251f0a8e59a9b5b762a78b240
4
+ data.tar.gz: a871cd1bc5356662288a8f48e48fce9c965080ef9fba3e93837a322c1ee49d58
5
5
  SHA512:
6
- metadata.gz: 104d633d1375cdae3936efeed3c02cec7b7d82f293ad4e12d0e8ebb0ea94ffa3b3aa9776542839c590700bf88a23150433a6da9c0ff5b6c27e4206caa5de3e3a
7
- data.tar.gz: c7c192e99dad1b1564790de8bc3a813880c3da0f1dd0eb87372109248f5f82b8de897f215d20f36b63b3774cc9b6e9fabbd40d2eaba0036bd8b3397d13c4c67f
6
+ metadata.gz: c33ac7743bcabc8a970cdbfde9ee5cbc9ceafd57de3bb2dd0e109230faa907d7ac3b537c48ee3f5ebcdfbbac112953b775ba1adae57b7882da4ee3017e1092d7
7
+ data.tar.gz: 450f0e38ba04a8f341d5fca108d597d5ecc5846019fb102098d0bcab6b36419c84e98bdded8bde440db6882f8928af5f7163cc6e08c62198f55bf6dc14e4f728
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
@@ -27,6 +27,8 @@
27
27
  <%= yield %>
28
28
  </main>
29
29
  </div>
30
+ <%= render template: 'metadata_presenter/footer/footer' %>
31
+
30
32
  <%= javascript_pack_tag 'application' %>
31
33
  <%= javascript_pack_tag 'govuk' %>
32
34
  </body>
@@ -1,6 +1,8 @@
1
- <%=
2
- f.govuk_text_field component.id.to_sym,
3
- label: { text: input_title },
4
- hint: { text: component.hint },
5
- name: "answers[#{component.name}]"
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
- f.govuk_text_area component.id.to_sym,
3
- label: { text: input_title },
4
- hint: { text: component.hint },
5
- name: "answers[#{component.name}]",
6
- max_chars: component.maxchars,
7
- max_words: component.maxwords,
8
- threshold: component.threshold,
9
- rows: component.rows
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>
@@ -0,0 +1,19 @@
1
+ <footer class="govuk-footer " role="contentinfo">
2
+ <div class="govuk-width-container ">
3
+ <div class="govuk-footer__meta">
4
+ <div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
5
+
6
+ <svg aria-hidden="true" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 483.2 195.7" height="17" width="41">
7
+ <path fill="currentColor" d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145" />
8
+ </svg>
9
+ <span class="govuk-footer__licence-description">
10
+ All content is available under the
11
+ <a class="govuk-footer__link" href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" rel="license">Open Government Licence v3.0</a>, except where otherwise stated
12
+ </span>
13
+ </div>
14
+ <div class="govuk-footer__meta-item">
15
+ <a class="govuk-footer__link govuk-footer__copyright-logo" href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/">© Crown copyright</a>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </footer>
@@ -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" data-block-id="<%= @page.id %>" data-block-property="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="govuk-heading-xl" data-block-id="<%= @page.id %>" data-block-property="heading">
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" data-block-id="<%= @page.id %>" data-block-property="lede">
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" data-block-id="<%= @page.id %>" data-block-property="body">
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" data-block-id="<%= @page.id %>" data-block-property="send_heading">
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" data-block-id="<%= @page.id %>" data-block-property="send_body">
61
- <p>
62
- <%= @page.send_body %>
63
- </p>
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.each do |component| %>
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
  %>
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '0.13.6'
2
+ VERSION = '0.15.0'
3
3
  end
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.13.6
4
+ version: 0.15.0
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-02-22 00:00:00.000000000 Z
11
+ date: 2021-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -256,6 +256,7 @@ files:
256
256
  - app/views/metadata_presenter/component/_radios.html.erb
257
257
  - app/views/metadata_presenter/component/_text.html.erb
258
258
  - app/views/metadata_presenter/component/_textarea.html.erb
259
+ - app/views/metadata_presenter/footer/footer.html.erb
259
260
  - app/views/metadata_presenter/header/show.html.erb
260
261
  - app/views/metadata_presenter/page/checkanswers.html.erb
261
262
  - app/views/metadata_presenter/page/confirmation.html.erb