decidim-challenges 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE-AGPLv3.txt +661 -0
  3. data/README.md +49 -0
  4. data/Rakefile +9 -0
  5. data/app/cells/decidim/challenges/challenge_cell.rb +21 -0
  6. data/app/cells/decidim/challenges/challenge_g/show.erb +47 -0
  7. data/app/cells/decidim/challenges/challenge_g_cell.rb +69 -0
  8. data/app/cells/decidim/problems/problem_cell.rb +21 -0
  9. data/app/cells/decidim/problems/problem_g/show.erb +35 -0
  10. data/app/cells/decidim/problems/problem_g_cell.rb +61 -0
  11. data/app/cells/decidim/solutions/solution_cell.rb +21 -0
  12. data/app/cells/decidim/solutions/solution_g/show.erb +30 -0
  13. data/app/cells/decidim/solutions/solution_g_cell.rb +84 -0
  14. data/app/commands/decidim/challenges/admin/create_challenge.rb +67 -0
  15. data/app/commands/decidim/challenges/admin/destroy_challenge.rb +49 -0
  16. data/app/commands/decidim/challenges/admin/export_challenge_surveys.rb +45 -0
  17. data/app/commands/decidim/challenges/admin/publish_challenge.rb +40 -0
  18. data/app/commands/decidim/challenges/admin/unpublish_challenge.rb +40 -0
  19. data/app/commands/decidim/challenges/admin/update_challenge.rb +72 -0
  20. data/app/commands/decidim/challenges/admin/update_surveys.rb +43 -0
  21. data/app/commands/decidim/challenges/survey_challenge.rb +67 -0
  22. data/app/commands/decidim/command_utils.rb +20 -0
  23. data/app/commands/decidim/problems/admin/create_problem.rb +66 -0
  24. data/app/commands/decidim/problems/admin/destroy_problem.rb +49 -0
  25. data/app/commands/decidim/problems/admin/publish_problem.rb +40 -0
  26. data/app/commands/decidim/problems/admin/unpublish_problem.rb +40 -0
  27. data/app/commands/decidim/problems/admin/update_problem.rb +69 -0
  28. data/app/commands/decidim/solutions/admin/create_solution.rb +65 -0
  29. data/app/commands/decidim/solutions/admin/destroy_solution.rb +43 -0
  30. data/app/commands/decidim/solutions/admin/publish_solution.rb +40 -0
  31. data/app/commands/decidim/solutions/admin/unpublish_solution.rb +40 -0
  32. data/app/commands/decidim/solutions/admin/update_solution.rb +67 -0
  33. data/app/commands/decidim/solutions/create_solution.rb +67 -0
  34. data/app/controllers/concerns/decidim/challenges/admin/filterable.rb +27 -0
  35. data/app/controllers/concerns/decidim/challenges/orderable_challenges.rb +37 -0
  36. data/app/controllers/concerns/decidim/problems/admin/filterable.rb +27 -0
  37. data/app/controllers/concerns/decidim/problems/orderable_problems.rb +37 -0
  38. data/app/controllers/concerns/decidim/solutions/admin/filterable.rb +27 -0
  39. data/app/controllers/concerns/decidim/solutions/orderable_solutions.rb +37 -0
  40. data/app/controllers/concerns/decidim/with_default_filters.rb +23 -0
  41. data/app/controllers/concerns/decidim/with_sdgs.rb +19 -0
  42. data/app/controllers/decidim/challenges/admin/application_controller.rb +15 -0
  43. data/app/controllers/decidim/challenges/admin/challenge_publications_controller.rb +53 -0
  44. data/app/controllers/decidim/challenges/admin/challenges_controller.rb +108 -0
  45. data/app/controllers/decidim/challenges/admin/survey_form_controller.rb +43 -0
  46. data/app/controllers/decidim/challenges/admin/surveys_controller.rb +104 -0
  47. data/app/controllers/decidim/challenges/application_controller.rb +13 -0
  48. data/app/controllers/decidim/challenges/challenges_controller.rb +70 -0
  49. data/app/controllers/decidim/challenges/surveys_controller.rb +61 -0
  50. data/app/controllers/decidim/problems/admin/application_controller.rb +15 -0
  51. data/app/controllers/decidim/problems/admin/problem_publications_controller.rb +53 -0
  52. data/app/controllers/decidim/problems/admin/problems_controller.rb +102 -0
  53. data/app/controllers/decidim/problems/application_controller.rb +13 -0
  54. data/app/controllers/decidim/problems/problems_controller.rb +62 -0
  55. data/app/controllers/decidim/sdgs/admin/application_controller.rb +15 -0
  56. data/app/controllers/decidim/sdgs/admin/sdgs_controller.rb +18 -0
  57. data/app/controllers/decidim/sdgs/application_controller.rb +13 -0
  58. data/app/controllers/decidim/sdgs/sdgs_controller.rb +24 -0
  59. data/app/controllers/decidim/solutions/admin/application_controller.rb +15 -0
  60. data/app/controllers/decidim/solutions/admin/solution_publications_controller.rb +53 -0
  61. data/app/controllers/decidim/solutions/admin/solutions_controller.rb +106 -0
  62. data/app/controllers/decidim/solutions/application_controller.rb +13 -0
  63. data/app/controllers/decidim/solutions/solutions_controller.rb +115 -0
  64. data/app/forms/decidim/challenges/admin/challenge_surveys_form.rb +35 -0
  65. data/app/forms/decidim/challenges/admin/challenges_form.rb +78 -0
  66. data/app/forms/decidim/problems/admin/problems_form.rb +90 -0
  67. data/app/forms/decidim/solutions/admin/solutions_form.rb +71 -0
  68. data/app/forms/decidim/solutions/solutions_form.rb +50 -0
  69. data/app/helpers/decidim/challenges/application_helper.rb +25 -0
  70. data/app/helpers/decidim/challenges/challenge_cells_helper.rb +57 -0
  71. data/app/helpers/decidim/challenges/challenges_helper.rb +39 -0
  72. data/app/helpers/decidim/problems/application_helper.rb +10 -0
  73. data/app/helpers/decidim/problems/problem_cells_helper.rb +23 -0
  74. data/app/helpers/decidim/problems/problems_helper.rb +24 -0
  75. data/app/helpers/decidim/sdgs/sdgs_helper.rb +28 -0
  76. data/app/helpers/decidim/show_filters_helper.rb +13 -0
  77. data/app/helpers/decidim/solutions/application_helper.rb +27 -0
  78. data/app/helpers/decidim/solutions/solution_cells_helper.rb +56 -0
  79. data/app/helpers/decidim/solutions/solutions_helper.rb +21 -0
  80. data/app/models/decidim/application_record.rb +8 -0
  81. data/app/models/decidim/challenges/challenge.rb +82 -0
  82. data/app/models/decidim/challenges/survey.rb +19 -0
  83. data/app/models/decidim/problems/problem.rb +118 -0
  84. data/app/models/decidim/sdgs/sdg.rb +47 -0
  85. data/app/models/decidim/solutions/application_record.rb +10 -0
  86. data/app/models/decidim/solutions/solution.rb +69 -0
  87. data/app/packs/entrypoints/decidim_challenges.js +4 -0
  88. data/app/packs/entrypoints/decidim_challenges.scss +1 -0
  89. data/app/packs/entrypoints/decidim_problems.js +1 -0
  90. data/app/packs/entrypoints/decidim_problems.scss +1 -0
  91. data/app/packs/entrypoints/decidim_sdgs.js +6 -0
  92. data/app/packs/entrypoints/decidim_sdgs.scss +3 -0
  93. data/app/packs/entrypoints/decidim_shared.js +1 -0
  94. data/app/packs/entrypoints/decidim_shared.scss +1 -0
  95. data/app/packs/entrypoints/decidim_solutions.js +4 -0
  96. data/app/packs/entrypoints/decidim_solutions.scss +1 -0
  97. data/app/packs/fonts/Oswald-Medium.ttf +0 -0
  98. data/app/packs/images/decidim/challenges/decidim_challenges_icon.svg +1 -0
  99. data/app/packs/images/decidim/sdgs/ods-01.svg +11 -0
  100. data/app/packs/images/decidim/sdgs/ods-02.svg +11 -0
  101. data/app/packs/images/decidim/sdgs/ods-03.svg +11 -0
  102. data/app/packs/images/decidim/sdgs/ods-04.svg +12 -0
  103. data/app/packs/images/decidim/sdgs/ods-05.svg +12 -0
  104. data/app/packs/images/decidim/sdgs/ods-06.svg +20 -0
  105. data/app/packs/images/decidim/sdgs/ods-07.svg +18 -0
  106. data/app/packs/images/decidim/sdgs/ods-08.svg +13 -0
  107. data/app/packs/images/decidim/sdgs/ods-09.svg +25 -0
  108. data/app/packs/images/decidim/sdgs/ods-10.svg +13 -0
  109. data/app/packs/images/decidim/sdgs/ods-11.svg +41 -0
  110. data/app/packs/images/decidim/sdgs/ods-12.svg +11 -0
  111. data/app/packs/images/decidim/sdgs/ods-13.svg +57 -0
  112. data/app/packs/images/decidim/sdgs/ods-14.svg +14 -0
  113. data/app/packs/images/decidim/sdgs/ods-15.svg +11 -0
  114. data/app/packs/images/decidim/sdgs/ods-16.svg +14 -0
  115. data/app/packs/images/decidim/sdgs/ods-17.svg +39 -0
  116. data/app/packs/images/decidim/sdgs/sdg-wheel.png +0 -0
  117. data/app/packs/images/decidim/sdgs/un_emblem_square.png +0 -0
  118. data/app/packs/src/decidim/challenges/add_challenge.js +3 -0
  119. data/app/packs/src/decidim/challenges/admin/challenges_form.js +3 -0
  120. data/app/packs/src/decidim/sdgs/filter.js +75 -0
  121. data/app/packs/stylesheets/decidim/challenges/challenges.scss +3 -0
  122. data/app/packs/stylesheets/decidim/problems/problems.scss +3 -0
  123. data/app/packs/stylesheets/decidim/sdgs/ods.scss +185 -0
  124. data/app/packs/stylesheets/decidim/sdgs/sdgs_filter/button.scss +27 -0
  125. data/app/packs/stylesheets/decidim/sdgs/sdgs_filter/modal.scss +60 -0
  126. data/app/packs/stylesheets/decidim/shared/_cards.scss +52 -0
  127. data/app/packs/stylesheets/decidim/shared/base.scss +9 -0
  128. data/app/packs/stylesheets/decidim/solutions/solutions.scss +3 -0
  129. data/app/permissions/decidim/challenges/admin/permissions.rb +88 -0
  130. data/app/permissions/decidim/challenges/permissions.rb +27 -0
  131. data/app/permissions/decidim/problems/admin/permissions.rb +52 -0
  132. data/app/permissions/decidim/problems/permissions.rb +16 -0
  133. data/app/permissions/decidim/solutions/admin/permissions.rb +58 -0
  134. data/app/permissions/decidim/solutions/permissions.rb +17 -0
  135. data/app/presenters/decidim/challenges/challenge_presenter.rb +134 -0
  136. data/app/presenters/decidim/problems/problem_presenter.rb +108 -0
  137. data/app/presenters/decidim/solutions/solution_presenter.rb +198 -0
  138. data/app/serializers/decidim/challenges/data_serializer.rb +46 -0
  139. data/app/serializers/decidim/challenges/survey_serializer.rb +37 -0
  140. data/app/types/decidim/challenges/challenge_type.rb +28 -0
  141. data/app/types/decidim/challenges/challenges_type.rb +32 -0
  142. data/app/types/decidim/problems/problem_type.rb +29 -0
  143. data/app/types/decidim/problems/problems_type.rb +32 -0
  144. data/app/types/decidim/solutions/solution_type.rb +25 -0
  145. data/app/types/decidim/solutions/solutions_type.rb +32 -0
  146. data/app/views/decidim/challenges/admin/challenges/_form.html.erb +78 -0
  147. data/app/views/decidim/challenges/admin/challenges/edit.html.erb +24 -0
  148. data/app/views/decidim/challenges/admin/challenges/index.html.erb +88 -0
  149. data/app/views/decidim/challenges/admin/challenges/new.html.erb +18 -0
  150. data/app/views/decidim/challenges/admin/surveys/_form.html.erb +9 -0
  151. data/app/views/decidim/challenges/admin/surveys/edit.html.erb +39 -0
  152. data/app/views/decidim/challenges/admin/surveys/index.html.erb +49 -0
  153. data/app/views/decidim/challenges/admin/surveys/show.html.erb +43 -0
  154. data/app/views/decidim/challenges/challenges/_challenge.html.erb +1 -0
  155. data/app/views/decidim/challenges/challenges/_challenges.html.erb +11 -0
  156. data/app/views/decidim/challenges/challenges/_related_problems.html.erb +14 -0
  157. data/app/views/decidim/challenges/challenges/_sidebar_data.html.erb +60 -0
  158. data/app/views/decidim/challenges/challenges/index.html.erb +29 -0
  159. data/app/views/decidim/challenges/challenges/index.js.erb +5 -0
  160. data/app/views/decidim/challenges/challenges/show.html.erb +41 -0
  161. data/app/views/decidim/problems/admin/problems/_form.html.erb +79 -0
  162. data/app/views/decidim/problems/admin/problems/edit.html.erb +24 -0
  163. data/app/views/decidim/problems/admin/problems/index.html.erb +93 -0
  164. data/app/views/decidim/problems/admin/problems/new.html.erb +18 -0
  165. data/app/views/decidim/problems/problems/_problem.html.erb +1 -0
  166. data/app/views/decidim/problems/problems/_problems.html.erb +11 -0
  167. data/app/views/decidim/problems/problems/_sidebar_data.html.erb +70 -0
  168. data/app/views/decidim/problems/problems/index.html.erb +28 -0
  169. data/app/views/decidim/problems/problems/index.js.erb +5 -0
  170. data/app/views/decidim/problems/problems/show.html.erb +38 -0
  171. data/app/views/decidim/sdgs/sdgs/_objectives.html.erb +320 -0
  172. data/app/views/decidim/sdgs/sdgs/_ods.html.erb +132 -0
  173. data/app/views/decidim/sdgs/sdgs/index.html.erb +64 -0
  174. data/app/views/decidim/sdgs/sdgs_filter/_filter_selector.html.erb +7 -0
  175. data/app/views/decidim/sdgs/sdgs_filter/_modal.html.erb +35 -0
  176. data/app/views/decidim/shared/_related_solutions.html.erb +14 -0
  177. data/app/views/decidim/solutions/admin/solutions/_documents.html.erb +13 -0
  178. data/app/views/decidim/solutions/admin/solutions/_form.html.erb +70 -0
  179. data/app/views/decidim/solutions/admin/solutions/_photos.html.erb +13 -0
  180. data/app/views/decidim/solutions/admin/solutions/edit.html.erb +24 -0
  181. data/app/views/decidim/solutions/admin/solutions/index.html.erb +97 -0
  182. data/app/views/decidim/solutions/admin/solutions/new.html.erb +18 -0
  183. data/app/views/decidim/solutions/admin/solutions/show.html.erb +114 -0
  184. data/app/views/decidim/solutions/solutions/_form.html.erb +22 -0
  185. data/app/views/decidim/solutions/solutions/_sidebar_data.html.erb +114 -0
  186. data/app/views/decidim/solutions/solutions/_solution.html.erb +1 -0
  187. data/app/views/decidim/solutions/solutions/_solutions.html.erb +13 -0
  188. data/app/views/decidim/solutions/solutions/index.html.erb +37 -0
  189. data/app/views/decidim/solutions/solutions/index.js.erb +5 -0
  190. data/app/views/decidim/solutions/solutions/new.html.erb +20 -0
  191. data/app/views/decidim/solutions/solutions/show.html.erb +72 -0
  192. data/config/assets.rb +27 -0
  193. data/config/i18n-tasks.yml +10 -0
  194. data/config/locales/ca.yml +1244 -0
  195. data/config/locales/cs.yml +668 -0
  196. data/config/locales/en.yml +1245 -0
  197. data/config/locales/es.yml +1250 -0
  198. data/config/locales/oc.yml +1229 -0
  199. data/db/migrate/20201014125000_create_decidim_challenges_challenges.rb +23 -0
  200. data/db/migrate/20201103155100_create_decidim_problems_problems.rb +25 -0
  201. data/db/migrate/20201116111200_create_decidim_solutions_solutions.rb +21 -0
  202. data/db/migrate/20210413083244_create_decidim_challenges_surveys.rb +14 -0
  203. data/db/migrate/20210413083507_add_survey_attributes_to_challenges.rb +7 -0
  204. data/db/migrate/20210413083604_add_questionnaire_to_existing_challenges.rb +15 -0
  205. data/db/migrate/20210413112229_add_challenge_reference_to_solutions.rb +7 -0
  206. data/db/migrate/20210427091033_remove_require_null_in_problems_for_solutions.rb +7 -0
  207. data/db/migrate/20220407110503_add_card_image_to_challenges.rb +7 -0
  208. data/db/migrate/20240919094714_add_public_fields_to_solutions.rb +10 -0
  209. data/lib/decidim/challenges/admin.rb +10 -0
  210. data/lib/decidim/challenges/admin_engine.rb +37 -0
  211. data/lib/decidim/challenges/component.rb +65 -0
  212. data/lib/decidim/challenges/engine.rb +39 -0
  213. data/lib/decidim/challenges/test/factories.rb +59 -0
  214. data/lib/decidim/challenges/version.rb +14 -0
  215. data/lib/decidim/challenges.rb +13 -0
  216. data/lib/decidim/problems/admin.rb +10 -0
  217. data/lib/decidim/problems/admin_engine.rb +25 -0
  218. data/lib/decidim/problems/component.rb +51 -0
  219. data/lib/decidim/problems/engine.rb +31 -0
  220. data/lib/decidim/problems/test/factories.rb +39 -0
  221. data/lib/decidim/sdgs/admin.rb +10 -0
  222. data/lib/decidim/sdgs/admin_engine.rb +28 -0
  223. data/lib/decidim/sdgs/component.rb +44 -0
  224. data/lib/decidim/sdgs/engine.rb +23 -0
  225. data/lib/decidim/sdgs/test/factories.rb +13 -0
  226. data/lib/decidim/solutions/admin.rb +10 -0
  227. data/lib/decidim/solutions/admin_engine.rb +25 -0
  228. data/lib/decidim/solutions/component.rb +52 -0
  229. data/lib/decidim/solutions/engine.rb +31 -0
  230. data/lib/decidim/solutions/test/factories.rb +28 -0
  231. metadata +316 -0
@@ -0,0 +1,70 @@
1
+ <div class="form__wrapper">
2
+ <div class="card pt-4">
3
+ <div class="card-section">
4
+ <div class="row column hashtags__container">
5
+ <%= form.translated :text_field, :title, autofocus: true, class: "js-hashtags", hashtaggable: true, aria: { label: :title } %>
6
+ </div>
7
+
8
+ <div class="row column hashtags__container">
9
+ <%= form.translated :editor, :description %>
10
+ </div>
11
+
12
+ <div class="row column hashtags__container">
13
+ <%= form.text_field :tags %>
14
+ </div>
15
+
16
+ <div class="row column hashtags__container">
17
+ <%= form.translated :editor, :indicators %>
18
+ </div>
19
+
20
+ <div class="row column hashtags__container">
21
+ <%= form.translated :editor, :objectives %>
22
+ </div>
23
+
24
+ <div class="row column hashtags__container">
25
+ <%= form.translated :editor, :beneficiaries %>
26
+ </div>
27
+
28
+ <div class="row column hashtags__container">
29
+ <%= form.translated :editor, :requirements %>
30
+ </div>
31
+
32
+ <div class="row column hashtags__container">
33
+ <%= form.translated :text_field, :financing_type %>
34
+ </div>
35
+
36
+ <% if current_participatory_space.components.where(manifest_name: "problems").present? %>
37
+ <div class="card-divider">
38
+ <h2 class="card-title"><%= t(".problem") %></h2>
39
+ </div>
40
+ <% else %>
41
+ <div class="card-divider">
42
+ <h2 class="card-title"><%= t(".challenge") %></h2>
43
+ </div>
44
+ <% end %>
45
+
46
+ <% if current_participatory_space.components.where(manifest_name: "problems").present? %>
47
+ <div class="card-section">
48
+ <div class="row column">
49
+ <%= form.select :decidim_problems_problem_id,
50
+ @form.select_problem_collection,
51
+ selected: @form.try(:problem) ? [translated_attribute(@form.try(:problem).title), @form.try(:problem).id] : '',
52
+ label: t("models.solution.fields.problem", scope: "decidim.solutions.admin"),
53
+ include_blank: "" %>
54
+ </div>
55
+ </div>
56
+ <%= form.hidden_field :decidim_challenges_challenge_id, value: @form.try(:challenge) ? @form.try(:challenge).id : '' %>
57
+ <% else %>
58
+ <%= form.hidden_field :decidim_problems_problem_id, value: @form.try(:problem) ? @form.try(:problem).id : '' %>
59
+ <div class="card-section"">
60
+ <div class="row column">
61
+ <%= form.select :decidim_challenges_challenge_id,
62
+ @form.select_challenge_collection,
63
+ selected: @form.try(:challenge) ? [translated_attribute(@form.try(:challenge).title), @form.try(:challenge).id] : '',
64
+ label: t("models.solution.fields.challenge", scope: "decidim.solutions.admin"),
65
+ include_blank: "" %>
66
+ </div>
67
+ </div>
68
+ <% end %>
69
+ </div>
70
+ </div>
@@ -0,0 +1,13 @@
1
+ <div class="card-section">
2
+ <div class="row column">
3
+ <strong><%= t("photos", scope: "decidim.solutions.admin.solutions.show") %>:</strong>
4
+ <div id="photos" class="gallery row" data-gallery>
5
+ <% solution.photos.each do |photo| %>
6
+ <%= link_to photo.big_url, target: "_blank", rel: "noopener" do %>
7
+ <%= image_tag photo.thumbnail_url,
8
+ class: "thumbnail", alt: strip_tags(translated_attribute(photo.title)) %>
9
+ <% end %>
10
+ <% end %>
11
+ </div>
12
+ </div>
13
+ </div>
@@ -0,0 +1,24 @@
1
+ <% add_decidim_page_title(t(".title")) %>
2
+ <div class="item_show__header">
3
+ <h1 class="item_show__header-title">
4
+ <%= t(".title") %>
5
+ </h1>
6
+ </div>
7
+ <div class="item__edit item__edit-1col">
8
+ <div class="item__edit-form">
9
+ <%= decidim_form_for(@form, html: { class: "form-defaults form edit_solution solution_form_admin" }) do |f| %>
10
+ <%= render partial: "form", object: f, locals: { title: t(".title") } %>
11
+ <div class="item__edit-sticky">
12
+ <div class="item__edit-sticky-container">
13
+ <%= f.submit t(".update"), class: "button button__sm button__secondary" %>
14
+
15
+ <% if solution.published? %>
16
+ <%= link_to t("actions.unpublish", scope: "decidim.solutions.admin"), solution_publish_path(solution), method: :delete, class: "button button__sm button__secondary" %>
17
+ <% else %>
18
+ <%= link_to t("actions.publish", scope: "decidim.solutions.admin"), solution_publish_path(solution), method: :post, class: "button button__sm button__secondary" %>
19
+ <% end %>
20
+ </div>
21
+ </div>
22
+ <% end %>
23
+ </div>
24
+ </div>
@@ -0,0 +1,97 @@
1
+ <% add_decidim_page_title(t(".title")) %>
2
+ <div class="card">
3
+ <div class="item_show__header">
4
+ <h1 class="item_show__header-title">
5
+ <div>
6
+ <%= t(".title") %>
7
+ <span id="js-selected-solutions-count" class="component-counter component-counter--inline" title="<%= t("decidim.solutions.admin.titles.solutions_list") %>"></span>
8
+ </div>
9
+ <div class="flex items-center gap-x-4">
10
+ <% if allowed_to? :create, :solution %>
11
+ <%= link_to t("actions.new_solution", scope: "decidim.solutions.admin"),
12
+ new_solution_path,
13
+ class: "button button__sm button__secondary" %>
14
+ <% end %>
15
+
16
+ <%= render partial: "decidim/admin/components/resource_action" %>
17
+ </div>
18
+ </h1>
19
+ </div>
20
+
21
+ <div class="table-scroll mt-16">
22
+ <table class="table-list">
23
+ <thead>
24
+ <tr>
25
+ <th>
26
+ <%= t("models.solution.fields.title", scope: "decidim.solutions.admin") %>
27
+ </th>
28
+ <th>
29
+ <%= t("models.solution.fields.created_at", scope: "decidim.solutions.admin") %>
30
+ </th>
31
+ <th>
32
+ <%= t("models.solution.fields.problem", scope: "decidim.solutions.admin") %>
33
+ </th>
34
+ <th>
35
+ <%= t("models.solution.fields.challenge", scope: "decidim.solutions.admin") %>
36
+ </th>
37
+ <th>
38
+ <%= t("models.solution.fields.published", scope: "decidim.solutions.admin") %>
39
+ </th>
40
+ <th>
41
+ <%= t("models.solution.fields.author", scope: "decidim.solutions.admin") %>
42
+ </th>
43
+ <th class="table-list__actions"></th>
44
+ </tr>
45
+ </thead>
46
+ <tbody>
47
+ <% @solutions.each do |solution| %>
48
+ <tr>
49
+ <td>
50
+ <%= translated_attribute(solution.title) %>
51
+ </td>
52
+ <td>
53
+ <%= l(solution.created_at, format: :decidim_short) if solution.created_at %>
54
+ </td>
55
+ <td>
56
+ <%= translated_attribute(solution.problem&.title) %>
57
+ </td>
58
+ <td>
59
+ <%= translated_attribute(solution.challenge&.title) %>
60
+ </td>
61
+ <td>
62
+ <% if solution.published? %>
63
+ <strong class="text-success"><%= t("index.published", scope: "decidim.solutions") %></strong>
64
+ <% else %>
65
+ <strong class="text-alert"><%= t("index.not_published", scope: "decidim.solutions") %></strong>
66
+ <% end %>
67
+ </td>
68
+ <td>
69
+ <% if solution.author.admin? %>
70
+ <%= t("index.official", scope: "decidim.solutions") %>
71
+ <% else %>
72
+ <%= solution.author.name %>
73
+ <% end %>
74
+ </td>
75
+ <td class="table-list__actions">
76
+ <% if solution.author.admin? %>
77
+ <% if allowed_to? :edit, :solution %>
78
+ <%= icon_link_to "pencil-line", edit_solution_path(solution), t("actions.configure", scope: "decidim.solutions.admin"), class: "action-icon--new" %>
79
+ <% end %>
80
+ <%= icon_link_to "eye-line", resource_locator(solution).path, t("actions.view", scope: "decidim.solutions.admin"), class: "action-icon--preview", target: :blank %>
81
+ <% if allowed_to? :destroy, :solution, solution: solution %>
82
+ <%= icon_link_to "close-circle-line", solution, t("actions.destroy", scope: "decidim.solutions.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.solutions.admin", name: translated_attribute(solution.title)) } %>
83
+ <% end %>
84
+ <% else %>
85
+ <% if allowed_to? :publish, :solution %>
86
+ <%= icon_link_to("question-answer-line", solution_path(solution), t(:publish_solution, scope: "decidim.solutions.admin.actions"), class: "icon--small action-icon--show-solution") %>
87
+ <% end %>
88
+ <% end %>
89
+ </td>
90
+ </tr>
91
+ <% end %>
92
+ </tbody>
93
+ </table>
94
+ </div>
95
+ </div>
96
+
97
+ <%= decidim_paginate @solutions %>
@@ -0,0 +1,18 @@
1
+ <% add_decidim_page_title(t(".title")) %>
2
+ <div class="item_show__header">
3
+ <h1 class="item_show__header-title">
4
+ <%= t(".title") %>
5
+ </h1>
6
+ </div>
7
+ <div class="item__edit item__edit-1col">
8
+ <div class="item__edit-form">
9
+ <%= decidim_form_for(@form, html: { class: "form-defaults form new_solution solution_form_admin" }) do |f| %>
10
+ <%= render partial: "form", object: f, locals: { title: t(".title") } %>
11
+ <div class="item__edit-sticky">
12
+ <div class="item__edit-sticky-container">
13
+ <%= f.submit t(".create"), class: "button button__sm button__secondary" %>
14
+ </div>
15
+ </div>
16
+ <% end %>
17
+ </div>
18
+ </div>
@@ -0,0 +1,114 @@
1
+ <% add_decidim_page_title(translated_attribute(solution.title)) %>
2
+
3
+ <div class="component__show">
4
+ <div class="card">
5
+ <div class="component__show_header">
6
+ <h2 class="component__show_header-title">
7
+ <%= decidim_html_escape(solution.title).html_safe %>
8
+ </h2>
9
+ </div>
10
+
11
+ <div class="component__show_nav">
12
+ <div class="component__show_nav-author">
13
+ <div class="component__show_nav-circle">
14
+ <%= icon "award-line" %>
15
+ </div>
16
+ <div>
17
+ <li class="component__show_nav-author-title">
18
+ <strong><%= t ".author" %>:</strong>
19
+ <%= link_to_if(
20
+ decidim.profile_path(solution.author.nickname).present?,
21
+ solution.author.name,
22
+ decidim.profile_path(solution.author.nickname),
23
+ target: :blank
24
+ ) %>
25
+ </li>
26
+ <span class="component__show_nav-author-date">
27
+ <%= l solution.created_at, format: :decidim_short %>
28
+ </span>
29
+ </div>
30
+ </div>
31
+ <div class="ml-auto">
32
+ <%= link_to resource_locator(solution).url, class: "button button__sm button__transparent-secondary", target: :blank, data: { "external-link": false } do %>
33
+ <%= icon "eye-line", class: "fill-current" %>
34
+ <%= t ".link" %>
35
+ <% end %>
36
+ </div>
37
+ </div>
38
+
39
+ <div class="component__show_grid">
40
+ <div class="component__show_grid-item">
41
+ <div class="card-section">
42
+ <div class="row column">
43
+ <span class="component__show-description"><%= t ".description" %></span>
44
+ <p class="component__show-text">
45
+ <%= decidim_sanitize_editor_admin translated_attribute solution.description %>
46
+ </p>
47
+ </div>
48
+ </div>
49
+
50
+ <% if solution.documents.any? %>
51
+ <%= render partial: "documents", locals: { solution: } %>
52
+ <% end %>
53
+
54
+ <% if solution.photos.any? %>
55
+ <%= render partial: "photos", locals: { solution: } %>
56
+ <% end %>
57
+ </div>
58
+ </div>
59
+
60
+ <div class="card-section">
61
+ <div class="row column">
62
+ <span class="component__show-title"><%= t ".project_status" %></span>
63
+ <div class="flex items-center gap-x-2 mt-2">
64
+ <p class="component__show-icon-text">
65
+ <%= t("decidim.solutions.solutions.form.project_statuses.#{solution.project_status}") %>
66
+ </p>
67
+ </div>
68
+ </div>
69
+ </div>
70
+
71
+ <div class="card-section">
72
+ <div class="row column">
73
+ <span class="component__show-title"><%= t ".coordinating_entity" %></span>
74
+ <div class="flex items-center gap-x-2 mt-2">
75
+ <p class="component__show-icon-text">
76
+ <%= solution.coordinating_entity %>
77
+ </p>
78
+ </div>
79
+ </div>
80
+ </div>
81
+
82
+ <div class="card-section">
83
+ <div class="row column">
84
+ <span class="component__show-title"><%= t ".challenge" %></span>
85
+ <div class="flex items-center gap-x-2 mt-2">
86
+ <p class="component__show-icon-text">
87
+ <%= link_to translated_attribute(solution.challenge.title), Decidim::ResourceLocatorPresenter.new(solution.challenge).path %>
88
+ </p>
89
+ </div>
90
+ </div>
91
+ </div>
92
+
93
+ <div class="card-section">
94
+ <div class="row column">
95
+ <span class="component__show-title"><%= t ".project_url" %></span>
96
+ <div class="flex items-center gap-x-2 mt-2">
97
+ <p class="component__show-icon-text">
98
+ <%= link_to solution.project_url, "http://#{solution.project_url}", target: "_blank" %>
99
+ </p>
100
+ </div>
101
+ </div>
102
+ </div>
103
+ </div>
104
+ </div>
105
+ <div class="item__edit-sticky">
106
+ <div class="item__edit-sticky-container">
107
+ <% if solution.published? %>
108
+ <%= link_to t("actions.unpublish", scope: "decidim.solutions.admin"), solution_publish_path(solution), method: :delete, class: "button button__sm button__secondary" %>
109
+ <% else %>
110
+ <%= link_to t("actions.publish", scope: "decidim.solutions.admin"), solution_publish_path(solution), method: :post, class: "button button__sm button__secondary" %>
111
+ <% end %>
112
+ </div>
113
+ </div>
114
+
@@ -0,0 +1,22 @@
1
+ <%= form.text_field :title, class: "js-hashtags" %>
2
+
3
+ <%= text_editor_for_description(form) %>
4
+
5
+ <%= form.select :decidim_challenges_challenge_id, participatory_space_challenges.map{|challenge| [translated_attribute(challenge.title), challenge.id] }, include_blank: true %>
6
+
7
+ <%= form.text_field :coordinating_entity, class: "js-hashtags" %>
8
+
9
+ <%= form.select :project_status, [{title: t(".project_statuses.in_progress"), key: :in_progress}, {title: t('.project_statuses.finished'), key: :finished}].map{|result| [result[:title], result[:key]] }, include_blank: true %>
10
+
11
+ <%= form.text_field :project_url, class: "js-hashtags" %>
12
+
13
+ <%= form.hidden_field :decidim_problems_problem_id, value: @form.try(:problem) ? @form.try(:problem).id : '' %>
14
+ <%= form.hidden_field :author_id, value: current_user.id %>
15
+
16
+ <%= form.attachment :documents,
17
+ multiple: true,
18
+ label: t("decidim.solutions.solutions.new.add_documents"),
19
+ button_label: t("decidim.solutions.solutions.new.add_documents"),
20
+ button_edit_label: t("decidim.solutions.solutions.new.edit_documents"),
21
+ button_class: "button button__lg button__transparent-secondary w-full",
22
+ help_i18n_scope: "decidim.forms.file_help.file" %>
@@ -0,0 +1,114 @@
1
+ <div class="rounded p-4 bg-background mb-4 divide-y divide-gray-3 [&>*]:py-4 first:[&>*]:pt-0 last:[&>*]:pb-0">
2
+ <div class="text-gray-2 space-y-1.5">
3
+ <div class="text-sm flex flex-col items-center gap-1">
4
+ <p class="uppercase text-xs"><%= t("status", scope: "activemodel.attributes.problem") %></p>
5
+ <% if has_problem? %>
6
+ <% if @solution&.author&.admin? %>
7
+ <p class="uppercase mb-4"><%= t(@solution.challenge.state, scope: "decidim.challenges.states") %></p>
8
+ <% else %>
9
+ <p class="uppercase mb-4"><%= t(@solution.project_status, scope: "decidim.solutions.solutions.form.project_statuses") %></p>
10
+ <% end %>
11
+ <% else %>
12
+ <div class="definition-data__item status">
13
+ <% if @solution&.author&.admin? %>
14
+ <p class="uppercase mb-4"><%= t(@solution.challenge.state, scope: "decidim.challenges.states") %></p>
15
+ <% else %>
16
+ <p class="uppercase mb-4"><%= t(@solution.project_status, scope: "decidim.solutions.solutions.form.project_statuses") %></p>
17
+ <% end %>
18
+ </div>
19
+ <% end %>
20
+ </div>
21
+
22
+ <% if @challenge_scope.present? %>
23
+ <div class="text-sm flex flex-col items-center gap-1">
24
+ <p class="uppercase text-xs"><%= t("scope", scope: "activemodel.attributes.solution") %></p>
25
+ <p class="uppercase mb-4"><%= translated_attribute(@challenge_scope.name) %></p>
26
+ </div>
27
+ <% end %>
28
+
29
+ <% if has_problem? %>
30
+ <% if @solution.problem.proposing_entities.present? %>
31
+ <div class="text-sm flex flex-col items-center gap-1">
32
+ <p class="uppercase text-xs"><%= t("prop_entity", scope: "activemodel.attributes.problem") %></p>
33
+ <p class="uppercase mb-4"><%= present(@solution.problem).proposing_entities %></p>
34
+ </div>
35
+ <% end %>
36
+
37
+ <% if @solution.problem.collaborating_entities.present? %>
38
+ <div class="text-sm flex flex-col items-center gap-1">
39
+ <p class="uppercase text-xs"><%= t("collaborating_entities", scope: "activemodel.attributes.problem") %></p>
40
+ <p class="uppercase mb-4"><%= present(@solution.problem).collaborating_entities %></p>
41
+ </div>
42
+ <% end %>
43
+
44
+ <% if @solution.problem.causes.present? %>
45
+ <div class="text-sm flex flex-col items-center gap-1">
46
+ <p class="uppercase text-xs"><%= t("causes", scope: "activemodel.attributes.problem") %></p>
47
+ <p class="uppercase mb-4"><%= present(@solution.problem).causes %></p>
48
+ </div>
49
+ <% end %>
50
+
51
+ <% if @solution.problem.groups_affected.present? %>
52
+ <div class="text-sm flex flex-col items-center gap-1">
53
+ <p class="uppercase text-xs"><%= t("groups_affected", scope: "activemodel.attributes.problem") %></p>
54
+ <p class="uppercase mb-4"><%= present(@solution.problem).groups_affected %></p>
55
+ </div>
56
+ <% end %>
57
+ <% end %>
58
+
59
+ <% if present(@solution).financing_type.present? %>
60
+ <div class="text-sm flex flex-col items-center gap-1">
61
+ <p class="uppercase text-xs"><%= t("financing_type", scope: "activemodel.attributes.solution") %></p>
62
+ <p class="uppercase mb-4"><%= present(@solution).financing_type %></p>
63
+ </div>
64
+ <% end %>
65
+
66
+ <% if @sectorial_scope.present? %>
67
+ <div class="text-sm flex flex-col items-center gap-1">
68
+ <p class="uppercase text-xs"><%= t("decidim_sectorial_scope_id", scope: "activemodel.attributes.problem") %></p>
69
+ <p class="uppercase mb-4"><%= translated_attribute(@sectorial_scope.name) %></p>
70
+ </div>
71
+ <% end %>
72
+
73
+ <% if @technological_scope.present? %>
74
+ <div class="text-sm flex flex-col items-center gap-1">
75
+ <p class="uppercase text-xs"><%= t("decidim_technological_scope_id", scope: "activemodel.attributes.problem") %></p>
76
+ <p class="uppercase mb-4"><%= translated_attribute(@technological_scope.name) %></p>
77
+ </div>
78
+ <% end %>
79
+ </div>
80
+
81
+ <% if has_problem? %>
82
+ <% if @solution.problem.challenge.sdg_code %>
83
+ <div class="text-sm flex flex-col items-center gap-1">
84
+ <p class="uppercase text-xs text-center"><%= t("sdg", scope: "activemodel.attributes.challenge") %></p>
85
+ <div class="ods challenges flex items-center">
86
+ <div class="text-container show">
87
+ <p><%= t(@solution.problem.challenge.sdg_code + ".logo.line1", scope: "decidim.components.sdgs") %></p>
88
+ <p><%= t(@solution.problem.challenge.sdg_code + ".logo.line2", scope: "decidim.components.sdgs") %></p>
89
+ </div>
90
+ <%= image_pack_tag "media/images/ods-#{@sdg_index}.svg", alt: "Logo ODS #{@sdg_index}", class: "problem--view" %>
91
+ </div>
92
+ </div>
93
+ <% end %>
94
+ <% else %>
95
+ <% if @solution.challenge&.sdg_code %>
96
+ <div class="text-sm flex flex-col items-center gap-1">
97
+ <p class="uppercase text-xs text-center"><%= t("sdg", scope: "activemodel.attributes.challenge") %></p>
98
+ <div class="ods challenges flex items-center">
99
+ <div class="text-container show">
100
+ <p><%= t(@solution.challenge.sdg_code + ".logo.line1", scope: "decidim.components.sdgs") %></p>
101
+ <p><%= t(@solution.challenge.sdg_code + ".logo.line2", scope: "decidim.components.sdgs") %></p>
102
+ </div>
103
+ <%= image_pack_tag "media/images/ods-#{@sdg_index}.svg", alt: "Logo ODS #{@sdg_index}", class: "problem--view" %>
104
+ </div>
105
+ </div>
106
+ <% end %>
107
+ <% end %>
108
+ </div>
109
+
110
+ <section class="layout-aside__section actions__secondary">
111
+ <%= resource_reference(current_participatory_space) %>
112
+ <%= render partial: "decidim/shared/follow_button", class: "text-center", locals: { followable: current_participatory_space, large: false } %>
113
+ <%= cell "decidim/share_button", nil %>
114
+ </section>
@@ -0,0 +1 @@
1
+ <%= card_for solution, highlight: true, size: :g, has_sdgs: has_sdgs? %>
@@ -0,0 +1,13 @@
1
+ <% if @solutions.empty? %>
2
+ <%= params[:filter].present? ? t(".empty_filters") : t(".empty") %>
3
+ <% else %>
4
+ <h2 class="h5 md:h3 decorator"><%= t("count", scope: "decidim.solutions.solutions.index", count: @solutions.total_count) %></h2>
5
+
6
+ <%= order_selector available_orders, i18n_scope: "decidim.solutions.solutions.orders" %>
7
+
8
+ <div class="card__list-list">
9
+ <%= render @solutions, locals: { has_sdgs: has_sdgs? } %>
10
+ </div>
11
+
12
+ <%= decidim_paginate @solutions %>
13
+ <% end %>
@@ -0,0 +1,37 @@
1
+ <% add_decidim_page_title(t("name", scope: "decidim.components.solutions")) %>
2
+
3
+ <%= append_stylesheet_pack_tag "decidim_sdgs" %>
4
+ <%= append_stylesheet_pack_tag "decidim_solutions" %>
5
+
6
+ <% content_for :aside do %>
7
+ <h1 id="solutions-count" class="title-decorator"><%= component_name %></h1>
8
+
9
+ <% if @component_settings.creation_enabled? %>
10
+ <div class="proposal-list__aside__button-container">
11
+ <%= action_authorized_link_to :create, new_solution_path, class: "button button__xl button__secondary w-full", data: { "redirect_url" => new_solution_path } do %>
12
+ <span><%= t("actions.new_solution", scope: "decidim.solutions.admin") %></span>
13
+ <%= icon "add-line" %>
14
+ <% end %>
15
+ </div>
16
+ <% end %>
17
+
18
+ <% if !@component_settings.hide_filters %>
19
+ <%= render layout: "decidim/shared/filters", locals: { filter_sections:, search_variable: :search_text_cont, skip_to_id: "solutions" } do %>
20
+ <%= hidden_field_tag :order, order, id: nil, class: "order_filter" %>
21
+ <% end %>
22
+
23
+ <% if has_sdgs? %>
24
+ <%= filter_form_for filter do |form| %>
25
+ <%= sdgs_filter_selector(form) %>
26
+ <% end %>
27
+ <% end %>
28
+ <% end %>
29
+ <% end %>
30
+
31
+ <%= render layout: "layouts/decidim/shared/layout_two_col" do %>
32
+ <section id="solutions" class="layout-main__section layout-main__heading">
33
+ <%= render partial: "solutions", locals: { has_sdgs: has_sdgs? } %>
34
+ </section>
35
+ <% end %>
36
+
37
+ <%= render partial: "decidim/sdgs/sdgs_filter/modal" %>
@@ -0,0 +1,5 @@
1
+ var $solutions = $('#solutions');
2
+ var $orderFilterInput = $('.order_filter');
3
+
4
+ $solutions.html('<%= j(render partial: "solutions").strip.html_safe %>');
5
+ $orderFilterInput.val('<%= order %>');
@@ -0,0 +1,20 @@
1
+ <% add_decidim_page_title(t(".create")) %>
2
+
3
+ <%= render layout: "layouts/decidim/shared/layout_center" do %>
4
+ <div class="flex justify-center">
5
+ <h1 class="title-decorator my-12">
6
+ <%= t("decidim.solutions.solutions.new.create") %>
7
+ </h1>
8
+ </div>
9
+
10
+ <%= decidim_form_for(@form, html: { class: "form" }) do |form| %>
11
+ <div class="form__wrapper">
12
+ <%= render partial: "form", object: form %>
13
+ </div>
14
+
15
+ <button type="submit" class="button button__sm md:button__lg button__secondary">
16
+ <span><%= t("send", scope: "decidim.solutions.solutions.new") %></span>
17
+ <%= icon "arrow-right-line" %>
18
+ </button>
19
+ <% end %>
20
+ <% end %>
@@ -0,0 +1,72 @@
1
+ <%= append_stylesheet_pack_tag "decidim_sdgs" %>
2
+ <%= append_stylesheet_pack_tag "decidim_solutions" %>
3
+
4
+ <%= render layout: "layouts/decidim/shared/layout_item", locals: { back_path: solutions_path } do %>
5
+ <section class="layout-main__section layout-main__heading">
6
+ <h1 class="h2 decorator">
7
+ <%= present(@solution).title(links: true, html_escape: true) %>
8
+ </h1>
9
+ </section>
10
+
11
+ <section class="layout-main__section content-block__description">
12
+ <%= render partial: "decidim/shared/share_modal" %>
13
+
14
+ <% if has_problem? %>
15
+ <h3 class="h4">
16
+ <span class="title"><%= t("problem", scope: "activemodel.attributes.solution") %></span>:
17
+ <%= link_to translated_attribute(@solution.problem.title), Decidim::ResourceLocatorPresenter.new(@solution.problem).path %><br />
18
+ <span class="title"><%= t("challenge", scope: "activemodel.attributes.problem") %></span>:
19
+ <%= link_to translated_attribute(@solution.problem.challenge.title), Decidim::ResourceLocatorPresenter.new(@solution.problem.challenge).path %></strong>
20
+ </h3>
21
+ <% else %>
22
+ <h3 class="h4">
23
+ <%= t("challenge", scope: "activemodel.attributes.solution") %></span>:
24
+ <%= link_to translated_attribute(@solution.challenge.title), Decidim::ResourceLocatorPresenter.new(@solution.challenge).path %></strong>
25
+ </h3>
26
+ <% end %>
27
+
28
+ <h3 class="h4"><%= t("description", scope: "activemodel.attributes.solution") %></h3>
29
+ <div class="rich-text-display">
30
+ <p><%= present(@solution).description %></p>
31
+ </div>
32
+
33
+ <% if present(@solution).objectives.present? %>
34
+ <h3 class="h4"><%= t("objectives", scope: "activemodel.attributes.solution") %></h3>
35
+ <%= present(@solution).objectives %>
36
+ <% end %>
37
+
38
+ <% if present(@solution).beneficiaries.present? %>
39
+ <h3 class="h4"><%= t("beneficiaries", scope: "activemodel.attributes.solution") %></h3>
40
+ <%= present(@solution).beneficiaries %>
41
+ <% end %>
42
+
43
+ <% if present(@solution).requirements.present? %>
44
+ <h3 class="h4"><%= t("requirements", scope: "activemodel.attributes.solution") %></h3>
45
+ <%= present(@solution).requirements %>
46
+ <% end %>
47
+
48
+ <% if present(@solution).indicators.present? %>
49
+ <h3 class="h4"><%= t("indicators", scope: "activemodel.attributes.solution") %></h3>
50
+ <%= present(@solution).indicators %>
51
+ <% end %>
52
+
53
+ <% if present(@solution).tags.present? %>
54
+ <h3 class="h4"><%= t("tags", scope: "activemodel.attributes.solution") %></h3>
55
+ <p class="tags"><%= present(@solution).tags %></p>
56
+ <% end %>
57
+
58
+ <% if present(@solution).project_url.present? %>
59
+ <h3 class="h4"><%= t("project_url", scope: "activemodel.attributes.solution") %></h3>
60
+ <%= link_to @solution.project_url, "http://#{@solution.project_url}", target: "_blank" %>
61
+ <% end %>
62
+
63
+ <% if present(@solution).coordinating_entity.present? %>
64
+ <h3 class="h4"><%= t("coordinating_entity", scope: "activemodel.attributes.solution") %></h3>
65
+ <%= present(@solution).coordinating_entity %>
66
+ <% end %>
67
+ </section>
68
+
69
+ <% content_for :aside do %>
70
+ <%= render partial: "sidebar_data" %>
71
+ <% end %>
72
+ <% end %>