metadata_presenter 0.13.4 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de545a65e6ccee32e11d74efe9a5932294cbcb8b09a40cc63ad808f68fecd7c2
4
- data.tar.gz: ba5459e1f91ae72bb860b8f1aa31cc5501240c60c9fa50fafee4da1af9f11f49
3
+ metadata.gz: 62bc32f79aaa47a6cef4fc1e0b4dbd9a03475895eae570b8dcded8c40ad3e342
4
+ data.tar.gz: 996b9bcd3912c1ae40c63cd9b1aca11686ff9b259e294afb56c777d127cac30d
5
5
  SHA512:
6
- metadata.gz: 31704652aee121aee8686f5416facb56d950a7fcdd86a396aab43381647db1b5dc4ba763cc62d4ebb66f546da3413259416b44cf1a764cbccbcdf12fd98e6924
7
- data.tar.gz: b8e3c60faa3d8085d6126c21e327ff9572699b1b651d15236ae4a16915059082bab167fb3a2f3e57238ff80c76888eb84861738764a111d6082ff62e1bd08d73
6
+ metadata.gz: f4143a24d340be5eed742db6c5f3e2252bb3cf701324832f27ab32380eaceec97bdc9bcce11e9a2cfe7f3ed84b45c7736d192b7a29ba7141cc84a6a099e1f995
7
+ data.tar.gz: 6bb345360715fcea5030274afae0ef0aa7e42f9a118d8428ceab0d250758abad7b64f226a5e4311188f1b66698712ba142315ad58adbcabebc62fb7d8dedef3c
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
- 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>
@@ -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,33 +1,41 @@
1
- <div class="fb-main-grid-wrapper" data-block-id="<%= @page.id %>" data-block-type="page" data-block-pagetype="<%= @page.type %>">
1
+ <div class="fb-main-grid-wrapper" data-fb-pagetype="<%= @page.type %>">
2
2
  <div class="govuk-grid-row">
3
3
  <div class="govuk-grid-column-two-thirds">
4
4
  <% if @page.section_heading -%>
5
- <p class="govuk-caption-l fb-section_heading" data-block-id="<%= @page.id %>" data-block-property="section_heading">
5
+ <p class="fb-editable govuk-caption-l fb-section_heading"
6
+ data-fb-content-type="element"
7
+ data-fb-content-id="page[section_heading]">
6
8
  <%= @page.section_heading.html_safe %>
7
9
  </p>
8
10
  <%- end %>
9
11
 
10
12
  <% if @page.heading %>
11
- <h1 class="<%= @page.heading_class %>" data-block-id="<%= @page.id %>" data-block-property="heading">
13
+ <h1 class="fb-editable <%= @page.heading_class %>"
14
+ data-fb-content-id="page[heading]"
15
+ data-fb-content-type="element">
12
16
  <%= @page.heading.html_safe %>
13
17
  </h1>
14
18
  <% end %>
15
19
 
16
20
  <% if @page.lede %>
17
- <p class="govuk-body-l" data-block-id="<%= @page.id %>" data-block-property="lede">
21
+ <div class="fb-editable"
22
+ data-fb-content-id="page[lede]"
23
+ data-fb-content-type="content">
18
24
  <%= @page.lede.html_safe %>
19
- </p>
25
+ </div>
20
26
  <%- end %>
21
27
 
22
28
  <% if @page.body %>
23
- <p class="govuk-body-l" data-block-id="<%= @page.id %>" data-block-property="lede">
24
- <%= to_markdown(@page.body) %>
25
- </p>
29
+ <div class="fb-editable"
30
+ data-fb-content-id="page[body]"
31
+ data-fb-content-type="content">
32
+ <%= to_markdown(@page.body) %>
33
+ </div>
26
34
  <%- end %>
27
35
 
28
36
  <%= form_tag(root_path, method: :post) do %>
29
37
  <button <%= 'disabled' if editable? %> class='govuk-button govuk-button--start govuk-!-margin-top-2'>
30
- Start
38
+ Start now
31
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">
32
40
  <path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
33
41
  </svg>
@@ -35,9 +43,11 @@
35
43
  <% end %>
36
44
 
37
45
  <% if @page.before_you_start %>
38
- <p class="govuk-body-l" data-block-id="<%= @page.id %>" data-block-property="before-you-start">
39
- <%= to_markdown(@page.before_you_start) %>
40
- </p>
46
+ <div class="fb-editable"
47
+ data-fb-content-id="page[before_you_start]"
48
+ data-fb-content-type="content">
49
+ <%= to_markdown(@page.before_you_start) %>
50
+ </div>
41
51
  <%- end %>
42
52
  </div>
43
53
  </div>
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '0.13.4'
2
+ VERSION = '0.14.1'
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.4
4
+ version: 0.14.1
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-17 00:00:00.000000000 Z
11
+ date: 2021-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails