udongo 5.8.0 → 5.9.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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/backend/general.js +1 -0
  3. data/app/assets/javascripts/backend/tree.js +2 -2
  4. data/app/controllers/backend/forms/base_controller.rb +9 -0
  5. data/app/controllers/backend/forms/fields_controller.rb +63 -0
  6. data/app/controllers/backend/forms/submissions_controller.rb +23 -0
  7. data/app/controllers/backend/forms_controller.rb +58 -0
  8. data/app/decorators/form_decorator.rb +7 -0
  9. data/app/decorators/form_submission_data_decorator.rb +9 -0
  10. data/app/forms/backend/form_field_translation_form.rb +8 -0
  11. data/app/forms/backend/form_translation_form.rb +7 -0
  12. data/app/helpers/link_helper.rb +21 -11
  13. data/app/models/form.rb +10 -0
  14. data/app/models/form_field.rb +13 -0
  15. data/app/models/form_submission.rb +19 -0
  16. data/app/models/form_submission_data.rb +17 -0
  17. data/app/views/backend/articles/index.html.erb +1 -1
  18. data/app/views/backend/email_templates/index.html.erb +1 -1
  19. data/app/views/backend/forms/_fields.html.erb +42 -0
  20. data/app/views/backend/forms/_form.html.erb +24 -0
  21. data/app/views/backend/forms/_tabs.html.erb +29 -0
  22. data/app/views/backend/forms/edit.html.erb +5 -0
  23. data/app/views/backend/forms/edit_translation.html.erb +20 -0
  24. data/app/views/backend/forms/fields/_form.html.erb +34 -0
  25. data/app/views/backend/forms/fields/_tabs.html.erb +21 -0
  26. data/app/views/backend/forms/fields/edit.html.erb +6 -0
  27. data/app/views/backend/forms/fields/edit_translation.html.erb +25 -0
  28. data/app/views/backend/forms/fields/index.html.erb +44 -0
  29. data/app/views/backend/forms/fields/new.html.erb +5 -0
  30. data/app/views/backend/forms/index.html.erb +51 -0
  31. data/app/views/backend/forms/new.html.erb +4 -0
  32. data/app/views/backend/forms/submissions/_form.html.erb +0 -0
  33. data/app/views/backend/forms/submissions/index.html.erb +40 -0
  34. data/app/views/backend/forms/submissions/show.html.erb +20 -0
  35. data/app/views/backend/navigations/index.html.erb +2 -2
  36. data/app/views/backend/snippets/index.html.erb +3 -3
  37. data/app/views/layouts/backend/_top_navigation.html.erb +1 -0
  38. data/changelog.md +11 -0
  39. data/config/locales/en_backend.yml +25 -0
  40. data/config/locales/en_forms.yml +3 -0
  41. data/config/locales/nl_backend.yml +25 -0
  42. data/config/locales/nl_forms.yml +4 -0
  43. data/config/routes.rb +9 -0
  44. data/db/migrate/20170407115044_readd_forms.rb +39 -0
  45. data/db/migrate/20170410115600_rename_name_to_identifier_for_form_field.rb +5 -0
  46. data/db/migrate/20170410120608_remove_placeholder_from_form_fields.rb +5 -0
  47. data/db/migrate/20170410121055_remove_default_value_from_form_fields.rb +5 -0
  48. data/db/migrate/20170411161008_add_validation_fields_to_form_fields.rb +6 -0
  49. data/lib/udongo/configs/forms.rb +18 -0
  50. data/lib/udongo/pages/tree_node.rb +1 -1
  51. data/lib/udongo/version.rb +1 -1
  52. data/spec/factories/form_fields.rb +7 -0
  53. data/spec/factories/form_submission_data.rb +7 -0
  54. data/spec/factories/form_submissions.rb +5 -0
  55. data/spec/factories/forms.rb +5 -0
  56. metadata +40 -2
@@ -0,0 +1,29 @@
1
+ <div class="row subnav">
2
+ <div class="col-md-12">
3
+ <ul class="nav nav-pills pull-left">
4
+ <li class="nav-item">
5
+ <% klass = %w(nav-link) %>
6
+ <% klass << 'active' if active == :general %>
7
+
8
+ <%= link_to t('b.general'), edit_backend_form_path(@model), class: klass %>
9
+ </li>
10
+
11
+ <% Udongo.config.i18n.app.locales.each do |locale| %>
12
+ <li class="nav-item">
13
+ <% klass = %w(nav-link) %>
14
+ <% klass << 'active' if active == locale.to_sym %>
15
+
16
+ <%= link_to locale.upcase, edit_translation_backend_form_path(@model, locale), class: klass %>
17
+ </li>
18
+ <% end %>
19
+ </ul>
20
+
21
+ <% if @model.submissions.any? %>
22
+ <div class="pull-right">
23
+ <%= link_to backend_form_submissions_path(@model), class: 'btn btn-primary' do %>
24
+ <%= icon(:envelope_open, t('b.msg.forms.view_submissions')) %>
25
+ <% end %>
26
+ </div>
27
+ <% end %>
28
+ </div>
29
+ </div>
@@ -0,0 +1,5 @@
1
+ <% breadcrumb.add @model.description %>
2
+ <%= render 'backend/breadcrumbs' %>
3
+
4
+ <%= render 'backend/forms/tabs', active: :general %>
5
+ <%= render 'backend/forms/form' %>
@@ -0,0 +1,20 @@
1
+ <% breadcrumb.add @model.description, edit_backend_form_path(@model) %>
2
+ <% breadcrumb.add t('b.edit') %>
3
+ <%= render 'backend/breadcrumbs' %>
4
+
5
+ <%= render 'backend/forms/tabs', active: params[:translation_locale].to_sym %>
6
+ <%= render 'backend/general_form_error', object: @translation %>
7
+
8
+ <%= simple_form_for([:backend, @translation], url: edit_translation_backend_form_path) do |f| %>
9
+ <div class="card">
10
+ <div class="card-header">
11
+ <%= t 'b.content' %>
12
+ </div>
13
+
14
+ <div class="card-block">
15
+ <%= f.input :success_message, as: :ckeditor %>
16
+ </div>
17
+ </div>
18
+
19
+ <%= render 'backend/form_actions', cancel_url: backend_forms_path %>
20
+ <% end %>
@@ -0,0 +1,34 @@
1
+ <%= render 'backend/general_form_error', object: @field %>
2
+
3
+ <%= simple_form_for [:backend, @field], url: url do |f| %>
4
+ <div class="row">
5
+ <div class="col-md-6">
6
+ <div class="card">
7
+ <div class="card-header">
8
+ <%= t 'b.general' %>
9
+ </div>
10
+
11
+ <div class="card-block">
12
+ <%= f.input :identifier %>
13
+ <%# FIXME: This should be a dropdown once we know the exact types to use. %>
14
+ <%= f.input :field_type %>
15
+ </div>
16
+ </div>
17
+ </div>
18
+
19
+ <div class="col-md-6">
20
+ <div class="card">
21
+ <div class="card-header">
22
+ <%= t 'b.validations' %>
23
+ </div>
24
+
25
+ <div class="card-block">
26
+ <%= f.input :presence %>
27
+ <%= f.input :email %>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </div>
32
+
33
+ <%= render 'backend/form_actions', cancel_url: edit_backend_form_path(@form) %>
34
+ <% end %>
@@ -0,0 +1,21 @@
1
+ <div class="row subnav">
2
+ <div class="col-md-12">
3
+ <ul class="nav nav-pills pull-left">
4
+ <li class="nav-item">
5
+ <% klass = %w(nav-link) %>
6
+ <% klass << 'active' if active == :general %>
7
+
8
+ <%= link_to t('b.general'), edit_backend_form_field_path(@form, @field), class: klass %>
9
+ </li>
10
+
11
+ <% Udongo.config.i18n.app.locales.each do |locale| %>
12
+ <li class="nav-item">
13
+ <% klass = %w(nav-link) %>
14
+ <% klass << 'active' if active == locale.to_sym %>
15
+
16
+ <%= link_to locale.upcase, edit_translation_backend_form_field_path(@form, @field, locale), class: klass %>
17
+ </li>
18
+ <% end %>
19
+ </ul>
20
+ </div>
21
+ </div>
@@ -0,0 +1,6 @@
1
+ <% breadcrumb.add t('b.form_fields'), backend_form_fields_path(@form) %>
2
+ <% breadcrumb.add t('b.edit') %>
3
+ <%= render 'backend/breadcrumbs' %>
4
+
5
+ <%= render 'backend/forms/fields/tabs', active: :general %>
6
+ <%= render 'backend/forms/fields/form', url: backend_form_field_path(@form, @field) %>
@@ -0,0 +1,25 @@
1
+ <% breadcrumb.add t('b.form_fields'), backend_form_fields_path(@form) %>
2
+ <% breadcrumb.add t('b.edit_translation') %>
3
+ <%= render 'backend/breadcrumbs' %>
4
+
5
+ <%= render 'backend/forms/fields/tabs', active: params[:translation_locale].to_sym %>
6
+ <%= render 'backend/general_form_error', object: @translation %>
7
+
8
+ <%= simple_form_for([:backend, @translation], url: edit_translation_backend_form_field_path) do |f| %>
9
+ <div class="row">
10
+ <div class="col-md-6">
11
+ <div class="card">
12
+ <div class="card-header">
13
+ <%= t 'b.content' %>
14
+ </div>
15
+
16
+ <div class="card-block">
17
+ <%= f.input :label %>
18
+ <%= f.input :default_value %>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </div>
23
+
24
+ <%= render 'backend/form_actions', cancel_url: backend_forms_path %>
25
+ <% end %>
@@ -0,0 +1,44 @@
1
+ <% javascript 'backend/sortable' %>
2
+
3
+ <% breadcrumb.add t('b.form_fields') %>
4
+ <%= render 'backend/breadcrumbs' %>
5
+
6
+ <% if @form.fields.any? %>
7
+ <table class="table table-striped table-hover">
8
+ <thead class="thead-inverse">
9
+ <tr>
10
+ <th><%= t('b.name') %></th>
11
+ <th>&nbsp;</th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <tfoot>
16
+ <tr>
17
+ <td colspan="2" class="text-xs-center">
18
+ <%= link_to icon(:plus, t('b.msg.form_fields.add')), new_backend_form_field_path(@form), class: 'btn btn-primary' %>
19
+ </td>
20
+ </tr>
21
+ </tfoot>
22
+
23
+ <tbody>
24
+ <% @form.fields.each do |f| %>
25
+ <tr data-update-position="<%= update_position_backend_form_field_path(@form, f) %>">
26
+ <td><%= f.identifier %></td>
27
+ <td class="text-xs-right">
28
+ <%= link_to_edit edit_backend_form_field_path(@form, f) %>
29
+ <%= link_to_delete backend_form_field_path(@form, f) %>
30
+ </td>
31
+ </tr>
32
+ <% end %>
33
+ </tbody>
34
+ </table>
35
+ <% else %>
36
+ <div class="text-xs-center">
37
+ <p>
38
+ <%= t('b.msg.form_fields.explanation') %>
39
+ </p>
40
+ <p>
41
+ <%= link_to t('b.msg.form_fields.add_first'), new_backend_form_field_path(@form), class: 'btn btn-primary' %>
42
+ </p>
43
+ </div>
44
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% breadcrumb.add t('b.form_fields'), backend_form_fields_path(@form) %>
2
+ <% breadcrumb.add t('b.add') %>
3
+ <%= render 'backend/breadcrumbs' %>
4
+
5
+ <%= render 'backend/forms/fields/form', url: backend_form_fields_path(@form) %>
@@ -0,0 +1,51 @@
1
+ <%= render 'backend/breadcrumbs' %>
2
+
3
+ <% if @forms.any? %>
4
+ <table class="table table-striped table-hover">
5
+ <thead class="thead-inverse">
6
+ <tr>
7
+ <th><%= t 'b.description' %></th>
8
+ <th><%= t 'b.form_fields' %></th>
9
+ <th><%= t 'b.form_submissions' %></th>
10
+ <th>&nbsp;</th>
11
+ </tr>
12
+ </thead>
13
+
14
+ <tbody>
15
+ <% @forms.each do |f| %>
16
+ <tr>
17
+ <td>
18
+ <%= f.description %>
19
+ </td>
20
+ <td>
21
+ <% if f.fields.none? %>
22
+ 0
23
+ <% else %>
24
+ <%= f.fields.size %> (<%= link_to t('b.overview').downcase, backend_form_fields_path(f) %>)
25
+ <% end %>
26
+ </td>
27
+ <td>
28
+ <% if f.submissions.none? %>
29
+ 0
30
+ <% else %>
31
+ <%= f.submissions.size %> (<%= link_to t('b.overview').downcase, backend_form_submissions_path(f) %>)
32
+ <% end %>
33
+ </td>
34
+ <td class="text-xs-right">
35
+ <%= link_to_edit [:backend, f] %>
36
+
37
+ <% if f.submissions.any? %>
38
+ <%= link_to icon(:trash), '#', data: { toggle: 'tooltip' }, title: t('b.msg.forms.removal_warning', submissions: f.submissions.size) %>
39
+ <% else %>
40
+ <%= link_to_delete [:backend, f] %>
41
+ <% end %>
42
+ </td>
43
+ </tr>
44
+ <% end %>
45
+ </tbody>
46
+ </table>
47
+
48
+ <% else %>
49
+ <p><%= t('b.msg.forms.explanation') %></p>
50
+ <%= link_to t('b.msg.forms.add_first'), new_backend_form_path, class: 'btn btn-primary' %>
51
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <% breadcrumb.add t('b.add') %>
2
+ <%= render 'backend/breadcrumbs' %>
3
+
4
+ <%= render 'backend/forms/form' %>
@@ -0,0 +1,40 @@
1
+ <% breadcrumb.add t('b.form_submissions') %>
2
+
3
+ <%= render 'backend/breadcrumbs' %>
4
+
5
+ <% if @submissions.any? %>
6
+ <table class="table table-striped table-hover">
7
+ <thead class="thead-inverse">
8
+ <tr>
9
+ <% if @form.email_present? %>
10
+ <th><%= t('b.email') %></th>
11
+ <% end %>
12
+ <th>&nbsp;</th>
13
+ </tr>
14
+ </thead>
15
+
16
+ <tfoot>
17
+ <tr>
18
+ <td colspan="2" class="text-xs-center">
19
+ <%= udongo_paginate @submissions %><br>
20
+ </td>
21
+ </tr>
22
+ </tfoot>
23
+
24
+ <tbody>
25
+ <% @submissions.each do |s| %>
26
+ <tr>
27
+ <% if @form.email_present? %>
28
+ <td><%= mail_to s.data_object.email %></td>
29
+ <% end %>
30
+ <td class="text-xs-right">
31
+ <%= link_to_show backend_form_submission_path(@form, s) %>
32
+ <%= link_to_delete backend_form_submission_path(@form, s) %>
33
+ </td>
34
+ </tr>
35
+ <% end %>
36
+ </tbody>
37
+ </table>
38
+ <% else %>
39
+ <p><%= t 'b.msg.form_submissions.explanation' %></p>
40
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <% breadcrumb.add t('b.form_submissions'), backend_form_submissions_path(@form) %>
2
+ <% breadcrumb.add @model.data_object.email %>
3
+
4
+ <%= render 'backend/breadcrumbs' %>
5
+
6
+ <div class="card">
7
+ <div class="card-block">
8
+ <dl>
9
+ <dt><%= t('b.msg.form_submissions.received_at') %></dt>
10
+ <dd><%= l(@model.created_at) %></dd>
11
+
12
+ <% @model.data.decorate.each do |d| %>
13
+ <dt><%= d.label %></dt>
14
+ <dd><%= d.value %></dd>
15
+ <% end %>
16
+ </dl>
17
+ </div>
18
+ </div>
19
+
20
+ <%= link_to t('b.msg.form_submissions.back_html'), backend_form_submissions_path(@form), class: 'btn btn-secondary' %>
@@ -33,8 +33,8 @@
33
33
  <td><%= i.translation.path %></td>
34
34
  <td><%= i.extra %></td>
35
35
  <td class="text-xs-right">
36
- <%= link_to icon(:pencil_square_o), edit_backend_navigation_item_path(n, i) %>
37
- <%= link_to icon(:trash), backend_navigation_item_path(n, i), method: :delete, data: { confirm: t('b.msg.confirm') }%>
36
+ <%= link_to_edit edit_translation_backend_navigation_item_path(n, i, default_app_locale) %>
37
+ <%= link_to_delete backend_navigation_item_path(n, i) %>
38
38
  </td>
39
39
  </tr>
40
40
  <% end %>
@@ -10,11 +10,11 @@
10
10
  </thead>
11
11
 
12
12
  <tbody>
13
- <% @snippets.each do |a| %>
13
+ <% @snippets.each do |s| %>
14
14
  <tr>
15
- <td><%= a.description %></td>
15
+ <td><%= s.description %></td>
16
16
  <td class="text-xs-right">
17
- <%= link_to_edit [:backend, a] %>
17
+ <%= link_to_edit_translation [:backend, s] %>
18
18
  </td>
19
19
  </tr>
20
20
  <% end %>
@@ -6,6 +6,7 @@
6
6
  <%= link_to t('b.articles'), backend_articles_path, class: 'dropdown-item' %>
7
7
  <%= link_to t('b.snippets'), backend_snippets_path, class: 'dropdown-item' %>
8
8
  <%= link_to t('b.files'), backend_assets_path, class: 'dropdown-item' %>
9
+ <%= link_to t('b.forms'), backend_forms_path, class: 'dropdown-item' %>
9
10
  </div>
10
11
  </li>
11
12
 
data/changelog.md CHANGED
@@ -1,3 +1,11 @@
1
+ 5.9.0 - 2017-05-04
2
+ --
3
+ * Fixes issue in pages module that prevented you from clicking the context
4
+ menu items.
5
+ * Make the link_to_show/edit/delete methods a bit more flexible.
6
+ * Clicking the snippet edit link now goes directly to the default app locale.
7
+
8
+
1
9
  5.8.0 - 2017-04-12
2
10
  --
3
11
  * Add missing ```author``` key to form translations.
@@ -16,6 +24,9 @@
16
24
  navigation by identifier.
17
25
  * You can now include ```Concerns::Searchable``` on models without flexible
18
26
  content and not receive errors as a result.
27
+ * You can now toggle Bootstrap tooltips through data-toggle="tooltip" and
28
+ specifying a value in the title field.
29
+ * Added a backend module to create and manage forms.
19
30
 
20
31
 
21
32
  5.6.0 - 2017-03-18
@@ -21,6 +21,7 @@ en:
21
21
  down: Down
22
22
  download: Download
23
23
  edit: Edit
24
+ edit_translation: Edit translation
24
25
  email: E-mail
25
26
  emails: E-mails
26
27
  email_template: E-mail template
@@ -32,6 +33,12 @@ en:
32
33
  filter: Filter
33
34
  first_name: First name
34
35
  flexible_content: Flexible content
36
+ form: Form
37
+ form_field: Input field
38
+ form_fields: Input fields
39
+ form_submission: Submission
40
+ form_submissions: Submissions
41
+ forms: Forms
35
42
  from: From
36
43
  general: General
37
44
  house_number: House number
@@ -51,6 +58,7 @@ en:
51
58
  none: None
52
59
  not_set: Not set
53
60
  not_yet_sent: Not yet sent
61
+ overview: Overview
54
62
  page: Page
55
63
  pages: Pages
56
64
  password: Password
@@ -86,6 +94,7 @@ en:
86
94
  used: Used
87
95
  user: User
88
96
  users: Users
97
+ validations: Validations
89
98
  variables: Variables
90
99
  view: View
91
100
  visible: Visible
@@ -116,6 +125,22 @@ en:
116
125
  explanation: With this module you can create flexible responsive content. Click the button below to create the first row.
117
126
  no_picture_present: No picture has been uploaded/linked yet.
118
127
  forgot_password: Forgot password?
128
+ form_fields:
129
+ add: Add input field
130
+ add_first: Create the first input field.
131
+ edit: Edit input field
132
+ explanation: No input fields have been added yet.
133
+ index_header_html: 'Input fields for form &ldquo;%{form}&rdquo;'
134
+ form_submissions:
135
+ back_html: '&larr; Back to the submissions overview'
136
+ explanation: There have been no submissions for this form yet.
137
+ received_at: Received at
138
+ forms:
139
+ add_first: Create your first form
140
+ back_html: '&larr; Back to the forms overview'
141
+ explanation: With this module you can manage forms and view their submissions.
142
+ removal_warning: "This form can't be removed because there are %{submissions} submission(s) linked to it."
143
+ view_submissions: Submissions for this form
119
144
  general_form_error: Something went wrong. Please check the marked fields.
120
145
  help_texts:
121
146
  status_code: More info about the use of status codes.