decidim-plans 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE-AGPLv3.txt +661 -0
  3. data/README.md +157 -0
  4. data/Rakefile +48 -0
  5. data/app/assets/config/admin/decidim_plans_manifest.js +3 -0
  6. data/app/assets/config/decidim_plans_manifest.css +4 -0
  7. data/app/assets/config/decidim_plans_manifest.js +2 -0
  8. data/app/assets/images/decidim/plans/icon.svg +3 -0
  9. data/app/assets/javascripts/decidim/plans/admin/plans.js.es6 +3 -0
  10. data/app/assets/javascripts/decidim/plans/admin/sections.js.es6 +78 -0
  11. data/app/assets/javascripts/decidim/plans/multifield/component.js.es6 +101 -0
  12. data/app/assets/javascripts/decidim/plans/multifield.js.es6 +5 -0
  13. data/app/assets/javascripts/decidim/plans/plans_form.js.es6 +9 -0
  14. data/app/assets/javascripts/decidim/plans/proposal_picker.js.es6 +41 -0
  15. data/app/assets/javascripts/decidim/plans/remaining_characters.es6 +42 -0
  16. data/app/assets/javascripts/decidim/plans/social_share.js +2 -0
  17. data/app/assets/javascripts/decidim/plans/tab_focus.es6 +20 -0
  18. data/app/assets/stylesheets/decidim/plans/plans_form.scss +26 -0
  19. data/app/assets/stylesheets/decidim/plans/proposal_picker.scss +3 -0
  20. data/app/assets/stylesheets/decidim/plans/social_share.css.scss +22 -0
  21. data/app/cells/decidim/plans/author/flag.erb +5 -0
  22. data/app/cells/decidim/plans/author/withdraw.erb +6 -0
  23. data/app/cells/decidim/plans/author_cell.rb +9 -0
  24. data/app/cells/decidim/plans/coauthorships_cell.rb +23 -0
  25. data/app/cells/decidim/plans/collapsible_authors/show.erb +17 -0
  26. data/app/cells/decidim/plans/collapsible_authors_cell.rb +9 -0
  27. data/app/cells/decidim/plans/plan_activity_cell.rb +19 -0
  28. data/app/cells/decidim/plans/plan_cell.rb +59 -0
  29. data/app/cells/decidim/plans/plan_m/footer.erb +8 -0
  30. data/app/cells/decidim/plans/plan_m_cell.rb +62 -0
  31. data/app/commands/decidim/plans/accept_access_to_plan.rb +53 -0
  32. data/app/commands/decidim/plans/admin/answer_plan.rb +82 -0
  33. data/app/commands/decidim/plans/admin/create_plan.rb +102 -0
  34. data/app/commands/decidim/plans/admin/update_plan.rb +98 -0
  35. data/app/commands/decidim/plans/admin/update_sections.rb +54 -0
  36. data/app/commands/decidim/plans/attachment_methods.rb +78 -0
  37. data/app/commands/decidim/plans/create_plan.rb +90 -0
  38. data/app/commands/decidim/plans/destroy_plan.rb +33 -0
  39. data/app/commands/decidim/plans/nested_updater.rb +26 -0
  40. data/app/commands/decidim/plans/publish_plan.rb +79 -0
  41. data/app/commands/decidim/plans/reject_access_to_plan.rb +46 -0
  42. data/app/commands/decidim/plans/request_access_to_plan.rb +50 -0
  43. data/app/commands/decidim/plans/respond_to_access_request.rb +76 -0
  44. data/app/commands/decidim/plans/update_plan.rb +90 -0
  45. data/app/commands/decidim/plans/withdraw_plan.rb +50 -0
  46. data/app/controllers/concerns/decidim/plans/orderable.rb +53 -0
  47. data/app/controllers/decidim/plans/admin/application_controller.rb +16 -0
  48. data/app/controllers/decidim/plans/admin/plan_answers_controller.rb +40 -0
  49. data/app/controllers/decidim/plans/admin/plans_controller.rb +80 -0
  50. data/app/controllers/decidim/plans/admin/sections_controller.rb +75 -0
  51. data/app/controllers/decidim/plans/application_controller.rb +30 -0
  52. data/app/controllers/decidim/plans/plan_collaborator_requests_controller.rb +53 -0
  53. data/app/controllers/decidim/plans/plan_widgets_controller.rb +19 -0
  54. data/app/controllers/decidim/plans/plans_controller.rb +192 -0
  55. data/app/controllers/decidim/plans/versions_controller.rb +51 -0
  56. data/app/events/decidim/plans/accepted_plan_event.rb +9 -0
  57. data/app/events/decidim/plans/evaluating_plan_event.rb +8 -0
  58. data/app/events/decidim/plans/plan_access_accepted_event.rb +8 -0
  59. data/app/events/decidim/plans/plan_access_rejected_event.rb +8 -0
  60. data/app/events/decidim/plans/plan_access_request_event.rb +27 -0
  61. data/app/events/decidim/plans/plan_access_requested_event.rb +8 -0
  62. data/app/events/decidim/plans/plan_access_requester_accepted_event.rb +8 -0
  63. data/app/events/decidim/plans/plan_access_requester_rejected_event.rb +8 -0
  64. data/app/events/decidim/plans/publish_plan_event.rb +25 -0
  65. data/app/events/decidim/plans/rejected_plan_event.rb +9 -0
  66. data/app/forms/decidim/plans/accept_access_to_plan_form.rb +10 -0
  67. data/app/forms/decidim/plans/access_to_plan_form.rb +35 -0
  68. data/app/forms/decidim/plans/admin/plan_answer_form.rb +19 -0
  69. data/app/forms/decidim/plans/admin/plan_form.rb +88 -0
  70. data/app/forms/decidim/plans/admin/plan_sections_form.rb +20 -0
  71. data/app/forms/decidim/plans/admin/section_form.rb +34 -0
  72. data/app/forms/decidim/plans/attachment_form.rb +20 -0
  73. data/app/forms/decidim/plans/content_form.rb +58 -0
  74. data/app/forms/decidim/plans/plan_form.rb +85 -0
  75. data/app/forms/decidim/plans/reject_access_to_plan_form.rb +9 -0
  76. data/app/forms/decidim/plans/request_access_to_plan_form.rb +20 -0
  77. data/app/helpers/decidim/plans/admin/application_helper.rb +19 -0
  78. data/app/helpers/decidim/plans/application_helper.rb +78 -0
  79. data/app/helpers/decidim/plans/attached_proposals_helper.rb +44 -0
  80. data/app/helpers/decidim/plans/attachments_helper.rb +59 -0
  81. data/app/helpers/decidim/plans/cells_helper.rb +26 -0
  82. data/app/helpers/decidim/plans/plan_cells_helper.rb +67 -0
  83. data/app/helpers/decidim/plans/remaining_characters_helper.rb +32 -0
  84. data/app/helpers/decidim/plans/traceability_helper.rb +79 -0
  85. data/app/helpers/decidim/plans/user_group_helper.rb +23 -0
  86. data/app/models/concerns/decidim/plans/traceable.rb +48 -0
  87. data/app/models/decidim/plans/application_record.rb +10 -0
  88. data/app/models/decidim/plans/attached_proposal.rb +12 -0
  89. data/app/models/decidim/plans/content.rb +21 -0
  90. data/app/models/decidim/plans/paper_trail/version.rb +26 -0
  91. data/app/models/decidim/plans/paper_trail/version_association.rb +14 -0
  92. data/app/models/decidim/plans/plan.rb +206 -0
  93. data/app/models/decidim/plans/plan_collaborator_request.rb +13 -0
  94. data/app/models/decidim/plans/section.rb +16 -0
  95. data/app/permissions/decidim/plans/admin/permissions.rb +44 -0
  96. data/app/permissions/decidim/plans/permissions.rb +67 -0
  97. data/app/presenters/decidim/plans/admin_log/plan_presenter.rb +49 -0
  98. data/app/presenters/decidim/plans/admin_log/value_types/plan_state_presenter.rb +16 -0
  99. data/app/presenters/decidim/plans/content_presenter.rb +25 -0
  100. data/app/presenters/decidim/plans/log/resource_presenter.rb +18 -0
  101. data/app/presenters/decidim/plans/official_author_presenter.rb +38 -0
  102. data/app/presenters/decidim/plans/plan_presenter.rb +48 -0
  103. data/app/queries/decidim/plans/filtered_plans.rb +37 -0
  104. data/app/services/decidim/plans/diff_renderer/base.rb +108 -0
  105. data/app/services/decidim/plans/diff_renderer/categorization.rb +23 -0
  106. data/app/services/decidim/plans/diff_renderer/content.rb +33 -0
  107. data/app/services/decidim/plans/diff_renderer/plan.rb +25 -0
  108. data/app/services/decidim/plans/loggability.rb +19 -0
  109. data/app/services/decidim/plans/plan_builder.rb +68 -0
  110. data/app/services/decidim/plans/plan_search.rb +95 -0
  111. data/app/services/decidim/plans/tracer.rb +29 -0
  112. data/app/views/decidim/plans/admin/plan_answers/edit.html.erb +22 -0
  113. data/app/views/decidim/plans/admin/plans/_bulk-actions.html.erb +9 -0
  114. data/app/views/decidim/plans/admin/plans/_form.html.erb +62 -0
  115. data/app/views/decidim/plans/admin/plans/_js-callout.html.erb +6 -0
  116. data/app/views/decidim/plans/admin/plans/_plan-tr.html.erb +53 -0
  117. data/app/views/decidim/plans/admin/plans/edit.html.erb +7 -0
  118. data/app/views/decidim/plans/admin/plans/index.html.erb +64 -0
  119. data/app/views/decidim/plans/admin/plans/new.html.erb +7 -0
  120. data/app/views/decidim/plans/admin/sections/_bulk-actions.html.erb +7 -0
  121. data/app/views/decidim/plans/admin/sections/_form.html.erb +27 -0
  122. data/app/views/decidim/plans/admin/sections/_section.html.erb +66 -0
  123. data/app/views/decidim/plans/admin/sections/index.html.erb +7 -0
  124. data/app/views/decidim/plans/admin/shared/_info_plan.html.erb +17 -0
  125. data/app/views/decidim/plans/attached_proposals/_proposals.html.erb +12 -0
  126. data/app/views/decidim/plans/plan_widgets/show.html.erb +3 -0
  127. data/app/views/decidim/plans/plans/_accept_request_access_form.html.erb +8 -0
  128. data/app/views/decidim/plans/plans/_attached_proposals.html.erb +10 -0
  129. data/app/views/decidim/plans/plans/_collaborator_requests.html.erb +20 -0
  130. data/app/views/decidim/plans/plans/_content.html.erb +6 -0
  131. data/app/views/decidim/plans/plans/_contents.html.erb +8 -0
  132. data/app/views/decidim/plans/plans/_count.html.erb +1 -0
  133. data/app/views/decidim/plans/plans/_filters.html.erb +32 -0
  134. data/app/views/decidim/plans/plans/_filters_small_view.html.erb +18 -0
  135. data/app/views/decidim/plans/plans/_form.html.erb +57 -0
  136. data/app/views/decidim/plans/plans/_new_plan_button.html.erb +11 -0
  137. data/app/views/decidim/plans/plans/_plan.html.erb +1 -0
  138. data/app/views/decidim/plans/plans/_plan_preview.html.erb +1 -0
  139. data/app/views/decidim/plans/plans/_plans.html.erb +14 -0
  140. data/app/views/decidim/plans/plans/_reject_request_access_form.html.erb +10 -0
  141. data/app/views/decidim/plans/plans/_request_access_form.html.erb +7 -0
  142. data/app/views/decidim/plans/plans/edit.html.erb +21 -0
  143. data/app/views/decidim/plans/plans/index.html.erb +28 -0
  144. data/app/views/decidim/plans/plans/index.js.erb +10 -0
  145. data/app/views/decidim/plans/plans/new.html.erb +15 -0
  146. data/app/views/decidim/plans/plans/preview.html.erb +15 -0
  147. data/app/views/decidim/plans/plans/show.html.erb +133 -0
  148. data/app/views/decidim/plans/shared/_attachment_fields.html.erb +45 -0
  149. data/app/views/decidim/plans/shared/_attachments.html.erb +23 -0
  150. data/app/views/decidim/plans/shared/_remaining_characters_container.html.erb +12 -0
  151. data/app/views/decidim/plans/shared/_section_content_field.html.erb +39 -0
  152. data/app/views/decidim/plans/versions/_version.html.erb +20 -0
  153. data/app/views/decidim/plans/versions/index.html.erb +34 -0
  154. data/app/views/decidim/plans/versions/show.html.erb +41 -0
  155. data/config/locales/en.yml +341 -0
  156. data/config/locales/fi.yml +341 -0
  157. data/config/locales/sv.yml +341 -0
  158. data/db/migrate/20181230110225_enable_pg_trgm_extension_for_plans.rb +18 -0
  159. data/db/migrate/20181230110848_create_decidim_plans.rb +20 -0
  160. data/db/migrate/20181230111731_create_decidim_plans_sections.rb +13 -0
  161. data/db/migrate/20181230111931_create_decidim_plans_plan_contents.rb +14 -0
  162. data/db/migrate/20181230122035_create_decidim_plans_plan_collaborator_requests.rb +12 -0
  163. data/db/migrate/20190110125855_create_decidim_plans_attached_proposals.rb +12 -0
  164. data/db/migrate/20190129140441_add_help_to_decidim_plans_sections.rb +7 -0
  165. data/db/migrate/20190129143607_add_mandatory_to_decidim_plans_sections.rb +7 -0
  166. data/db/migrate/20190129172040_add_section_type_to_decidim_plans_sections.rb +12 -0
  167. data/db/migrate/20190129231439_add_answer_length_to_decidim_plans_sections.rb +11 -0
  168. data/db/migrate/20190202123044_create_version_associations.rb +25 -0
  169. data/db/migrate/20190202123045_add_transaction_id_column_to_versions.rb +15 -0
  170. data/db/migrate/20190202200716_add_update_token_to_decidim_plans.rb +7 -0
  171. data/lib/decidim/plans/admin.rb +10 -0
  172. data/lib/decidim/plans/admin_engine.rb +29 -0
  173. data/lib/decidim/plans/component.rb +163 -0
  174. data/lib/decidim/plans/engine.rb +43 -0
  175. data/lib/decidim/plans/locale_aware.rb +32 -0
  176. data/lib/decidim/plans/optionally_translatable_attributes.rb +85 -0
  177. data/lib/decidim/plans/paper_trail/record_trail.rb +24 -0
  178. data/lib/decidim/plans/paper_trail.rb +10 -0
  179. data/lib/decidim/plans/test/factories.rb +130 -0
  180. data/lib/decidim/plans/version.rb +8 -0
  181. data/lib/decidim/plans.rb +24 -0
  182. metadata +323 -0
@@ -0,0 +1,53 @@
1
+ <tr data-id="<%= plan.id %>">
2
+ <td>
3
+ <%= plan.id %><br />
4
+ </td>
5
+ <td>
6
+ <%= translated_attribute(plan.title) %><br />
7
+ </td>
8
+ <td>
9
+ <% if plan.category %>
10
+ <%= translated_attribute plan.category.name %>
11
+ <% end %>
12
+ </td>
13
+ <% if current_participatory_space.scopes_enabled? %>
14
+ <td>
15
+ <% if plan.scope %>
16
+ <%= translated_attribute plan.scope.name %>
17
+ <% else %>
18
+ <%= t("decidim.scopes.global") %>
19
+ <% end %>
20
+ </td>
21
+ <% end %>
22
+ <td>
23
+ <strong class="<%= plan_state_css_class plan.state %>">
24
+ <%= humanize_plan_state plan.state %>
25
+ </strong>
26
+ </td>
27
+
28
+ <% if current_component.settings.comments_enabled? and !current_settings.comments_blocked? %>
29
+ <td>
30
+ <%= plan.comments.count %>
31
+ </td>
32
+ <% end %>
33
+
34
+ <td>
35
+ <%= l plan.created_at, format: :decidim_short %>
36
+ </td>
37
+
38
+ <td class="table-list__actions">
39
+ <% if allowed_to? :edit, :plan, plan: plan %>
40
+ <%= icon_link_to "pencil", edit_plan_path(plan), t("actions.edit_plan", scope: "decidim.plans"), class: "action-icon--edit-plan" %>
41
+ <% end %>
42
+
43
+ <% if allowed_to? :create, :plan_answer %>
44
+ <%= icon_link_to "comment-square", edit_plan_plan_answer_path(plan_id: plan.id, id: plan.id), t("actions.answer", scope: "decidim.plans"), class: " icon--small" %>
45
+ <% else %>
46
+ <%= icon "comment-square", scope: "decidim.plans.admin", class: "action-icon action-icon--disabled" %>
47
+ <% end %>
48
+
49
+ <%= resource_permissions_link(plan) %>
50
+
51
+ <%= icon_link_to "eye", resource_locator(plan).path, t("actions.preview", scope: "decidim.plans.admin"), class: "action-icon--preview", target: :blank %>
52
+ </td>
53
+ </tr>
@@ -0,0 +1,7 @@
1
+ <%= decidim_form_for(@form, html: { class: "form plans-form edit_plan plan_form_admin" }) do |f| %>
2
+ <%= render partial: "form", object: f, locals: { title: t(".title") } %>
3
+
4
+ <div class="button--double form-general-submit">
5
+ <%= f.submit t(".update") %>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1,64 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title flex--sbc">
4
+ <div>
5
+ <%= t(".title") %>
6
+ <span id="js-selected-plans-count" class="component-counter component-counter--inline" title="<%= t("decidim.plans.admin.plans.index.selected") %>"></span>
7
+ </div>
8
+ <%= render partial: "bulk-actions" %>
9
+ </h2>
10
+ </div>
11
+ <div class="card-section">
12
+ <div class="table-scroll">
13
+ <table class="table-list">
14
+ <thead>
15
+ <tr>
16
+ <th>
17
+ <%= sort_link(query, :id, t("models.plan.fields.id", scope: "decidim.plans"), default_order: :desc ) %>
18
+ </th>
19
+ <th>
20
+ <%= sort_link(query, :title, t("models.plan.fields.title", scope: "decidim.plans") ) %>
21
+ </th>
22
+ <th>
23
+ <%= sort_link(query, :category_name, t("models.plan.fields.category", scope: "decidim.plans") ) %>
24
+ </th>
25
+
26
+ <% if current_participatory_space.scopes_enabled? %>
27
+ <th>
28
+ <%= sort_link(query, :scope_name, t("models.plan.fields.scope", scope: "decidim.plans") ) %>
29
+ </th>
30
+ <% end %>
31
+
32
+ <th>
33
+ <%= sort_link(query, :state, t("models.plan.fields.state", scope: "decidim.plans") ) %>
34
+ </th>
35
+
36
+ <% if current_component.settings.comments_enabled? and !current_settings.comments_blocked? %>
37
+ <th>
38
+ <%= sort_link(query, :commentable_comments_count, t("models.plan.fields.comments", scope: "decidim.plans") ) %>
39
+ </th>
40
+ <% end %>
41
+
42
+ <% if allowed_to? :create, :plan_note %>
43
+ <th>
44
+ <%= sort_link(query, :plan_notes_count, t("models.plan.fields.notes", scope: "decidim.plans") ) %>
45
+ </th>
46
+ <% end %>
47
+
48
+ <th>
49
+ <%= sort_link(query, :published_at, t("models.plan.fields.published_at", scope: "decidim.plans") ) %>
50
+ </th>
51
+
52
+ <th class="actions"><%= t("actions.title", scope: "decidim.plans") %></th>
53
+ </tr>
54
+ </thead>
55
+ <tbody>
56
+ <% plans.each do |plan| %>
57
+ <%= render partial: "plan-tr", locals: { plan: plan } %>
58
+ <% end %>
59
+ </tbody>
60
+ </table>
61
+ <%= paginate plans, theme: "decidim" %>
62
+ </div>
63
+ </div>
64
+ </div>
@@ -0,0 +1,7 @@
1
+ <%= decidim_form_for(@form, html: { class: "form plans-form new_plan plan_form_admin" }) do |f| %>
2
+ <%= render partial: "form", object: f, locals: { title: t(".title") } %>
3
+
4
+ <div class="button--double form-general-submit">
5
+ <%= f.submit t(".create") %>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <div class="flex--cc flex-gap--1">
2
+ <div id="js-other-actions-wrapper">
3
+ <% if allowed_to? :create, :section %>
4
+ <%= link_to t("actions.new", scope: "decidim.plans.sections"), new_section_path, class: "button tiny button--simple" %>
5
+ <% end %>
6
+ </div>
7
+ </div>
@@ -0,0 +1,27 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title">
4
+ <%= title %>
5
+ </h2>
6
+ </div>
7
+ </div>
8
+
9
+ <div class="plan-sections">
10
+ <template>
11
+ <%= fields_for "sections[#{blank_section.to_param}]", blank_section do |section_form| %>
12
+ <%= render "section", form: section_form, id: tabs_id_for_section(blank_section) %>
13
+ <% end %>
14
+ </template>
15
+
16
+ <div class="sections-list">
17
+ <% @form.sections.each do |section| %>
18
+ <%= fields_for "sections[]", section do |section_form| %>
19
+ <%= render "section", form: section_form, id: tabs_id_for_section(section) %>
20
+ <% end %>
21
+ <% end %>
22
+ </div>
23
+
24
+ <button class="button add-section"><%= t(".add_section") %></button>
25
+ </div>
26
+
27
+ <%= javascript_include_tag "decidim/plans/admin/sections" %>
@@ -0,0 +1,66 @@
1
+ <% section = form.object %>
2
+
3
+ <div class="card plan-section" id="<%= id %>-field">
4
+ <div class="card-divider section-divider">
5
+ <h2 class="card-title">
6
+ <span>
7
+ <%== "#{icon("move")} #{t(".section")}" %>
8
+ </span>
9
+
10
+ <button class="button small alert hollow move-up-section button--title">
11
+ <%== "#{icon("arrow-top")} #{t(".up")}" %>
12
+ </button>
13
+
14
+ <button class="button small alert hollow move-down-section button--title">
15
+ <%== "#{icon("arrow-bottom")} #{t(".down")}" %>
16
+ </button>
17
+
18
+ <button class="button small alert hollow remove-section button--title">
19
+ <%= t(".remove") %>
20
+ </button>
21
+ </h2>
22
+ </div>
23
+
24
+ <div class="card-section">
25
+ <div class="row column">
26
+ <%= form.select(
27
+ :section_type,
28
+ options_for_select(section_types, section.section_type)
29
+ ) %>
30
+ </div>
31
+ <div class="row column">
32
+ <%= form.translated(
33
+ :text_field,
34
+ :body,
35
+ tabs_id: id,
36
+ label: t(".body"),
37
+ ) %>
38
+ </div>
39
+ <div class="row column">
40
+ <%= form.translated(
41
+ :text_area,
42
+ :help,
43
+ tabs_id: id,
44
+ label: t(".help"),
45
+ rows: 4
46
+ ) %>
47
+ </div>
48
+ <div class="row column">
49
+ <%= form.check_box(
50
+ :mandatory,
51
+ label: t(".mandatory")
52
+ ) %>
53
+ </div>
54
+ <div class="row column">
55
+ <%= form.number_field(
56
+ :answer_length,
57
+ min: 0,
58
+ label: t(".answer_length")
59
+ ) %>
60
+ </div>
61
+
62
+ <%= form.hidden_field :id %>
63
+ <%= form.hidden_field :position, value: section.position || 0 %>
64
+ <%= form.hidden_field :deleted %>
65
+ </div>
66
+ </div>
@@ -0,0 +1,7 @@
1
+ <%= decidim_form_for(@form, url: sections_path, method: :post, html: { class: "form edit_sections" }) do |form| %>
2
+ <%= render partial: "form", object: form, locals: { title: t(".title") } %>
3
+
4
+ <div class="button--double form-general-submit">
5
+ <%= form.submit t(".save"), class: "button" %>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title">
4
+ <%= link_to "#{t ".plans"} > ", plans_path %>
5
+ <%= present(plan).title %>
6
+ </h2>
7
+ </div>
8
+
9
+ <div class="card-section">
10
+ <div class="row column">
11
+ <strong><%= t ".body" %>: </strong> <%= present(plan).body %>
12
+ </div>
13
+ <div class="row column">
14
+ <strong><%= t ".created_at" %>: </strong> <%= l plan.created_at, format: :decidim_short %>
15
+ </div>
16
+ </div>
17
+ </div>
@@ -0,0 +1,12 @@
1
+ <div class="picker-header">
2
+ <h1><%= t("decidim.plans.attached_proposals_helper.current_selection") %></h1>
3
+ </div>
4
+ <div class="picker-content">
5
+ <input type="text" name="proposal-search" id="data_picker-autocomplete" />
6
+ </div>
7
+ <div class="picker-footer">
8
+ <div class="buttons button--double">
9
+ <a id="proposal-picker-choose" class="button mute" href="<%= plan_search_proposals_path(current_component, format: :json) %>" data-picker-value="" data-picker-text="" data-picker-choose><%= t("decidim.plans.attached_proposals_helper.select") %></a>
10
+ <a class="button clear" data-close=""><%= t("decidim.plans.attached_proposals_helper.close") %></a>
11
+ </div>
12
+ </div>
@@ -0,0 +1,3 @@
1
+ <% content_for(:title, translated_attribute(model.title)) %>
2
+
3
+ <%== cell("decidim/plans/plan_m", model).badge %>
@@ -0,0 +1,8 @@
1
+ <% if allowed_to?(:edit, :plan, plan: @plan) %>
2
+ <%= decidim_form_for(@accept_request_form, url: request_accept_plan_path(@plan)) do |form| %>
3
+ <%= form.hidden_field :id, value: @plan.id %>
4
+ <%= form.hidden_field :state, value: @plan.state %>
5
+ <%= form.hidden_field :requester_user_id, value: requester.id %>
6
+ <%= form.submit t("decidim.plans.requests.accept_request"), class: "button hollow secondary small", data: { disable: true } %>
7
+ <% end %>
8
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <% if @plan.proposals.count.nonzero? %>
2
+ <div class="attached-proposals">
3
+ <h4 class="section-heading"><%= t(".attached_proposals") %></h3>
4
+ <div class="collapsible-list row small-up-1 medium-up-2 card-grid">
5
+ <% @plan.proposals.each do |proposal| %>
6
+ <%= card_for proposal, from: proposal %>
7
+ <% end %>
8
+ </div>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <% if @plan.requesters.presence && allowed_to?(:edit, :plan, plan: @plan) %>
2
+ <div class="card extra">
3
+ <div class="definition-data__item">
4
+ <span class="definition-data__title">
5
+ <%= t("decidim.plans.requests.title") %>
6
+ </span>
7
+ </div>
8
+ <% @plan.requesters.each do |requester| %>
9
+ <div class="definition-data__item expanded" id="request_<%= requester.id %>">
10
+ <%= cell "decidim/author", present(requester), options: { extra_classes: ["author-data--small"] }, has_actions: false %>
11
+
12
+ <div>
13
+ <%= render partial: "accept_request_access_form", locals: { requester: requester } %>
14
+
15
+ <%= render partial: "reject_request_access_form", locals: { requester: requester } %>
16
+ </div>
17
+ </div>
18
+ <% end %>
19
+ </div>
20
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <% unless content.nil? || present(content).body.empty? %>
2
+ <div class="section">
3
+ <h3 class="section-heading"><%= present(content).title %></h3>
4
+ <div class="section-content"><%= present(content).body %></div>
5
+ </div>
6
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <div class="plan-contents">
2
+ <% @plan.sections.each do |section| %>
3
+ <%=
4
+ render partial: "content",
5
+ object: @plan.contents.find_by(section: section)
6
+ %>
7
+ <% end %>
8
+ </div>
@@ -0,0 +1 @@
1
+ <%= t(".plans_count", count: @plans.total_count) %>
@@ -0,0 +1,32 @@
1
+ <%= filter_form_for filter do |form| %>
2
+ <div class="filters__section">
3
+ <div class="filters__search">
4
+ <div class="input-group">
5
+ <%= form.search_field :search_text, label: false, class: "input-group-field", placeholder: t(".search") %>
6
+ <div class="input-group-button">
7
+ <button type="submit" class="button button--muted">
8
+ <%= icon "magnifying-glass", aria_label: t(".search") %>
9
+ </button>
10
+ </div>
11
+ </div>
12
+ </div>
13
+ </div>
14
+
15
+ <% if component_settings.plan_answering_enabled && current_settings.plan_answering_enabled %>
16
+ <%= form.collection_radio_buttons :state, [["except_rejected", t(".except_rejected")], ["accepted", t(".accepted")], ["evaluating", t(".evaluating")], ["rejected", t(".rejected")], ["all", t(".all")]], :first, :last, legend_title: t(".state") %>
17
+ <% end %>
18
+
19
+ <% if linked_classes_for(Decidim::Plans::Plan).any? %>
20
+ <%= form.collection_radio_buttons :related_to, linked_classes_filter_values_for(Decidim::Plans::Plan), :first, :last, legend_title: t(".related_to") %>
21
+ <% end %>
22
+
23
+ <% if current_participatory_space.has_subscopes? %>
24
+ <%= scopes_picker_filter form, :scope_id %>
25
+ <% end %>
26
+
27
+ <% if current_component.categories.any? %>
28
+ <%= form.categories_select :category_id, current_component.categories, legend_title: t(".category"), disable_parents: false, label: false, prompt: t(".category_prompt") %>
29
+ <% end %>
30
+
31
+ <%= hidden_field_tag :order, order, id: nil, class: "order_filter" %>
32
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <div class="filters-controls hide-for-mediumlarge">
2
+ <button data-open="filter-box" class="filters-controls__trigger">
3
+ <%= t ".filter" %>
4
+ <%= icon "caret-bottom", class: "icon--small float-right", aria_label: t(".unfold"), role: "img" %>
5
+ </button>
6
+ </div>
7
+
8
+ <div class="reveal" id="filter-box" data-reveal>
9
+ <div class="reveal__header">
10
+ <h3 class="reveal__title"><%= t ".filter_by" %>:</h3>
11
+ <button class="close-button" data-close aria-label="<%= t(".close_modal") %>" type="button">
12
+ <span aria-hidden="true">&times;</span>
13
+ </button>
14
+ </div>
15
+ <div class="filters">
16
+ <%= render partial: "filters" %>
17
+ </div>
18
+ </div>
@@ -0,0 +1,57 @@
1
+ <%
2
+ # Force the form to be multipart for the file uploads.
3
+ # Calling Decidim form builder's own `upload` builder method should already do
4
+ # this but it is not working in our case since we have multiple file fields.
5
+ form.multipart = true
6
+ %>
7
+
8
+ <% if Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
9
+ <div class="field">
10
+ <%= user_group_select_field form, :user_group_id %>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="row column">
15
+ <%= attached_proposals_picker_field form, :proposals %>
16
+ </div>
17
+
18
+ <%= javascript_include_tag "decidim/plans/proposal_picker" %>
19
+ <%= stylesheet_link_tag "decidim/plans/proposal_picker" %>
20
+
21
+ <div class="field">
22
+ <%= remaining_characters("plans_title", component_settings.plan_title_length) do |opts| %>
23
+ <% if component_settings.multilingual_answers? %>
24
+ <%= form.translated :text_field, :title, opts %>
25
+ <% else %>
26
+ <%= form.text_field(
27
+ "title_#{current_locale}".to_sym,
28
+ {
29
+ label: form.label_for(:title)
30
+ }.merge(opts)
31
+ ) %>
32
+ <% end %>
33
+ <% end %>
34
+ </div>
35
+
36
+ <% if @form.categories&.any? %>
37
+ <div class="field">
38
+ <%= form.categories_select :category_id, @form.categories, prompt: t(".select_a_category") %>
39
+ </div>
40
+ <% end %>
41
+
42
+ <% if current_participatory_space.has_subscopes? %>
43
+ <div class="field">
44
+ <%= scopes_picker_field form, :scope_id %>
45
+ </div>
46
+ <% end %>
47
+
48
+ <% @form.contents.each_with_index do |content, idx| %>
49
+ <%= fields_for "contents[]", content, namespace: "plans_section_#{content.section.id}" do |content_form| %>
50
+ <%= render "decidim/plans/shared/section_content_field", form: content_form, id: tabs_id_for_content(idx) %>
51
+ <% end %>
52
+ <% end %>
53
+
54
+ <%= render partial: "decidim/plans/shared/attachments", object: form, locals: { form: form, blank_attachment: blank_attachment, component_settings: component_settings } %>
55
+
56
+ <%= javascript_include_tag "decidim/plans/plans_form" %>
57
+ <%= stylesheet_link_tag "decidim/plans/plans_form" %>
@@ -0,0 +1,11 @@
1
+ <% if current_settings.creation_enabled %>
2
+ <%= action_authorized_link_to :create, new_plan_path, class: "title-action__action button small hollow", data: { "redirect_url" => new_plan_path } do %>
3
+ <%= t(".new_plan") %>
4
+ <%= icon "plus" %>
5
+ <% end %>
6
+ <% else %>
7
+ <span class="title-action__action button small hollow disabled">
8
+ <%= t(".new_plan") %>
9
+ <%= icon "plus" %>
10
+ </span>
11
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= card_for plan, from: plan %>
@@ -0,0 +1 @@
1
+ <%= card_for plan, size: :m, full_description: true %>
@@ -0,0 +1,14 @@
1
+ <div class="collection-sort-controls row small-up-1 medium-up-3 card-grid">
2
+ <div class="column">
3
+ <%= order_selector available_orders, i18n_scope: "decidim.plans.plans.orders" %>
4
+ </div>
5
+
6
+ <div class="column">
7
+ <%= render partial: "decidim/shared/results_per_page" %>
8
+ </div>
9
+ </div>
10
+
11
+ <div class="row small-up-1 medium-up-2 card-grid">
12
+ <%= render @plans %>
13
+ </div>
14
+ <%= decidim_paginate @plans, random_seed: random_seed %>
@@ -0,0 +1,10 @@
1
+ <% if allowed_to?(:edit, :plan, plan: @plan) %>
2
+ <%= decidim_form_for(@reject_request_form, url: request_reject_plan_path(@plan)) do |form| %>
3
+ <%= form.hidden_field :id, value: @plan.id %>
4
+ <%= form.hidden_field :state, value: @plan.state %>
5
+ <%= form.hidden_field :requester_user_id, value: requester.id %>
6
+ <%= button_tag type: "submit", data: { disable: true }, title: t("decidim.plans.requests.reject_request") do %>
7
+ <%= icon "x", class: "icon--small muted ml-xs" %>
8
+ <% end %>
9
+ <% end %>
10
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% if allowed_to?(:request_access, :plan, plan: @plan) %>
2
+ <%= decidim_form_for(@request_access_form, url: request_access_plan_path(@plan)) do |form| %>
3
+ <%= form.hidden_field :id, value: @plan.id %>
4
+ <%= form.hidden_field :state, value: @plan.state %>
5
+ <%= form.submit t(:request_access, scope: "decidim.plans.plans.show"), class: "button expanded button--sc mt-s", data: { disable: true } %>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,21 @@
1
+ <div class="row">
2
+ <div class="columns large-6 small-centered">
3
+ <div class="card">
4
+ <div class="card__content">
5
+ <%= decidim_form_for(@form, html: { class: "plans-form" }) do |form| %>
6
+ <%= render partial: "form", object: form %>
7
+
8
+ <div class="actions">
9
+ <%= form.submit t(".update"), class: "button expanded mt-s mb-none", data: { disable: true } %>
10
+ </div>
11
+
12
+ <% if @plan.draft? %>
13
+ <div class="row column flex-center">
14
+ <%= link_to t(".discard"), plan_path(@plan), method: :delete, data: { confirm: t(".discard_confirmation") } %>
15
+ </div>
16
+ <% end %>
17
+ <% end %>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
@@ -0,0 +1,28 @@
1
+ <%= render partial: "decidim/shared/component_announcement" %>
2
+
3
+ <div class="row columns">
4
+ <div class="title-action">
5
+ <h2 id="plans-count" class="title-action__title section-heading">
6
+ <%= render partial: "count" %>
7
+ </h2>
8
+ <%= render "new_plan_button" %>
9
+ </div>
10
+ </div>
11
+ <div class="row">
12
+ <div class="columns mediumlarge-4 large-3">
13
+ <%= render partial: "filters_small_view" %>
14
+ <div class="card card--secondary show-for-mediumlarge">
15
+ <%= render partial: "filters" %>
16
+ </div>
17
+ </div>
18
+ <div id="plans" class="columns mediumlarge-8 large-9">
19
+ <%= render partial: "plans" %>
20
+ </div>
21
+ </div>
22
+ <div class="row columns">
23
+ <div class="text-right">
24
+ <%= link_to t(".see_all_withdrawn"), plans_path("filter[state]" => "withdrawn") %>
25
+ </div>
26
+ </div>
27
+ <%= javascript_include_tag "decidim/filters" %>
28
+ <%= javascript_include_tag "decidim/orders" %>
@@ -0,0 +1,10 @@
1
+ var $plans = $('#plans');
2
+ var $plansCount = $('#plans-count');
3
+ var $orderFilterInput = $('.order_filter');
4
+
5
+ $plans.html('<%= j(render partial: "plans").strip.html_safe %>');
6
+ $plansCount.html('<%= j(render partial: "count").strip.html_safe %>');
7
+ $orderFilterInput.val('<%= order %>');
8
+
9
+ var $dropdownMenu = $('.dropdown.menu', $plans);
10
+ $dropdownMenu.foundation();
@@ -0,0 +1,15 @@
1
+ <div class="row">
2
+ <div class="columns large-6 small-centered">
3
+ <div class="card">
4
+ <div class="card__content">
5
+ <%= decidim_form_for(@form, html: { class: "plans-form" }) do |form| %>
6
+ <%= render partial: "form", object: form %>
7
+
8
+ <div class="actions">
9
+ <%= form.submit t(".create"), class: "button expanded mt-s mb-none", data: { disable: true } %>
10
+ </div>
11
+ <% end %>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ </div>
@@ -0,0 +1,15 @@
1
+ <div class="row">
2
+ <div class="columns large-6 large-push-3">
3
+ <div class="card">
4
+ <div class="p-l">
5
+ <%= render partial: "plan_preview", locals: { plan: @plan } %>
6
+ <div class="row column flex-center">
7
+ <%= link_to t(".modify"), edit_plan_path(@plan) %>
8
+
9
+ <%= button_to t(".publish"), publish_plan_path(@plan), method: :post, class: "button button--nomargin small" %>
10
+ </div>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ <div class="columns large-3"></div>
15
+ </div>