decidim-reporting_proposals 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint.yml +3 -3
  3. data/.github/workflows/test_integration.yml +19 -5
  4. data/.github/workflows/test_unit.yml +19 -5
  5. data/.gitignore +2 -0
  6. data/.rubocop.yml +1 -3
  7. data/.rubocop_ruby.yml +1 -2
  8. data/.ruby-version +1 -1
  9. data/.simplecov +14 -9
  10. data/Gemfile +6 -5
  11. data/Gemfile.lock +382 -400
  12. data/README.md +14 -9
  13. data/Rakefile +0 -2
  14. data/app/cells/concerns/decidim/reporting_proposals/linked_resources_for_cell_override.rb +23 -0
  15. data/app/cells/decidim/reporting_proposals/edit_note_modal/show.erb +22 -19
  16. data/app/commands/concerns/decidim/{proposals → reporting_proposals}/admin/answer_proposal_override.rb +2 -2
  17. data/app/commands/concerns/decidim/{proposals → reporting_proposals}/admin/assign_proposals_to_valuator_override.rb +1 -1
  18. data/app/commands/concerns/decidim/reporting_proposals/admin/update_category_override.rb +1 -1
  19. data/app/commands/concerns/decidim/reporting_proposals/admin/update_proposal_answer_template_override.rb +26 -0
  20. data/app/commands/concerns/decidim/{proposals → reporting_proposals}/publish_proposal_override.rb +2 -2
  21. data/app/commands/decidim/reporting_proposals/create_reporting_proposal.rb +1 -1
  22. data/app/commands/decidim/reporting_proposals/update_reporting_proposal.rb +38 -0
  23. data/app/controllers/concerns/decidim/reporting_proposals/admin/proposal_answer_templates_controller_override.rb +31 -0
  24. data/app/controllers/concerns/decidim/reporting_proposals/admin/proposal_answers_controller_override.rb +1 -1
  25. data/app/controllers/concerns/decidim/reporting_proposals/admin/proposals_controller_override.rb +3 -1
  26. data/app/controllers/concerns/decidim/reporting_proposals/admin/valuation_assignments_controller_override.rb +57 -0
  27. data/app/controllers/concerns/decidim/reporting_proposals/needs_proposal_extra_validations_snippets.rb +0 -1
  28. data/app/controllers/concerns/decidim/reporting_proposals/proposals_controller_override.rb +39 -0
  29. data/app/controllers/decidim/reporting_proposals/admin/proposals_controller.rb +4 -4
  30. data/app/controllers/decidim/reporting_proposals/geolocation_controller.rb +1 -1
  31. data/app/events/concerns/decidim/{proposals → reporting_proposals}/publish_proposal_event_override.rb +1 -1
  32. data/app/forms/concerns/decidim/reporting_proposals/form_builder_override.rb +9 -16
  33. data/app/forms/concerns/decidim/reporting_proposals/map_builder_override.rb +6 -5
  34. data/app/forms/decidim/reporting_proposals/admin/proposal_photo_form.rb +1 -5
  35. data/app/forms/decidim/reporting_proposals/proposal_form.rb +2 -0
  36. data/app/helpers/concerns/decidim/reporting_proposals/proposal_wizard_helper_override.rb +7 -30
  37. data/app/helpers/concerns/decidim/reporting_proposals/resource_helper_override.rb +1 -1
  38. data/app/mailers/concerns/decidim/reporting_proposals/admin/hidden_resource_mailer.rb +30 -0
  39. data/app/mailers/concerns/decidim/{proposals → reporting_proposals}/admin/notification_answer_proposal_mailer.rb +1 -1
  40. data/app/mailers/concerns/decidim/{proposals → reporting_proposals}/admin/proposals_valuator_mailer.rb +2 -2
  41. data/app/mailers/concerns/decidim/{proposals → reporting_proposals}/notification_publish_proposal_mailer.rb +1 -1
  42. data/app/mailers/concerns/decidim/reporting_proposals/reported_mailer_override.rb +18 -0
  43. data/app/overrides/decidim/proposals/admin/proposals/show/add_address.html.erb.deface +1 -1
  44. data/app/overrides/decidim/proposals/admin/proposals/show/add_photo_management.html.erb.deface +1 -1
  45. data/app/overrides/decidim/proposals/admin/proposals/show/add_send_email_btn.html.erb.deface +1 -1
  46. data/app/overrides/decidim/proposals/admin/proposals/show/add_valuators_form.html.erb.deface +16 -10
  47. data/app/overrides/decidim/proposals/proposals/_wizard_header/add_description.html.erb.deface +5 -0
  48. data/app/overrides/decidim/proposals/proposals/_wizard_header/replace_title.html.erb.deface +5 -6
  49. data/app/overrides/decidim/proposals/proposals/compare/add_css.html.erb.deface +5 -0
  50. data/app/overrides/decidim/proposals/proposals/compare/add_distance_badge.html.erb.deface +10 -0
  51. data/app/overrides/decidim/proposals/proposals/edit/add_css.html.erb.deface +1 -1
  52. data/app/overrides/decidim/proposals/proposals/edit/replace_javascript.html.erb.deface +2 -2
  53. data/app/overrides/decidim/proposals/proposals/edit_draft/replace_javascript.html.erb.deface +3 -3
  54. data/app/overrides/decidim/proposals/proposals/edit_draft/replace_partial_edit_form_fields.html.erb.deface +6 -1
  55. data/app/overrides/decidim/proposals/proposals/new/add_css.html.erb.deface +2 -2
  56. data/app/overrides/decidim/proposals/proposals/new/remove_body.html.erb.deface +1 -0
  57. data/app/overrides/decidim/proposals/proposals/new/remove_title.html.erb.deface +1 -1
  58. data/app/overrides/decidim/proposals/proposals/new/replace_javascript.html.erb.deface +2 -2
  59. data/app/overrides/decidim/proposals/proposals/preview/add_css.html.erb.deface +5 -0
  60. data/app/overrides/decidim/proposals/proposals/show/add_additional_button.html.erb.deface +1 -1
  61. data/app/packs/entrypoints/decidim_reporting_proposals.js +1 -0
  62. data/app/packs/src/decidim/reporting_proposals/proposal_extra_validations.js +12 -13
  63. data/app/packs/src/decidim/reporting_proposals/proposals/add_proposal.js +45 -41
  64. data/app/packs/src/decidim/reporting_proposals/reverse_geocoding.js +0 -2
  65. data/app/packs/src/decidim/reporting_proposals/user_camera_inputs.js +7 -7
  66. data/app/packs/stylesheets/decidim/reporting_proposals/geocoding_addons.scss +9 -26
  67. data/app/packs/stylesheets/decidim/reporting_proposals/list_component_admin.scss +6 -6
  68. data/app/packs/stylesheets/decidim/reporting_proposals/manage_component_admin.scss +44 -30
  69. data/app/packs/stylesheets/decidim/reporting_proposals/proposals/add_proposal.scss +9 -4
  70. data/app/packs/stylesheets/decidim/reporting_proposals/user_camera_inputs.scss +21 -13
  71. data/app/permissions/concerns/decidim/reporting_proposals/admin/permissions_override.rb +73 -0
  72. data/app/permissions/decidim/templates/admin/permissions.rb +51 -0
  73. data/app/presenters/concerns/decidim/reporting_proposals/resource_locator_presenter_override.rb +40 -0
  74. data/app/resources/concerns/decidim/reporting_proposals/resource_manifest_override.rb +16 -0
  75. data/app/serializers/decidim/reporting_proposals/proposal_serializer_override.rb +4 -4
  76. data/app/views/decidim/proposals/admin/proposal_notes/_editing_note.html.erb +3 -3
  77. data/app/views/decidim/proposals/admin/proposal_notes/_proposal_notes_body.html.erb +1 -1
  78. data/app/views/decidim/proposals/admin/proposals/_address.html.erb +11 -10
  79. data/app/views/decidim/proposals/admin/proposals/_send_email_button.html.erb +6 -4
  80. data/app/views/decidim/proposals/proposals/_additional_button.html.erb +1 -1
  81. data/app/views/decidim/proposals/proposals/index.js.erb +0 -2
  82. data/app/views/decidim/reporting_proposals/admin/proposals/_photo_form.html.erb +2 -3
  83. data/app/views/decidim/reporting_proposals/admin/proposals/_photo_gallery.html.erb +3 -4
  84. data/app/views/decidim/reporting_proposals/admin/proposals/_photos.html.erb +15 -11
  85. data/app/views/decidim/reporting_proposals/admin/proposals/_proposal_td_hide.html.erb +7 -11
  86. data/app/views/decidim/reporting_proposals/admin/proposals/_proposal_td_title.html.erb +2 -2
  87. data/app/views/decidim/reporting_proposals/admin/proposals_valuator_mailer/notify_proposals_valuator.html.erb +17 -0
  88. data/app/views/decidim/reporting_proposals/proposals/_additional_button_for_show.html.erb +5 -2
  89. data/app/views/decidim/reporting_proposals/proposals/_camera_button.html.erb +26 -0
  90. data/app/views/decidim/reporting_proposals/proposals/_new_proposal_fields.html.erb +7 -5
  91. data/app/views/decidim/reporting_proposals/proposals/_reporting_proposal_fields.html.erb +61 -86
  92. data/app/views/decidim/reporting_proposals/proposals/_user_group.html.erb +1 -1
  93. data/bin/dev +5 -0
  94. data/bin/{webpack-dev-server → shakapacker} +1 -1
  95. data/bin/shakapacker-dev-server +6 -0
  96. data/config/assets.rb +1 -3
  97. data/config/locales/ca.yml +0 -2
  98. data/config/locales/en.yml +22 -48
  99. data/decidim-reporting_proposals.gemspec +1 -2
  100. data/lib/decidim/reporting_proposals/admin_engine.rb +4 -0
  101. data/lib/decidim/reporting_proposals/component.rb +26 -26
  102. data/lib/decidim/reporting_proposals/engine.rb +18 -12
  103. data/lib/decidim/reporting_proposals/test/factories.rb +2 -12
  104. data/lib/decidim/reporting_proposals/version.rb +3 -4
  105. data/lib/tasks/reporting_proposals_upgrade.rake +5 -0
  106. data/package-lock.json +4072 -5101
  107. data/package.json +12 -7
  108. metadata +73 -105
  109. data/app/commands/concerns/decidim/admin/hide_resource_override.rb +0 -34
  110. data/app/commands/concerns/decidim/templates/admin/copy_questionnaire_template_override.rb +0 -32
  111. data/app/commands/concerns/decidim/templates/admin/create_questionnaire_template_override.rb +0 -32
  112. data/app/commands/decidim/templates/admin/copy_proposal_answer_template.rb +0 -35
  113. data/app/commands/decidim/templates/admin/create_proposal_answer_template.rb +0 -48
  114. data/app/commands/decidim/templates/admin/update_proposal_answer_template.rb +0 -52
  115. data/app/controllers/concerns/decidim/proposals/admin/valuation_assignments_controller_override.rb +0 -35
  116. data/app/controllers/concerns/decidim/templates/admin/application_controller_override.rb +0 -20
  117. data/app/controllers/decidim/templates/admin/proposal_answer_templates_controller.rb +0 -183
  118. data/app/forms/decidim/templates/admin/proposal_answer_template_form.rb +0 -21
  119. data/app/mailers/concerns/decidim/admin/hidden_resource_mailer.rb +0 -28
  120. data/app/mailers/concerns/decidim/reported_mailer_override.rb +0 -16
  121. data/app/overrides/decidim/proposals/admin/proposal_answers/_form/add_template_chooser.html.erb.deface +0 -5
  122. data/app/overrides/decidim/proposals/proposals/_edit_form_fields/replace_add_photos.html.erb.deface +0 -37
  123. data/app/overrides/decidim/proposals/proposals/_proposal_similar/add_distance_badge.html.erb.deface +0 -5
  124. data/app/overrides/decidim/proposals/proposals/edit_draft/add_css.html.erb.deface +0 -5
  125. data/app/overrides/decidim/proposals/proposals/edit_draft/add_user_group.html.erb.deface +0 -3
  126. data/app/packs/entrypoints/decidim_reporting_proposals_js_validations.js +0 -1
  127. data/app/packs/entrypoints/decidim_templates_admin.js +0 -1
  128. data/app/packs/src/decidim/templates/admin/proposal_answer_template_chooser.js +0 -27
  129. data/app/permissions/decidim/templates/admin/extra_permissions.rb +0 -37
  130. data/app/presenters/concerns/decidim/resource_locator_presenter_override.rb +0 -38
  131. data/app/resources/concerns/decidim/resource_manifest_override.rb +0 -14
  132. data/app/views/decidim/proposals/admin/proposals_valuator_mailer/notify_proposals_valuator.html.erb +0 -17
  133. data/app/views/decidim/templates/admin/proposal_answer_templates/_form.html.erb +0 -34
  134. data/app/views/decidim/templates/admin/proposal_answer_templates/_template_chooser.html.erb +0 -16
  135. data/app/views/decidim/templates/admin/proposal_answer_templates/edit.html.erb +0 -3
  136. data/app/views/decidim/templates/admin/proposal_answer_templates/index.html.erb +0 -52
  137. data/app/views/decidim/templates/admin/proposal_answer_templates/new.html.erb +0 -6
  138. data/db/migrate/20230404103706_add_target_and_field_values_to_decidim_templates_templates.rb +0 -8
  139. data/db/migrate/20230404104741_migrate_templatable.rb +0 -13
  140. /data/app/views/decidim/{admin → reporting_proposals/admin}/hidden_resource_mailer/notify_mail.html.erb +0 -0
  141. /data/app/views/decidim/{proposals → reporting_proposals}/admin/notification_answer_proposal_mailer/notify_proposal_author.html.erb +0 -0
  142. /data/app/views/decidim/{proposals → reporting_proposals}/notification_publish_proposal_mailer/notify_proposal_author.html.erb +0 -0
@@ -1,6 +1,9 @@
1
1
  <% if current_component.settings.try(:additional_buttons_for_show_proposal_show) &&
2
2
  current_component.settings.additional_button_for_show_proposal_text.present? &&
3
3
  current_component.settings.additional_button_for_show_proposal_link.present? %>
4
- <%= link_to translated_attribute(component_settings.additional_button_for_show_proposal_text),
5
- component_settings.additional_button_for_show_proposal_link, class: "title-action__action button small ml-s" %>
4
+
5
+ <section class="layout-aside__section">
6
+ <%= link_to translated_attribute(component_settings.additional_button_for_show_proposal_text),
7
+ component_settings.additional_button_for_show_proposal_link, class: "button button__sm button__transparent-secondary w-full" %>
8
+ </section>
6
9
  <% end %>
@@ -0,0 +1,26 @@
1
+ <% if component_settings.attachments_allowed? %>
2
+ <div class="gallery__container photos_container">
3
+ <% if @form.respond_to?(:photos) && @form.photos.any? %>
4
+ <% @form.photos.each do |photo| %>
5
+ <div class="callout gallery__item" id="attachment_<%= photo.id %>" data-closable>
6
+ <%= image_tag photo.thumbnail_url, class: "thumbnail", alt: photo.file.filename %>
7
+ <%= form.hidden_field :photos, multiple: true, value: photo.id, id: "photo-#{photo.id}" %>
8
+ <button class="close-button"
9
+ aria-label="<%= t("delete_image", scope: "decidim.reporting_proposals.proposals.edit") %>"
10
+ title="<%= t("delete_image", scope: "decidim.reporting_proposals.proposals.edit") %>"
11
+ type="button"
12
+ data-close>
13
+ <span aria-hidden="true">&times;</span>
14
+ </button>
15
+ </div>
16
+ <% end %>
17
+ <% end %>
18
+ <div class="field">
19
+ <%= form.file_field :add_photos, multiple: false, label: t("image", scope: "decidim.reporting_proposals.proposals.form") %>
20
+
21
+ <div class="has_no_image">
22
+ <%= form.check_box :has_no_image %>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ <% end %>
@@ -1,7 +1,9 @@
1
- <div class="field hashtags__container">
2
- <%= form.text_field :title, class: "js-hashtags" %>
3
- </div>
1
+ <div class="form__wrapper">
2
+ <div class="field hashtags__container">
3
+ <%= form.text_field :title, class: "js-hashtags" %>
4
+ </div>
4
5
 
5
- <div class="field hashtags__container">
6
- <%= text_editor_for_proposal_body(form) %>
6
+ <div class="field hashtags__container">
7
+ <%= text_editor_for_proposal_body(form) %>
8
+ </div>
7
9
  </div>
@@ -1,101 +1,76 @@
1
- <% if @form.categories&.any? %>
2
- <div class="field">
3
- <%= form.categories_select :category_id, @form.categories, include_blank: t("decidim.proposals.proposals.edit.select_a_category") %>
4
- </div>
5
- <% end %>
6
-
7
- <% if component_settings.attachments_allowed? %>
8
- <fieldset class="gallery__container photos_container">
9
- <% if @form.photos.any? %>
10
- <% @form.photos.each do |photo| %>
11
- <div class="callout gallery__item" id="attachment_<%= photo.id %>" data-closable>
12
- <%= image_tag photo.thumbnail_url, class: "thumbnail", alt: photo.file.filename %>
13
- <%= form.hidden_field :photos, multiple: true, value: photo.id, id: "photo-#{photo.id}" %>
14
- <button class="close-button"
15
- aria-label="<%= t("delete_image", scope: "decidim.reporting_proposals.proposals.edit") %>"
16
- title="<%= t("delete_image", scope: "decidim.reporting_proposals.proposals.edit") %>"
17
- type="button"
18
- data-close>
19
- <span aria-hidden="true">&times;</span>
20
- </button>
21
- </div>
22
- <% end %>
1
+ <div class="form__wrapper">
2
+ <% if @form.categories&.any? %>
3
+ <div class="field hashtags__container">
4
+ <%= form.categories_select :category_id, @form.categories, include_blank: t("decidim.proposals.proposals.edit.select_a_category") %>
5
+ </div>
23
6
  <% end %>
24
- <div class="field row column">
25
- <%= form.file_field :add_photos, multiple: false, label: t("image", scope: "decidim.reporting_proposals.proposals.form") %>
26
7
 
27
- <div class="has_no_image">
28
- <%= form.check_box :has_no_image %>
8
+ <%= render "decidim/reporting_proposals/proposals/camera_button", form: form %>
9
+
10
+ <% if @form.geocoding_enabled? %>
11
+ <div id="address_input">
12
+ <div class="address-fill">
13
+ <%= form.geocoding_field :address, placeholder: t("decidim.proposals.proposals.placeholder.address"), required: true %>
14
+ </div>
15
+ <div class="has_no_address">
16
+ <%= form.check_box :has_no_address %>
17
+ <%= form.hidden_field :has_address, value: "1" %>
18
+ </div>
19
+ <div id="address_map" class="proposal__container">
20
+ <p class="help-text">
21
+ <%= t("instructions", scope: "decidim.proposals.proposals.dynamic_map_instructions") %> <%= t("description", scope: "decidim.proposals.proposals.dynamic_map_instructions") %>
22
+ </p>
23
+ <%= dynamic_map_for proposal_preview_data_for_map(@form.to_h) %>
29
24
  </div>
30
25
  </div>
31
- </fieldset>
32
-
33
- <% end %>
26
+ <% end %>
34
27
 
35
- <% if @form.geocoding_enabled? %>
36
- <div class="field" id="address_input">
37
- <div class="address-fill">
38
- <%= form.geocoding_field :address, placeholder: t("decidim.proposals.proposals.placeholder.address") %>
39
- </div>
40
- <div class="has_no_address">
41
- <%= form.check_box :has_no_address %>
42
- <%= form.hidden_field :has_address, value: "1" %>
43
- </div>
44
- <div class="map address-fill" id="address_map">
45
- <%= render partial: "dynamic_map_instructions" %>
46
- <%= dynamic_map_for proposal_preview_data_for_map(@form.to_h) %>
47
- </div>
28
+ <div class="field hashtags__container">
29
+ <%= form.text_field :title, class: "js-hashtags", value: form_presenter.title %>
48
30
  </div>
49
- <% end %>
50
-
51
- <div class="field hashtags__container">
52
- <%= form.text_field :title, class: "js-hashtags", value: form_presenter.title %>
53
- </div>
54
31
 
55
- <div class="field hashtags__container">
56
32
  <%= text_editor_for_proposal_body(form) %>
57
- </div>
58
33
 
59
- <% if @form.component_automatic_hashtags.any? %>
60
- <div class="field">
61
- <%= form.label :automatic_hashtags %>
62
- <div class="checkboxes hashtags">
63
- <% @form.component_automatic_hashtags.each do |hashtag| %>
64
- <label>
65
- <%= check_box_tag "", "", { checked: true }, { disabled: true } %>#<%= hashtag %>
66
- </label>
67
- <% end %>
34
+ <% if @form.component_automatic_hashtags.any? %>
35
+ <div class="field">
36
+ <%= form.label :automatic_hashtags %>
37
+ <div class="checkboxes hashtags">
38
+ <% @form.component_automatic_hashtags.each do |hashtag| %>
39
+ <label>
40
+ <%= check_box_tag "", "", { checked: true }, { disabled: true } %>#<%= hashtag %>
41
+ </label>
42
+ <% end %>
43
+ </div>
68
44
  </div>
69
- </div>
70
- <% end %>
45
+ <% end %>
71
46
 
72
- <% if @form.component_suggested_hashtags.any? %>
73
- <div class="field">
74
- <%= form.label :suggested_hashtags, nil, for: nil %>
75
- <div class="checkboxes hashtags">
76
- <%= form.collection_check_boxes :suggested_hashtags, @form.component_suggested_hashtags.map { |hashtag| [hashtag.downcase, "##{hashtag}"] }, :first, :last do |option|
77
- option.label { option.check_box(checked: @form.suggested_hashtag_checked?(option.value)) + option.text }
78
- end %>
47
+ <% if @form.component_suggested_hashtags.any? %>
48
+ <div class="field">
49
+ <%= form.label :suggested_hashtags, nil, for: nil %>
50
+ <div class="checkboxes hashtags">
51
+ <%= form.collection_check_boxes :suggested_hashtags, @form.component_suggested_hashtags.map { |hashtag| [hashtag.downcase, "##{hashtag}"] }, :first, :last do |option|
52
+ option.label { option.check_box(checked: @form.suggested_hashtag_checked?(option.value)) + option.text }
53
+ end %>
54
+ </div>
79
55
  </div>
80
- </div>
81
- <% end %>
56
+ <% end %>
82
57
 
83
- <% if current_component.has_subscopes? %>
84
- <div class="field">
85
- <%= scopes_picker_field form, :scope_id, root: current_component.scope %>
86
- </div>
87
- <% end %>
58
+ <% if current_component.has_subscopes? %>
59
+ <%= scopes_select_field form, :scope_id, root: current_component.scope %>
60
+ <% end %>
88
61
 
89
- <% if component_settings.attachments_allowed? && !component_settings.only_photo_attachments? %>
90
- <fieldset class="attachments_container gallery__container documents_container">
91
- <legend><%= t("attachment_legend", scope: "decidim.proposals.proposals.edit") %></legend>
92
- <div class="row column">
93
- <%= form.attachment :documents,
94
- multiple: true,
95
- label: t("decidim.proposals.proposals.edit.add_documents"),
96
- button_label: t("decidim.proposals.proposals.edit.add_documents"),
97
- button_edit_label: t("decidim.proposals.proposals.edit.edit_documents"),
98
- help_i18n_scope: "decidim.forms.file_help.file" %>
62
+ <% if component_settings.attachments_allowed? && !component_settings.only_photo_attachments? %>
63
+ <div class="attachments_container gallery__container documents_container">
64
+ <legend><%= t("attachment_legend", scope: "decidim.proposals.proposals.edit") %></legend>
65
+ <div>
66
+ <%= form.attachment :documents,
67
+ multiple: true,
68
+ label: t("decidim.proposals.proposals.edit.add_documents"),
69
+ button_label: t("decidim.proposals.proposals.edit.add_documents"),
70
+ button_edit_label: t("decidim.proposals.proposals.edit.edit_documents"),
71
+ button_class: "button button__lg button__transparent-secondary w-full",
72
+ help_i18n_scope: "decidim.forms.file_help.file" %>
73
+ </div>
99
74
  </div>
100
- </fieldset>
101
- <% end %>
75
+ <% end %>
76
+ </div>
@@ -1,5 +1,5 @@
1
1
  <% if current_organization.user_groups_enabled? && Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
2
- <div class="field">
2
+ <div class="field hashtags__container">
3
3
  <%= user_group_select_field(form, :user_group_id) %>
4
4
  </div>
5
5
  <% end %>
data/bin/dev ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env sh
2
+
3
+ cd development_app
4
+
5
+ ./bin/dev
@@ -3,4 +3,4 @@
3
3
 
4
4
  Dir.chdir("development_app")
5
5
 
6
- load "bin/webpack-dev-server"
6
+ load "bin/shakapacker"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ Dir.chdir("development_app")
5
+
6
+ load "bin/shakapacker-dev-server"
data/config/assets.rb CHANGED
@@ -8,7 +8,5 @@ Decidim::Webpacker.register_entrypoints(
8
8
  decidim_reporting_proposals_manage_component_admin: "#{base_path}/app/packs/entrypoints/decidim_reporting_proposals_manage_component_admin.js",
9
9
  decidim_reporting_proposals_list_component_admin: "#{base_path}/app/packs/entrypoints/decidim_reporting_proposals_list_component_admin.js",
10
10
  decidim_reporting_proposals_geocoding: "#{base_path}/app/packs/entrypoints/decidim_reporting_proposals_geocoding.js",
11
- decidim_reporting_proposals_camera: "#{base_path}/app/packs/entrypoints/decidim_reporting_proposals_camera.js",
12
- decidim_reporting_proposals_js_validations: "#{base_path}/app/packs/entrypoints/decidim_reporting_proposals_js_validations.js",
13
- decidim_templates_admin: "#{base_path}/app/packs/entrypoints/decidim_templates_admin.js"
11
+ decidim_reporting_proposals_camera: "#{base_path}/app/packs/entrypoints/decidim_reporting_proposals_camera.js"
14
12
  )
@@ -7,8 +7,6 @@ ca:
7
7
  proposal:
8
8
  has_no_address: No té adreça
9
9
  has_no_image: Sense imatge
10
- template:
11
- scope_for_availability: Limita la disponibilitat al component
12
10
  decidim:
13
11
  admin:
14
12
  hidden_resource_mailer:
@@ -7,10 +7,11 @@ en:
7
7
  proposal:
8
8
  has_no_address: Has no address
9
9
  has_no_image: Has no image
10
- template:
11
- scope_for_availability: Restrict availability to the component
12
10
  decidim:
13
11
  admin:
12
+ actions:
13
+ manage: Manage
14
+ new: New
14
15
  hidden_resource_mailer:
15
16
  notify_mail:
16
17
  body_1: An administrator removed your proposal because it has been reported.
@@ -19,10 +20,6 @@ en:
19
20
  hello: Hello,
20
21
  reason: 'Reason: %{reason}'
21
22
  subject: Your proposal has been hidden
22
- templates:
23
- fetch:
24
- error: Couldn't find this template, maybe has been deleted?
25
- missing_resource: "(missing resource)"
26
23
  application:
27
24
  geocoding:
28
25
  unconfigured: Geocoding is not configured!
@@ -56,10 +53,10 @@ en:
56
53
  name: Reporting proposals
57
54
  settings:
58
55
  global:
59
- additional_button_for_show_proposal_link: Additional action button after
60
- the "back to list" link when visiting a particular proposal (link)
61
- additional_button_for_show_proposal_text: Additional action button after
62
- the "back to list" link when visiting a particular proposal (text)
56
+ additional_button_for_show_proposal_link: Additional sidebar action button
57
+ when visiting a particular proposal (link)
58
+ additional_button_for_show_proposal_text: Additional sidebar action button
59
+ when visiting a particular proposal (text)
63
60
  additional_button_link: Additional action button next to new proposal
64
61
  (link)
65
62
  additional_button_text: Additional action button next to new proposal
@@ -231,16 +228,8 @@ en:
231
228
  geolocated_at: Geolocated at
232
229
  send_email_button:
233
230
  send_mail: Send an email to user
234
- proposals_valuator_mailer:
235
- notify_proposals_valuator:
236
- admin_panel: admin panel
237
- email_body: You've been assigned as a valuator for the proposals listed
238
- below. This means you've been trusted to give them feedback and a proper
239
- response in the next coming days.
240
- gratitude: Thanks for your help!
241
- greeting: Hi %{name}
242
- public_side: public side
243
- subject: New proposals assigned to you for evaluation
231
+ show:
232
+ report: Report
244
233
  reported_mailer:
245
234
  report:
246
235
  admin_resource: Admin this resource
@@ -405,9 +394,10 @@ en:
405
394
  success: Proposal note successfully updated.
406
395
  proposals:
407
396
  photo_form:
408
- action: Add image
397
+ action: Save images
409
398
  add_images: Add images
410
- gallery_legend: Add images
399
+ edit_images: Edit images
400
+ gallery_legend: Add an image gallery (Optional)
411
401
  title: Photos
412
402
  upload_msg: No files selected
413
403
  photo_gallery:
@@ -420,6 +410,16 @@ en:
420
410
  remove_assignment: remove assignment
421
411
  remove_assignment_confirmation: remove assignment confirmation
422
412
  valuators: Valuators
413
+ proposals_valuator_mailer:
414
+ notify_proposals_valuator:
415
+ admin_panel: admin panel
416
+ email_body: You've been assigned as a valuator for the proposals listed
417
+ below. This means you've been trusted to give them feedback and a proper
418
+ response in the next coming days.
419
+ gratitude: Thanks for your help!
420
+ greeting: Hi %{name}
421
+ public_side: public side
422
+ subject: New proposals assigned to you for evaluation
423
423
  resolution_time: Resolution time
424
424
  time_elapsed:
425
425
  datetime:
@@ -487,29 +487,3 @@ en:
487
487
  delete_image: Delete image
488
488
  form:
489
489
  image: Image/photo
490
- templates:
491
- admin:
492
- proposal_answer_templates:
493
- form:
494
- answer_template: Answer template
495
- hint: "<strong>Hint:</strong> You can use these variables anywhere on
496
- the answer template that will be replaced when using the template"
497
- hint1: "<strong>%{organization}</strong> will be replaced by the organization's
498
- name"
499
- hint2: "<strong>%{name}</strong> will be replaced by the author's name"
500
- hint3: "<strong>%{admin}</strong> will be replaced by the admin's name
501
- (the one answering the proposal)"
502
- save: Save
503
- scope_for_availability_help: Note that only participatory spaces having
504
- components of the type "proposals" will be listed.
505
- template_title: Template information
506
- index:
507
- confirm_delete: Are you sure you want to delete this template?
508
- global_scope: Global (available everywhere)
509
- internal_state: Internal State
510
- scope_for_availability: Scope
511
- title: Proposal answers
512
- template_chooser:
513
- select_template: Select a template answer
514
- template_types:
515
- proposal_answer_templates: Proposal answers
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.description = "A module for Decidim that facilitates the creation of proposals related to geolocated issues in a city"
15
15
  spec.license = "AGPL-3.0"
16
16
  spec.homepage = "https://github.com/openpoke/decidim-module-reporting_proposals"
17
- spec.required_ruby_version = ">= 3.0"
17
+ spec.required_ruby_version = ">= 3.1"
18
18
 
19
19
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
20
  f.match(%r{^(test|spec|features)/})
@@ -27,7 +27,6 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "decidim-core", Decidim::ReportingProposals::COMPAT_DECIDIM_VERSION
28
28
  spec.add_dependency "decidim-participatory_processes", Decidim::ReportingProposals::COMPAT_DECIDIM_VERSION
29
29
  spec.add_dependency "decidim-proposals", Decidim::ReportingProposals::COMPAT_DECIDIM_VERSION
30
- spec.add_dependency "decidim-templates", Decidim::ReportingProposals::COMPAT_DECIDIM_VERSION
31
30
  spec.add_dependency "deface", ">= 1.9"
32
31
 
33
32
  spec.add_development_dependency "decidim-accountability", Decidim::ReportingProposals::COMPAT_DECIDIM_VERSION
@@ -38,6 +38,10 @@ module Decidim
38
38
  end
39
39
  end
40
40
 
41
+ initializer "decidim_reporting_proposals.register_icons" do
42
+ Decidim.icons.register(name: "camera-line", icon: "camera-line", category: "system", description: "", engine: :decidim_reporting_proposals)
43
+ end
44
+
41
45
  def load_seed
42
46
  nil
43
47
  end
@@ -139,7 +139,7 @@ Decidim.register_component(:reporting_proposals) do |component|
139
139
  .where(component: component_instance)
140
140
  .includes(:scope, :category, :component)
141
141
 
142
- if space.user_roles(:valuator).where(user: user).any?
142
+ if space.user_roles(:valuator).where(user:).any?
143
143
  collection.with_valuation_assigned_to(user, space)
144
144
  else
145
145
  collection
@@ -168,7 +168,7 @@ Decidim.register_component(:reporting_proposals) do |component|
168
168
  imports.form_class_name = "Decidim::Proposals::Admin::ProposalsFileImportForm"
169
169
 
170
170
  imports.messages do |msg|
171
- msg.set(:resource_name) { |count: 1| I18n.t("decidim.proposals.admin.imports.resources.proposals", count: count) }
171
+ msg.set(:resource_name) { |count: 1| I18n.t("decidim.proposals.admin.imports.resources.proposals", count:) }
172
172
  msg.set(:title) { I18n.t("decidim.proposals.admin.imports.title.proposals") }
173
173
  msg.set(:label) { I18n.t("decidim.proposals.admin.imports.label.proposals") }
174
174
  msg.set(:help) { I18n.t("decidim.proposals.admin.imports.help.proposals") }
@@ -179,7 +179,7 @@ Decidim.register_component(:reporting_proposals) do |component|
179
179
 
180
180
  component.imports :answers do |imports|
181
181
  imports.messages do |msg|
182
- msg.set(:resource_name) { |count: 1| I18n.t("decidim.proposals.admin.imports.resources.answers", count: count) }
182
+ msg.set(:resource_name) { |count: 1| I18n.t("decidim.proposals.admin.imports.resources.answers", count:) }
183
183
  msg.set(:title) { I18n.t("decidim.proposals.admin.imports.title.answers") }
184
184
  msg.set(:label) { I18n.t("decidim.proposals.admin.imports.label.answers") }
185
185
  msg.set(:help) { I18n.t("decidim.proposals.admin.imports.help.answers") }
@@ -213,12 +213,12 @@ Decidim.register_component(:reporting_proposals) do |component|
213
213
  name: Decidim::Components::Namer.new(participatory_space.organization.available_locales, :reporting_proposals).i18n_name,
214
214
  manifest_name: :reporting_proposals,
215
215
  published_at: Time.current,
216
- participatory_space: participatory_space,
216
+ participatory_space:,
217
217
  settings: {
218
218
  vote_limit: 0,
219
219
  collaborative_drafts_enabled: true
220
220
  },
221
- step_settings: step_settings
221
+ step_settings:
222
222
  }
223
223
 
224
224
  component = Decidim.traceability.perform_action!(
@@ -248,19 +248,19 @@ Decidim.register_component(:reporting_proposals) do |component|
248
248
  elsif n.positive?
249
249
  ["accepted", Decidim::Faker::Localized.sentence(word_count: 10), nil]
250
250
  else
251
- [nil, nil, nil]
251
+ ["not_answered", nil, nil]
252
252
  end
253
253
 
254
254
  params = {
255
- component: component,
255
+ component:,
256
256
  category: participatory_space.categories.sample,
257
257
  scope: Faker::Boolean.boolean(true_ratio: 0.5) ? global : scopes.sample,
258
258
  title: { en: Faker::Lorem.sentence(word_count: 2) },
259
259
  body: { en: Faker::Lorem.paragraphs(number: 2).join("\n") },
260
- state: state,
261
- answer: answer,
260
+ state:,
261
+ answer:,
262
262
  answered_at: state.present? ? Time.current : nil,
263
- state_published_at: state_published_at,
263
+ state_published_at:,
264
264
  published_at: Time.current
265
265
  }
266
266
 
@@ -279,7 +279,7 @@ Decidim.register_component(:reporting_proposals) do |component|
279
279
  if n.positive?
280
280
  Decidim::User.where(decidim_organization_id: participatory_space.decidim_organization_id).all.sample(n).each do |author|
281
281
  user_group = [true, false].sample ? Decidim::UserGroups::ManageableUserGroups.for(author).verified.sample : nil
282
- proposal.add_coauthor(author, user_group: user_group)
282
+ proposal.add_coauthor(author, user_group:)
283
283
  end
284
284
  end
285
285
 
@@ -287,11 +287,11 @@ Decidim.register_component(:reporting_proposals) do |component|
287
287
  email = "amendment-author-#{participatory_space.underscored_name}-#{participatory_space.id}-#{n}-amend#{n}@example.org"
288
288
  name = "#{Faker::Name.name} #{participatory_space.id} #{n} amend#{n}"
289
289
 
290
- author = Decidim::User.find_or_initialize_by(email: email)
290
+ author = Decidim::User.find_or_initialize_by(email:)
291
291
  author.update!(
292
292
  password: "decidim123456",
293
293
  password_confirmation: "decidim123456",
294
- name: name,
294
+ name:,
295
295
  nickname: Faker::Twitter.unique.screen_name,
296
296
  organization: component.organization,
297
297
  tos_agreement: "1",
@@ -318,7 +318,7 @@ Decidim.register_component(:reporting_proposals) do |component|
318
318
  )
319
319
 
320
320
  params = {
321
- component: component,
321
+ component:,
322
322
  category: participatory_space.categories.sample,
323
323
  scope: Faker::Boolean.boolean(true_ratio: 0.5) ? global : scopes.sample,
324
324
  title: { en: "#{proposal.title["en"]} #{Faker::Lorem.sentence(word_count: 1)}" },
@@ -344,7 +344,7 @@ Decidim.register_component(:reporting_proposals) do |component|
344
344
  Decidim::Amendment.create!(
345
345
  amender: author,
346
346
  amendable: proposal,
347
- emendation: emendation,
347
+ emendation:,
348
348
  state: "evaluating"
349
349
  )
350
350
  end
@@ -353,11 +353,11 @@ Decidim.register_component(:reporting_proposals) do |component|
353
353
  email = "vote-author-#{participatory_space.underscored_name}-#{participatory_space.id}-#{n}-#{m}@example.org"
354
354
  name = "#{Faker::Name.name} #{participatory_space.id} #{n} #{m}"
355
355
 
356
- author = Decidim::User.find_or_initialize_by(email: email)
356
+ author = Decidim::User.find_or_initialize_by(email:)
357
357
  author.update!(
358
358
  password: "decidim123456",
359
359
  password_confirmation: "decidim123456",
360
- name: name,
360
+ name:,
361
361
  nickname: Faker::Twitter.unique.screen_name,
362
362
  organization: component.organization,
363
363
  tos_agreement: "1",
@@ -366,8 +366,8 @@ Decidim.register_component(:reporting_proposals) do |component|
366
366
  about: Faker::Lorem.paragraph(sentence_count: 2)
367
367
  )
368
368
 
369
- Decidim::Proposals::ProposalVote.create!(proposal: proposal, author: author) unless proposal.published_state? && proposal.rejected?
370
- Decidim::Proposals::ProposalVote.create!(proposal: emendation, author: author) if emendation
369
+ Decidim::Proposals::ProposalVote.create!(proposal:, author:) unless proposal.published_state? && proposal.rejected?
370
+ Decidim::Proposals::ProposalVote.create!(proposal: emendation, author:) if emendation
371
371
  end
372
372
 
373
373
  unless proposal.published_state? && proposal.rejected?
@@ -375,11 +375,11 @@ Decidim.register_component(:reporting_proposals) do |component|
375
375
  email = "endorsement-author-#{participatory_space.underscored_name}-#{participatory_space.id}-#{n}-endr#{index}@example.org"
376
376
  name = "#{Faker::Name.name} #{participatory_space.id} #{n} endr#{index}"
377
377
 
378
- author = Decidim::User.find_or_initialize_by(email: email)
378
+ author = Decidim::User.find_or_initialize_by(email:)
379
379
  author.update!(
380
380
  password: "decidim123456",
381
381
  password_confirmation: "decidim123456",
382
- name: name,
382
+ name:,
383
383
  nickname: Faker::Twitter.unique.screen_name,
384
384
  organization: component.organization,
385
385
  tos_agreement: "1",
@@ -405,7 +405,7 @@ Decidim.register_component(:reporting_proposals) do |component|
405
405
  user_group: group
406
406
  )
407
407
  end
408
- Decidim::Endorsement.create!(resource: proposal, author: author, user_group: author.user_groups.first)
408
+ Decidim::Endorsement.create!(resource: proposal, author:, user_group: author.user_groups.first)
409
409
  end
410
410
  end
411
411
 
@@ -413,7 +413,7 @@ Decidim.register_component(:reporting_proposals) do |component|
413
413
  author_admin = Decidim::User.where(organization: component.organization, admin: true).all.sample
414
414
 
415
415
  Decidim::Proposals::ProposalNote.create!(
416
- proposal: proposal,
416
+ proposal:,
417
417
  author: author_admin,
418
418
  body: Faker::Lorem.paragraphs(number: 2).join("\n")
419
419
  )
@@ -435,12 +435,12 @@ Decidim.register_component(:reporting_proposals) do |component|
435
435
 
436
436
  draft = Decidim.traceability.perform_action!("create", Decidim::Proposals::CollaborativeDraft, author) do
437
437
  draft = Decidim::Proposals::CollaborativeDraft.new(
438
- component: component,
438
+ component:,
439
439
  category: participatory_space.categories.sample,
440
440
  scope: Faker::Boolean.boolean(true_ratio: 0.5) ? global : scopes.sample,
441
441
  title: Faker::Lorem.sentence(word_count: 2),
442
442
  body: Faker::Lorem.paragraphs(number: 2).join("\n"),
443
- state: state,
443
+ state:,
444
444
  published_at: Time.current
445
445
  )
446
446
  draft.coauthorships.build(author: participatory_space.organization)
@@ -471,7 +471,7 @@ Decidim.register_component(:reporting_proposals) do |component|
471
471
  Decidim.traceability.update!(
472
472
  Decidim::Proposals::CollaborativeDraft.all.sample,
473
473
  Decidim::User.where(organization: component.organization).all.sample,
474
- component: component,
474
+ component:,
475
475
  category: participatory_space.categories.sample,
476
476
  scope: Faker::Boolean.boolean(true_ratio: 0.5) ? global : scopes.sample,
477
477
  title: Faker::Lorem.sentence(word_count: 2),