decidim 0.0.8.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim might be problematic. Click here for more details.

Files changed (292) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +21 -21
  3. data/.codeclimate.yml +10 -6
  4. data/.eslintignore +1 -0
  5. data/.gitignore +1 -1
  6. data/.rubocop.yml +38 -20
  7. data/.travis.yml +0 -1
  8. data/Gemfile +6 -9
  9. data/Gemfile.lock +165 -205
  10. data/Rakefile +1 -1
  11. data/codecov.yml +5 -71
  12. data/crowdin.yaml +1 -1
  13. data/decidim-admin/app/assets/stylesheets/decidim/admin/_decidim.scss +9 -2
  14. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_action-icon.scss +7 -0
  15. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_cards.scss +6 -0
  16. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_editor.scss +1 -0
  17. data/decidim-admin/app/assets/stylesheets/decidim/admin/{_sidebar.scss → extra/_sidebar.scss} +0 -0
  18. data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_action-icon.scss +23 -0
  19. data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_cards.scss +0 -7
  20. data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_icons.scss +4 -2
  21. data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_modules.scss +0 -1
  22. data/decidim-admin/app/assets/stylesheets/decidim/admin/{modules/_datepicker.scss → plugins/_foundation-datepicker.scss} +1 -1
  23. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/_constants.scss +5 -0
  24. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/_math.scss +45 -0
  25. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_acos.scss +12 -0
  26. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_asin.scss +12 -0
  27. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss +28 -0
  28. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss +37 -0
  29. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_cos.scss +13 -0
  30. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_cot.scss +9 -0
  31. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_csc.scss +9 -0
  32. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_exp.scss +12 -0
  33. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_fact.scss +18 -0
  34. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_frexp.scss +21 -0
  35. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_ldexp.scss +17 -0
  36. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_log.scss +34 -0
  37. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss +28 -0
  38. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_sec.scss +9 -0
  39. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_sin.scss +9 -0
  40. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_sqrt.scss +16 -0
  41. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/functions/_tan.scss +9 -0
  42. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/helpers/_deg-to-rad.scss +4 -0
  43. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/helpers/_rad-to-deg.scss +4 -0
  44. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/helpers/_strip-unit.scss +8 -0
  45. data/decidim-admin/app/assets/stylesheets/decidim/admin/vendor/mathsass/helpers/_unitless-rad.scss +13 -0
  46. data/decidim-admin/app/commands/decidim/admin/create_participatory_process.rb +23 -17
  47. data/decidim-admin/app/commands/decidim/admin/create_participatory_process_group.rb +1 -1
  48. data/decidim-admin/app/controllers/decidim/admin/moderations_controller.rb +4 -4
  49. data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +1 -1
  50. data/decidim-admin/app/forms/decidim/admin/organization_form.rb +6 -2
  51. data/decidim-admin/app/forms/decidim/admin/participatory_process_form.rb +5 -0
  52. data/decidim-admin/app/helpers/decidim/admin/application_helper.rb +1 -1
  53. data/decidim-admin/app/helpers/decidim/admin/attributes_display_helper.rb +1 -1
  54. data/decidim-admin/app/views/decidim/admin/features/_feature.html.erb +5 -1
  55. data/decidim-admin/app/views/decidim/admin/moderations/_report.html.erb +11 -0
  56. data/decidim-admin/app/views/decidim/admin/moderations/index.html.erb +22 -24
  57. data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +3 -0
  58. data/decidim-admin/config/i18n-tasks.yml +1 -0
  59. data/decidim-admin/config/locales/ca.yml +7 -3
  60. data/decidim-admin/config/locales/en.yml +6 -2
  61. data/decidim-admin/config/locales/es.yml +7 -3
  62. data/decidim-admin/config/locales/eu.yml +4 -3
  63. data/decidim-admin/config/locales/fi.yml +4 -3
  64. data/decidim-admin/config/locales/fr.yml +389 -2
  65. data/decidim-admin/config/locales/nl.yml +4 -1
  66. data/decidim-admin/decidim-admin.gemspec +3 -3
  67. data/decidim-admin/lib/decidim/admin/test/manage_attachments_examples.rb +2 -2
  68. data/decidim-admin/spec/commands/activate_participatory_process_step_spec.rb +1 -0
  69. data/decidim-admin/spec/commands/create_category_spec.rb +1 -1
  70. data/decidim-admin/spec/commands/create_feature_spec.rb +7 -5
  71. data/decidim-admin/spec/commands/create_participatory_process_admin_spec.rb +2 -1
  72. data/decidim-admin/spec/commands/create_participatory_process_spec.rb +14 -6
  73. data/decidim-admin/spec/commands/create_scope_spec.rb +3 -2
  74. data/decidim-admin/spec/commands/deactivate_participatory_process_step_spec.rb +1 -0
  75. data/decidim-admin/spec/commands/destroy_feature_spec.rb +1 -0
  76. data/decidim-admin/spec/commands/destroy_participatory_process_step_spec.rb +1 -0
  77. data/decidim-admin/spec/commands/publish_participatory_process_spec.rb +1 -0
  78. data/decidim-admin/spec/commands/reorder_participatory_process_steps_spec.rb +1 -0
  79. data/decidim-admin/spec/commands/unpublish_participatory_process_spec.rb +1 -0
  80. data/decidim-admin/spec/commands/update_feature_spec.rb +7 -5
  81. data/decidim-admin/spec/commands/update_participatory_process_spec.rb +5 -5
  82. data/decidim-admin/spec/commands/update_scope_spec.rb +3 -2
  83. data/decidim-admin/spec/factories.rb +1 -0
  84. data/decidim-admin/spec/features/admin_invite_spec.rb +5 -5
  85. data/decidim-admin/spec/features/admin_manages_newsletters_spec.rb +5 -5
  86. data/decidim-admin/spec/features/admin_manages_organization_admins_spec.rb +2 -2
  87. data/decidim-admin/spec/features/admin_manages_organization_scopes_spec.rb +3 -3
  88. data/decidim-admin/spec/features/admin_manages_organization_spec.rb +7 -11
  89. data/decidim-admin/spec/features/admin_manages_participatory_process_groups_spec.rb +2 -2
  90. data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +3 -3
  91. data/decidim-admin/spec/features/static_pages_spec.rb +8 -7
  92. data/decidim-admin/spec/forms/newsletter_form_spec.rb +2 -2
  93. data/decidim-admin/spec/forms/organization_form_spec.rb +3 -3
  94. data/decidim-admin/spec/forms/participatory_process_form_spec.rb +4 -4
  95. data/decidim-admin/spec/forms/participatory_process_step_form_spec.rb +1 -1
  96. data/decidim-admin/spec/forms/participatory_process_user_role_form_spec.rb +1 -1
  97. data/decidim-admin/spec/forms/scope_form_spec.rb +1 -1
  98. data/decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb +1 -0
  99. data/decidim-admin/spec/helpers/feature_settings_helper_spec.rb +1 -0
  100. data/decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb +2 -2
  101. data/decidim-admin/spec/queries/process_admins_spec.rb +1 -1
  102. data/decidim-admin/spec/shared/manage_process_admins_examples.rb +2 -2
  103. data/decidim-admin/spec/shared/manage_process_categories_examples.rb +3 -3
  104. data/decidim-admin/spec/shared/manage_process_steps_examples.rb +5 -5
  105. data/decidim-admin/spec/shared/manage_processes_examples.rb +4 -4
  106. data/decidim-admin/spec/shared/participatory_admin_shared_context.rb +1 -0
  107. data/decidim-admin/spec/spec_helper.rb +1 -0
  108. data/decidim-admin/spec/views/decidim/static_pages/_form.html.erb_spec.rb +1 -0
  109. data/decidim-api/app/controllers/decidim/api/application_controller.rb +1 -1
  110. data/decidim-api/decidim-api.gemspec +1 -1
  111. data/decidim-api/spec/factories.rb +1 -0
  112. data/decidim-api/spec/spec_helper.rb +1 -0
  113. data/decidim-budgets/app/queries/decidim/budgets/filtered_projects.rb +36 -0
  114. data/decidim-budgets/config/locales/ca.yml +1 -0
  115. data/decidim-budgets/config/locales/en.yml +1 -0
  116. data/decidim-budgets/config/locales/es.yml +1 -0
  117. data/decidim-budgets/config/locales/fr.yml +35 -3
  118. data/decidim-budgets/decidim-budgets.gemspec +2 -2
  119. data/decidim-budgets/lib/decidim/budgets/feature.rb +9 -0
  120. data/decidim-budgets/spec/commands/add_line_item_spec.rb +6 -9
  121. data/decidim-budgets/spec/commands/cancel_order_spec.rb +3 -1
  122. data/decidim-budgets/spec/commands/checkout_spec.rb +3 -1
  123. data/decidim-budgets/spec/commands/create_project_spec.rb +4 -3
  124. data/decidim-budgets/spec/commands/remove_line_item_spec.rb +2 -1
  125. data/decidim-budgets/spec/commands/update_project_spec.rb +4 -3
  126. data/decidim-budgets/spec/factories.rb +1 -0
  127. data/decidim-budgets/spec/features/orders_spec.rb +24 -24
  128. data/decidim-budgets/spec/forms/project_form_spec.rb +1 -0
  129. data/decidim-budgets/spec/models/project_spec.rb +1 -1
  130. data/decidim-budgets/spec/queries/decidim/budgets/filtered_projects_spec.rb +21 -0
  131. data/decidim-budgets/spec/services/project_search_spec.rb +4 -3
  132. data/decidim-budgets/spec/shared/admin_shared_context.rb +1 -0
  133. data/decidim-budgets/spec/shared/manage_attachments_examples.rb +1 -0
  134. data/decidim-budgets/spec/spec_helper.rb +1 -0
  135. data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
  136. data/decidim-comments/app/commands/decidim/comments/create_comment.rb +8 -2
  137. data/decidim-comments/app/frontend/application/application.component.tsx +3 -3
  138. data/decidim-comments/app/frontend/application/icon.component.tsx +1 -1
  139. data/decidim-comments/app/frontend/comments/add_comment_form.component.tsx +7 -7
  140. data/decidim-comments/app/frontend/comments/comment.component.test.tsx +7 -7
  141. data/decidim-comments/app/frontend/comments/comment.component.tsx +6 -6
  142. data/decidim-comments/app/frontend/comments/comment_thread.component.tsx +2 -2
  143. data/decidim-comments/app/frontend/comments/comments.component.test.tsx +5 -5
  144. data/decidim-comments/app/frontend/comments/comments.component.tsx +6 -6
  145. data/decidim-comments/app/frontend/comments/down_vote_button.component.test.tsx +4 -4
  146. data/decidim-comments/app/frontend/comments/down_vote_button.component.tsx +3 -3
  147. data/decidim-comments/app/frontend/comments/up_vote_button.component.test.tsx +4 -4
  148. data/decidim-comments/app/frontend/comments/up_vote_button.component.tsx +3 -3
  149. data/decidim-comments/app/frontend/comments/vote_button.component.tsx +1 -1
  150. data/decidim-comments/app/frontend/comments/vote_button_component.test.tsx +2 -2
  151. data/decidim-comments/app/frontend/entry.ts +2 -2
  152. data/decidim-comments/app/frontend/support/generate_comments_data.ts +2 -2
  153. data/decidim-comments/app/frontend/support/load_translations.ts +2 -2
  154. data/decidim-comments/app/frontend/support/resolve_graphql_query.ts +1 -1
  155. data/decidim-comments/app/mailers/decidim/comments/comment_notification_mailer.rb +1 -1
  156. data/decidim-comments/app/models/decidim/comments/comment.rb +3 -8
  157. data/decidim-comments/app/models/decidim/comments/seed.rb +1 -0
  158. data/decidim-comments/config/locales/fr.yml +62 -1
  159. data/decidim-comments/db/migrate/20170504085413_add_root_commentable_to_comments.rb +7 -0
  160. data/decidim-comments/db/migrate/20170510091348_update_root_commentable_for_comments.rb +22 -0
  161. data/decidim-comments/db/migrate/20170510091409_set_root_commentable_null_constraints.rb +6 -0
  162. data/decidim-comments/db/seeds.rb +4 -2
  163. data/decidim-comments/lib/decidim/comments/engine.rb +8 -0
  164. data/decidim-comments/lib/decidim/comments/test/factories.rb +1 -0
  165. data/decidim-comments/spec/commands/create_comment_spec.rb +13 -6
  166. data/decidim-comments/spec/commands/vote_comment_spec.rb +2 -6
  167. data/decidim-comments/spec/factories.rb +1 -0
  168. data/decidim-comments/spec/features/notifications_spec.rb +4 -4
  169. data/decidim-comments/spec/features/process_admin_manages_comments_spec.rb +1 -1
  170. data/decidim-comments/spec/features/report_comment_spec.rb +4 -2
  171. data/decidim-comments/spec/helpers/comments_helper_spec.rb +3 -3
  172. data/decidim-comments/spec/mailers/comment_notification_mailer_spec.rb +2 -1
  173. data/decidim-comments/spec/models/comment_spec.rb +5 -9
  174. data/decidim-comments/spec/models/comment_vote_spec.rb +3 -3
  175. data/decidim-comments/spec/models/seed_spec.rb +1 -1
  176. data/decidim-comments/spec/queries/sorted_comments_spec.rb +5 -5
  177. data/decidim-comments/spec/shared/admin_shared_context.rb +1 -0
  178. data/decidim-comments/spec/spec_helper.rb +1 -0
  179. data/decidim-comments/spec/types/comment_mutation_type_spec.rb +4 -12
  180. data/decidim-comments/spec/types/comment_type_spec.rb +4 -5
  181. data/decidim-comments/spec/types/commentable_mutation_type_spec.rb +2 -2
  182. data/decidim-comments/spec/types/mutation_type_spec.rb +4 -6
  183. data/decidim-comments/spec/types/query_type_spec.rb +1 -1
  184. data/decidim-dev/decidim-dev.gemspec +6 -6
  185. data/decidim-dev/lib/decidim/dev/common_rake.rb +5 -1
  186. data/decidim-dev/lib/decidim/dev/railtie.rb +1 -0
  187. data/decidim-dev/lib/decidim/dev/test/base_spec_helper.rb +0 -2
  188. data/decidim-dev/lib/decidim/dev/test/rspec_support/geocoder.rb +4 -3
  189. data/decidim-dev/lib/decidim/dev/test/rspec_support/i18n.rb +2 -2
  190. data/decidim-dev/lib/decidim/dev/test/rspec_support/webmock.rb +1 -0
  191. data/decidim-dev/lib/generators/decidim/dummy_generator.rb +1 -1
  192. data/decidim-dev/lib/generators/decidim/templates/autoprefixer_initializer.rb +4 -3
  193. data/decidim-dev/lib/tasks/test_app.rake +1 -0
  194. data/decidim-meetings/app/controllers/decidim/meetings/meeting_widgets_controller.rb +1 -0
  195. data/decidim-meetings/app/controllers/decidim/meetings/meetings_controller.rb +8 -8
  196. data/decidim-meetings/app/helpers/decidim/meetings/map_helper.rb +9 -9
  197. data/decidim-meetings/app/models/decidim/meetings/meeting.rb +1 -1
  198. data/decidim-meetings/app/views/decidim/meetings/meeting_widgets/show.html.erb +8 -17
  199. data/decidim-meetings/config/locales/fr.yml +95 -1
  200. data/decidim-meetings/lib/decidim/meetings/feature.rb +7 -0
  201. data/decidim-meetings/spec/commands/close_meeting_spec.rb +2 -1
  202. data/decidim-meetings/spec/commands/create_meeting_spec.rb +6 -5
  203. data/decidim-meetings/spec/commands/update_meeting_spec.rb +6 -5
  204. data/decidim-meetings/spec/factories.rb +1 -0
  205. data/decidim-meetings/spec/features/explore_meetings_spec.rb +2 -1
  206. data/decidim-meetings/spec/forms/close_meeting_form_spec.rb +1 -0
  207. data/decidim-meetings/spec/forms/meeting_form_spec.rb +5 -3
  208. data/decidim-meetings/spec/services/meeting_search_spec.rb +3 -2
  209. data/decidim-meetings/spec/shared/admin_shared_context.rb +1 -0
  210. data/decidim-meetings/spec/shared/manage_attachments_examples.rb +1 -1
  211. data/decidim-meetings/spec/shared/manage_meetings_examples.rb +21 -20
  212. data/decidim-meetings/spec/spec_helper.rb +1 -0
  213. data/decidim-pages/config/locales/fr.yml +18 -1
  214. data/decidim-pages/decidim-pages.gemspec +1 -1
  215. data/decidim-pages/lib/decidim/pages/feature.rb +7 -0
  216. data/decidim-pages/spec/commands/create_page_spec.rb +1 -3
  217. data/decidim-pages/spec/factories.rb +1 -0
  218. data/decidim-pages/spec/spec_helper.rb +1 -0
  219. data/decidim-proposals/app/commands/decidim/proposals/create_proposal_export.rb +36 -0
  220. data/decidim-proposals/app/controllers/decidim/proposals/admin/exports_controller.rb +24 -0
  221. data/decidim-proposals/app/controllers/decidim/proposals/proposal_votes_controller.rb +3 -1
  222. data/decidim-proposals/app/controllers/decidim/proposals/proposal_widgets_controller.rb +0 -5
  223. data/decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb +0 -1
  224. data/decidim-proposals/app/jobs/decidim/proposals/export_job.rb +21 -0
  225. data/decidim-proposals/app/models/decidim/proposals/proposal.rb +1 -1
  226. data/decidim-proposals/app/queries/decidim/proposals/filtered_proposals.rb +36 -0
  227. data/decidim-proposals/app/services/decidim/proposals/proposal_serializer.rb +72 -0
  228. data/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb +15 -3
  229. data/decidim-proposals/app/views/decidim/proposals/proposal_widgets/show.html.erb +4 -25
  230. data/decidim-proposals/config/locales/ca.yml +4 -0
  231. data/decidim-proposals/config/locales/en.yml +6 -1
  232. data/decidim-proposals/config/locales/es.yml +4 -0
  233. data/decidim-proposals/config/locales/fr.yml +146 -1
  234. data/decidim-proposals/decidim-proposals.gemspec +2 -2
  235. data/decidim-proposals/lib/decidim/proposals/admin_engine.rb +5 -0
  236. data/decidim-proposals/lib/decidim/proposals/feature.rb +14 -0
  237. data/decidim-proposals/spec/factories.rb +1 -0
  238. data/decidim-proposals/spec/features/admin_manages_proposals_spec.rb +1 -0
  239. data/decidim-proposals/spec/features/process_admin_manages_proposals_spec.rb +1 -0
  240. data/decidim-proposals/spec/features/proposals_spec.rb +29 -28
  241. data/decidim-proposals/spec/features/report_proposal_spec.rb +2 -2
  242. data/decidim-proposals/spec/features/vote_proposal_spec.rb +36 -32
  243. data/decidim-proposals/spec/helpers/proposal_order_helper_spec.rb +3 -3
  244. data/decidim-proposals/spec/jobs/export_job_spec.rb +57 -0
  245. data/decidim-proposals/spec/lib/decidim/proposals/feature_spec.rb +1 -0
  246. data/decidim-proposals/spec/models/decidim/proposals/proposal_vote_spec.rb +3 -3
  247. data/decidim-proposals/spec/queries/decidim/proposals/filtered_proposals_spec.rb +21 -0
  248. data/decidim-proposals/spec/services/decidim/proposals/proposal_search_spec.rb +12 -12
  249. data/decidim-proposals/spec/services/decidim/proposals/proposal_serializer_spec.rb +71 -0
  250. data/decidim-proposals/spec/shared/admin_shared_context.rb +1 -0
  251. data/decidim-proposals/spec/shared/create_proposal_examples.rb +4 -3
  252. data/decidim-proposals/spec/shared/export_proposals_examples.rb +37 -0
  253. data/decidim-proposals/spec/shared/manage_proposals_examples.rb +12 -11
  254. data/decidim-proposals/spec/shared/proposal_form_examples.rb +9 -8
  255. data/decidim-proposals/spec/spec_helper.rb +1 -0
  256. data/decidim-results/app/controllers/decidim/results/result_widgets_controller.rb +1 -0
  257. data/decidim-results/app/controllers/decidim/results/results_controller.rb +1 -1
  258. data/decidim-results/app/queries/decidim/results/filtered_results.rb +36 -0
  259. data/decidim-results/app/services/decidim/results/result_stats_calculator.rb +1 -1
  260. data/decidim-results/app/views/decidim/results/result_widgets/show.html.erb +2 -10
  261. data/decidim-results/config/locales/fr.yml +75 -1
  262. data/decidim-results/decidim-results.gemspec +2 -2
  263. data/decidim-results/lib/decidim/results/feature.rb +9 -0
  264. data/decidim-results/spec/commands/create_result_spec.rb +4 -3
  265. data/decidim-results/spec/commands/update_result_spec.rb +5 -4
  266. data/decidim-results/spec/controllers/results_controller_spec.rb +31 -0
  267. data/decidim-results/spec/factories.rb +1 -0
  268. data/decidim-results/spec/features/explore_results_spec.rb +75 -74
  269. data/decidim-results/spec/forms/result_form_spec.rb +2 -1
  270. data/decidim-results/spec/queries/decidim/results/filtered_results_spec.rb +21 -0
  271. data/decidim-results/spec/services/result_search_spec.rb +4 -3
  272. data/decidim-results/spec/services/result_stats_calculator_spec.rb +1 -0
  273. data/decidim-results/spec/shared/admin_shared_context.rb +1 -0
  274. data/decidim-results/spec/spec_helper.rb +1 -0
  275. data/decidim-system/config/locales/fr.yml +64 -1
  276. data/decidim-system/decidim-system.gemspec +3 -3
  277. data/decidim-system/spec/factories.rb +1 -0
  278. data/decidim-system/spec/spec_helper.rb +1 -0
  279. data/docs/how_to_create_a_plugin.md +117 -139
  280. data/lib/generators/decidim/install_generator.rb +1 -1
  281. data/package.json +30 -31
  282. data/tslint.json +1 -2
  283. data/webpack.config.js +2 -3
  284. data/yarn.lock +976 -1326
  285. metadata +68 -31
  286. data/decidim-admin/yarn.lock +0 -4
  287. data/decidim-api/.gitignore +0 -7
  288. data/decidim-budgets/.gitignore +0 -7
  289. data/decidim-meetings/.gitignore +0 -7
  290. data/decidim-pages/.gitignore +0 -3
  291. data/decidim-proposals/.gitignore +0 -3
  292. data/decidim-results/.gitignore +0 -7
@@ -1,2 +1,3 @@
1
+ # frozen_string_literal: true
1
2
  ENV["ENGINE_NAME"] = File.dirname(File.dirname(__FILE__)).split("/").last
2
3
  require "decidim/dev/test/base_spec_helper"
@@ -2,4 +2,21 @@ fr:
2
2
  decidim:
3
3
  features:
4
4
  pages:
5
- name: Page
5
+ name: Page
6
+ settings:
7
+ global:
8
+ comments_enabled: Commentaires activés
9
+ step:
10
+ comments_blocked: Commentaires bloqués
11
+ pages:
12
+ admin:
13
+ models:
14
+ components:
15
+ body: Corps de texte
16
+ pages:
17
+ edit:
18
+ save: Mettre à jour
19
+ title: Modifier la page
20
+ update:
21
+ invalid: Il y a eu des erreurs lors de la sauvegarde de la page.
22
+ success: Page enregistrée avec succès.
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.add_dependency "decidim-core", Decidim.version
17
17
  s.add_dependency "decidim-comments", Decidim.version
18
- s.add_dependency "rectify", "~> 0.8.0"
18
+ s.add_dependency "rectify", "~> 0.9.1"
19
19
 
20
20
  s.add_development_dependency "decidim-dev", Decidim.version
21
21
  end
@@ -19,6 +19,13 @@ Decidim.register_feature(:pages) do |feature|
19
19
  end
20
20
  end
21
21
 
22
+ feature.register_stat :comments_count, tag: :comments do |features, start_at, end_at|
23
+ pages = Decidim::Pages::Page.where(feature: features)
24
+ pages = pages.where("created_at >= ?", start_at) if start_at.present?
25
+ pages = pages.where("created_at <= ?", end_at) if end_at.present?
26
+ Decidim::Comments::Comment.where(root_commentable: pages).count
27
+ end
28
+
22
29
  feature.settings(:global) do |settings|
23
30
  settings.attribute :comments_enabled, type: :boolean, default: true
24
31
  end
@@ -30,9 +30,7 @@ module Decidim
30
30
  end
31
31
 
32
32
  it "creates a new page with the same name as the feature" do
33
- expect(Page).to receive(:new).with({
34
- feature: feature
35
- }).and_call_original
33
+ expect(Page).to receive(:new).with(feature: feature).and_call_original
36
34
 
37
35
  expect do
38
36
  command.call
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "decidim/core/test/factories"
2
3
  require "decidim/comments/test/factories"
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  ENV["ENGINE_NAME"] = File.dirname(File.dirname(__FILE__)).split("/").last
2
3
  require "decidim/dev/test/base_spec_helper"
3
4
 
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module Proposals
4
+ # A command with all the business logic when a user creates a new proposal.
5
+ class CreateProposalExport < Rectify::Command
6
+ # Public: Initializes the command.
7
+ #
8
+ # form - A form object with the params.
9
+ # current_user - The current user.
10
+ def initialize(participatory_process)
11
+ @participatory_process = participatory_process
12
+ end
13
+
14
+ # Executes the command. Broadcasts these events:
15
+ #
16
+ # - :ok when everything is valid, together with the proposal.
17
+ # - :invalid if the proposal wasn't valid and we couldn't proceed.
18
+ #
19
+ # Returns nothing.
20
+ def call
21
+ return broadcast(:invalid) if participatory_process.invalid?
22
+
23
+ create_proposal_export
24
+ broadcast(:ok, export)
25
+ end
26
+
27
+ private
28
+
29
+ attr_reader :participatory_process
30
+
31
+ def create_proposal_export
32
+ ProposalsExporterJob.perform_later(participatory_process)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module Proposals
4
+ module Admin
5
+ # This controller allows admins to manage proposals in a participatory process.
6
+ class ExportsController < Admin::ApplicationController
7
+ def create
8
+ # call the new proposal export command
9
+ authorize! :read, Proposal
10
+ authorize! :export, Proposal
11
+
12
+ ExportJob.perform_later(
13
+ current_user,
14
+ current_feature,
15
+ params[:format]
16
+ )
17
+
18
+ flash[:notice] = t("decidim.proposals.exports.notice")
19
+ redirect_to :back
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -21,7 +21,9 @@ module Decidim
21
21
  def destroy
22
22
  authorize! :unvote, proposal
23
23
 
24
- proposal.votes.where(author: current_user).delete_all
24
+ proposal.votes.where(author: current_user).destroy_all
25
+ proposal.reload
26
+
25
27
  @from_proposals_list = params[:from_proposals_list] == "true"
26
28
  render :update_buttons_and_counters
27
29
  end
@@ -3,7 +3,6 @@
3
3
  module Decidim
4
4
  module Proposals
5
5
  class ProposalWidgetsController < Decidim::WidgetsController
6
- helper_method :model, :current_participatory_process
7
6
  helper Proposals::ApplicationHelper
8
7
 
9
8
  private
@@ -12,10 +11,6 @@ module Decidim
12
11
  @model ||= Proposal.where(feature: params[:feature_id]).find(params[:proposal_id])
13
12
  end
14
13
 
15
- def current_participatory_process
16
- @current_participatory_process ||= model.feature.participatory_process
17
- end
18
-
19
14
  def iframe_url
20
15
  @iframe_url ||= proposal_proposal_widget_url(model)
21
16
  end
@@ -31,7 +31,6 @@ module Decidim
31
31
 
32
32
  @proposals = @proposals.page(params[:page]).per(12)
33
33
  @proposals = reorder(@proposals)
34
-
35
34
  end
36
35
 
37
36
  def show
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module Proposals
4
+ class ExportJob < ApplicationJob
5
+ queue_as :default
6
+
7
+ def perform(user, feature, format)
8
+ proposals = Proposal
9
+ .where(feature: feature)
10
+ .includes(:category, feature: { participatory_process: :organization })
11
+
12
+ export_data = Decidim::Exporters.const_get(format.upcase)
13
+ .new(proposals, ProposalSerializer).export
14
+
15
+ name = "proposals-#{I18n.localize(DateTime.now.to_date, format: :default)}-#{Time.now.seconds_since_midnight.to_i}"
16
+
17
+ ExportMailer.export(user, name, export_data).deliver_now
18
+ end
19
+ end
20
+ end
21
+ end
@@ -18,7 +18,7 @@ module Decidim
18
18
 
19
19
  validates :title, :body, presence: true
20
20
 
21
- geocoded_by :address, http_headers: lambda { |proposal| { "Referer" => proposal.feature.organization.host } }
21
+ geocoded_by :address, http_headers: ->(proposal) { { "Referer" => proposal.feature.organization.host } }
22
22
 
23
23
  scope :accepted, -> { where(state: "accepted") }
24
24
  scope :rejected, -> { where(state: "rejected") }
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module Proposals
4
+ # A class used to find proposals filtered by features and a date range
5
+ class FilteredProposals < Rectify::Query
6
+ # Syntactic sugar to initialize the class and return the queried objects.
7
+ #
8
+ # features - An array of Decidim::Feature
9
+ # start_at - A date to filter resources created after it
10
+ # end_at - A date to filter resources created before it.
11
+ def self.for(features, start_at = nil, end_at = nil)
12
+ new(features, start_at, end_at).query
13
+ end
14
+
15
+ # Initializes the class.
16
+ #
17
+ # features - An array of Decidim::Feature
18
+ # start_at - A date to filter resources created after it
19
+ # end_at - A date to filter resources created before it.
20
+ def initialize(features, start_at = nil, end_at = nil)
21
+ @features = features
22
+ @start_at = start_at
23
+ @end_at = end_at
24
+ end
25
+
26
+ # Finds the Proposals scoped to an array of features and filtered
27
+ # by a range of dates.
28
+ def query
29
+ proposals = Decidim::Proposals::Proposal.where(feature: @features)
30
+ proposals = proposals.where("created_at >= ?", @start_at) if @start_at.present?
31
+ proposals = proposals.where("created_at <= ?", @end_at) if @end_at.present?
32
+ proposals
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Proposals
5
+ # This class serializes a Proposal so can be exported to CSV, JSON or other
6
+ # formats.
7
+ class ProposalSerializer
8
+ include Rails.application.routes.url_helpers
9
+ include Decidim::ResourceHelper
10
+
11
+ # Public: Initializes the serializer with a proposal.
12
+ def initialize(proposal)
13
+ @proposal = proposal
14
+ end
15
+
16
+ # Public: Exports a hash with the serialized data for this proposal.
17
+ def serialize
18
+ {
19
+ id: @proposal.id,
20
+ category: {
21
+ id: @proposal.category.try(:id),
22
+ name: @proposal.category.try(:name)
23
+ },
24
+ title: @proposal.title,
25
+ body: @proposal.body,
26
+ votes: @proposal.proposal_votes_count,
27
+ comments: @proposal.comments.count,
28
+ created_at: @proposal.created_at,
29
+ url: url,
30
+ feature: { id: feature.id },
31
+ meeting_urls: meetings
32
+ }
33
+ end
34
+
35
+ private
36
+
37
+ attr_reader :proposal
38
+
39
+ def feature
40
+ proposal.feature
41
+ end
42
+
43
+ def organization
44
+ feature.organization
45
+ end
46
+
47
+ def meetings
48
+ @proposal.linked_resources(:meetings, "proposals_from_meeting").map do |meeting|
49
+ decidim_resource_url(
50
+ meeting,
51
+ feature_id: feature,
52
+ participatory_process_id: participatory_process,
53
+ host: organization.host
54
+ )
55
+ end
56
+ end
57
+
58
+ def participatory_process
59
+ feature.participatory_process
60
+ end
61
+
62
+ def url
63
+ Decidim::Proposals::Engine.routes.url_helpers.proposal_url(
64
+ proposal,
65
+ feature_id: feature,
66
+ participatory_process_id: participatory_process,
67
+ host: organization.host
68
+ )
69
+ end
70
+ end
71
+ end
72
+ end
@@ -3,9 +3,21 @@
3
3
  <h2 class="card-title">
4
4
  <%= t(".title") %>
5
5
 
6
- <% if feature_settings.official_proposals_enabled %>
7
- <%= link_to t("actions.new", scope: "decidim.proposals", name: t("models.proposal.name", scope: "decidim.proposals.admin")), new_proposal_path, class: 'button tiny button--title' if can? :manage, current_feature %>
8
- <% end %>
6
+ <div class="button--title">
7
+
8
+ <% if feature_settings.official_proposals_enabled %>
9
+ <%= link_to t("actions.new", scope: "decidim.proposals", name: t("models.proposal.name", scope: "decidim.proposals.admin")), new_proposal_path, class: 'button tiny button--simple' if can? :manage, current_feature %>
10
+ <% end %>
11
+
12
+ <button class="exports dropdown tiny button button--simple" data-toggle="export-dropdown"><%= t "actions.export", scope: "decidim.proposals" %></button>
13
+ <div class="dropdown-pane" id="export-dropdown" data-dropdown data-auto-focus="true" data-close-on-click="true">
14
+ <ul class="vertical menu add-features">
15
+ <li class="exports--csv"><%= link_to "CSV", exports_path(feature_id: current_feature, participatory_process_id: current_participatory_process, format: :csv), method: :post %></li>
16
+ <li class="exports--json"><%= link_to "JSON", exports_path(feature_id: current_feature, participatory_process_id: current_participatory_process, format: :json), method: :post %></li>
17
+ </ul>
18
+ </div>
19
+
20
+ </div>
9
21
  </h2>
10
22
  </div>
11
23
 
@@ -1,25 +1,4 @@
1
- <div class="column">
2
- <article class="card card--proposal">
3
- <div class="card__content">
4
- <div class="card__header">
5
- <%= link_to model do%>
6
- <h5 class="card__title"><%= model.title %></h5>
7
- <% end %>
8
- <div class="card__author author-data author-data--small">
9
- <div class="author-data__main">
10
- <div class="author author--inline">
11
- <span class="author__avatar author__avatar--small">
12
- <%= image_tag model.author_avatar_url %>
13
- </span>
14
- <span class="author__name"><%= model.author_name %></span>
15
- <%= l model.created_at, format: "%d/%m/%Y" %>
16
- </div>
17
- </div>
18
- </div>
19
- </div>
20
- <%= render partial: "decidim/proposals/proposals/proposal_badge", locals: { proposal: model } %>
21
- <p><%= truncate(model.body, length: 100) %></p>
22
- <%= render partial: "decidim/proposals/proposals/tags", locals: { proposal: model } %>
23
- </div>
24
- </article>
25
- </div>
1
+ <% content_for(:title, model.title) %>
2
+
3
+ <%= render partial: "decidim/proposals/proposals/proposal_badge", locals: { proposal: model } %>
4
+ <p><%= truncate(model.body, length: 100) %></p>
@@ -29,9 +29,11 @@ ca:
29
29
  proposal_answering_enabled: Resposta oficial a propostes activades
30
30
  votes_blocked: Suports bloquejats
31
31
  votes_enabled: Suports habilitats
32
+ votes_hidden: Vots ocults (si els vots estan habilitats, marcant aquesta opció amagarà el nombre de vots)
32
33
  proposals:
33
34
  actions:
34
35
  answer: Respondre
36
+ export: Exporta
35
37
  new: Nova
36
38
  title: Accions
37
39
  admin:
@@ -67,6 +69,8 @@ ca:
67
69
  create:
68
70
  error: Hi ha hagut errors en desar la proposta.
69
71
  success: Proposta creada correctament.
72
+ exports:
73
+ notice: La seva exportació està actualment en curs. Rebràs un correu electrònic quan estigui complet.
70
74
  models:
71
75
  proposal:
72
76
  fields:
@@ -30,10 +30,12 @@ en:
30
30
  proposal_answering_enabled: Proposal answering enabled
31
31
  votes_blocked: Votes blocked
32
32
  votes_enabled: Votes enabled
33
- votes_hidden: Votes hidden (if votes are enabled, checking this will hide the number of votes)
33
+ votes_hidden: Votes hidden (if votes are enabled, checking this will hide
34
+ the number of votes)
34
35
  proposals:
35
36
  actions:
36
37
  answer: Answer
38
+ export: Export
37
39
  new: New
38
40
  title: Actions
39
41
  admin:
@@ -69,6 +71,9 @@ en:
69
71
  create:
70
72
  error: There's been errors when saving the proposal.
71
73
  success: Proposal created successfully.
74
+ exports:
75
+ notice: Your export is currently in progress. You'll receive an email when
76
+ it's complete.
72
77
  models:
73
78
  proposal:
74
79
  fields:
@@ -29,9 +29,11 @@ es:
29
29
  proposal_answering_enabled: Respuesta a propuestas activadas
30
30
  votes_blocked: Votación bloqueada
31
31
  votes_enabled: Votos habilitados
32
+ votes_hidden: Votos ocultos (si los votos están habilitados, marcando esta opción ocultará el número de votos)
32
33
  proposals:
33
34
  actions:
34
35
  answer: Respuesta
36
+ export: Exportar
35
37
  new: Nueva
36
38
  title: Acciones
37
39
  admin:
@@ -67,6 +69,8 @@ es:
67
69
  create:
68
70
  error: Ha habido errores al guardar la propuesta.
69
71
  success: Propuesta creada correctamente.
72
+ exports:
73
+ notice: Su exportación está actualmente en curso. Recibirá un correo electrónico cuando esté completo.
70
74
  models:
71
75
  proposal:
72
76
  fields:
@@ -2,4 +2,149 @@ fr:
2
2
  activemodel:
3
3
  attributes:
4
4
  proposal:
5
- title: Titre
5
+ body: Corps de texte
6
+ category_id: Catégorie
7
+ scope_id: Domaine d'application
8
+ title: Titre
9
+ user_group_id: Créer une proposition en tant que
10
+ proposal_answer:
11
+ answer: Répondre
12
+ decidim:
13
+ features:
14
+ proposals:
15
+ actions:
16
+ create: Créer
17
+ vote: Voter
18
+ name: Propositions
19
+ settings:
20
+ global:
21
+ comments_enabled: Commentaires activés
22
+ geocoding_enabled: Géocodage activé
23
+ official_proposals_enabled: Propositions officielles activées
24
+ proposal_answering_enabled: Réponse aux propositions activée
25
+ vote_limit: Limite de vote
26
+ step:
27
+ comments_blocked: Commentaires bloqués
28
+ creation_enabled: Module propositions activé
29
+ proposal_answering_enabled: Réponse aux propositions activée
30
+ votes_blocked: Votes bloqués
31
+ votes_enabled: Votes activés
32
+ votes_hidden: Cacher les votes (si les votes sont activés, le compte des votes sera caché)
33
+ proposals:
34
+ actions:
35
+ answer: Répondre
36
+ export: Exporter
37
+ new: Nouveau
38
+ title: Actions
39
+ admin:
40
+ actions:
41
+ preview: Aperçu
42
+ models:
43
+ proposal:
44
+ name: Proposition
45
+ proposal_answers:
46
+ edit:
47
+ accepted: Publié
48
+ answer_proposal: Répondre
49
+ rejected: Refusée
50
+ title: Réponse à la proposition %{title}
51
+ proposals:
52
+ answer:
53
+ invalid: Il y a eu un problème concernant la réponse à cette proposition
54
+ success: La réponse à la proposition a publiée avec succès
55
+ create:
56
+ invalid: Il y a eu un problème lors de la création de cette proposition
57
+ success: Proposition créée avec succès
58
+ form:
59
+ select_a_category: Sélectionner une catégorie
60
+ index:
61
+ title: Propositions
62
+ new:
63
+ create: Créer
64
+ title: Créer une proposition
65
+ answers:
66
+ accepted: Publié
67
+ not_answered: Resté sans réponse
68
+ rejected: Refusée
69
+ create:
70
+ error: Il y a eu des erreurs lors de la sauvegarde de la proposition.
71
+ success: Proposition créée avec succès.
72
+ exports:
73
+ notice: Votre exportation est en cours. Vous recevrez un e-mail quand elle sera terminée.
74
+ models:
75
+ proposal:
76
+ fields:
77
+ category: Catégorie
78
+ official_proposal: Proposition officielle
79
+ scope: Domaine d'application
80
+ state: Etat
81
+ title: Titre
82
+ proposals:
83
+ count:
84
+ proposals_count:
85
+ one: 1 proposition
86
+ other: "%{count} propositions"
87
+ filters:
88
+ accepted: Publié
89
+ activity: Activité
90
+ all: Toutes
91
+ category: Catégorie
92
+ category_prompt: Sélectionner une catégorie
93
+ citizenship: Citoyenneté
94
+ official: Elu(e)
95
+ origin: Retour à l'original
96
+ rejected: Refusée
97
+ related_to: Liée à
98
+ scopes: Domaines d'application
99
+ search: Rechercher
100
+ state: État
101
+ voted: Voté
102
+ filters_small_view:
103
+ close_modal: Fermer la fenêtre de dialogue
104
+ filter: Filtrer
105
+ filter_by: Filtrer par
106
+ unfold: Déplier
107
+ index:
108
+ new_proposal: Nouvelle proposition
109
+ view_proposal: Voir la proposition
110
+ linked_proposals:
111
+ proposal_votes:
112
+ one: <span class="card--list__data__number">1</span>vote
113
+ other: <span class="card--list__data__number">%{count}</span>votes
114
+ new:
115
+ back: Retour
116
+ select_a_category: Veuillez sélectionner une catégorie
117
+ send: Envoyer
118
+ title: Nouvelle proposition
119
+ orders:
120
+ label: 'Classement des propositions par:'
121
+ most_voted: Les plus votées
122
+ random: Aléatoire
123
+ recent: Les plus récents
124
+ proposal:
125
+ view_proposal: Voir la proposition
126
+ show:
127
+ proposal_accepted_reason: 'Cette proposition a été acceptée parce que :'
128
+ proposal_rejected_reason: 'Cette proposition a été refusée parce que:'
129
+ report: Signaler
130
+ vote_button:
131
+ already_voted: Déjà voté
132
+ no_votes_remaining: Aucun vote restant
133
+ vote: Voter
134
+ votes_blocked: Votes désactivés
135
+ votes_count:
136
+ count:
137
+ one: VOTE
138
+ other: VOTES
139
+ votes_limit:
140
+ vote_limit:
141
+ description: Au lieu de voter autant de propositions que vous voulez, vous ne pouvez voter que jusqu'à %{limit} propositions.
142
+ left: Restant
143
+ title: Vous disposez de %{limit} votes à distribuer
144
+ votes: Votes
145
+ resource_links:
146
+ included_proposals:
147
+ proposal_projects: 'Proposition figurant dans ces projets :'
148
+ proposal_results: 'Proposition figurant dans ces résultats :'
149
+ proposals_from_meeting:
150
+ proposal_meetings: Rencontres connexes