decidim 0.0.3 → 0.0.4

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 (251) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +23 -4
  3. data/.travis.yml +4 -1
  4. data/Gemfile.lock +56 -48
  5. data/Rakefile +1 -1
  6. data/decidim-admin/app/commands/decidim/admin/create_participatory_process_admin.rb +3 -0
  7. data/decidim-admin/app/commands/decidim/admin/update_feature_permissions.rb +46 -0
  8. data/decidim-admin/app/commands/decidim/admin/update_organization.rb +17 -2
  9. data/decidim-admin/app/commands/decidim/admin/update_participatory_process.rb +4 -2
  10. data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +3 -0
  11. data/decidim-admin/app/controllers/decidim/admin/feature_permissions_controller.rb +59 -0
  12. data/decidim-admin/app/controllers/decidim/admin/features_controller.rb +20 -0
  13. data/decidim-admin/app/controllers/decidim/admin/users_controller.rb +3 -1
  14. data/decidim-admin/app/forms/decidim/admin/organization_form.rb +10 -0
  15. data/decidim-admin/app/forms/decidim/admin/participatory_process_form.rb +8 -5
  16. data/decidim-admin/app/forms/decidim/admin/permission_form.rb +31 -0
  17. data/decidim-admin/app/forms/decidim/admin/permissions_form.rb +16 -0
  18. data/decidim-admin/app/helpers/decidim/admin/application_helper.rb +1 -0
  19. data/decidim-admin/app/models/decidim/admin/participatory_process_user_role.rb +1 -1
  20. data/decidim-admin/app/views/decidim/admin/attachments/edit.html.erb +1 -1
  21. data/decidim-admin/app/views/decidim/admin/attachments/new.html.erb +1 -1
  22. data/decidim-admin/app/views/decidim/admin/categories/edit.html.erb +1 -1
  23. data/decidim-admin/app/views/decidim/admin/categories/new.html.erb +1 -1
  24. data/decidim-admin/app/views/decidim/admin/dashboard/show.html.erb +1 -1
  25. data/decidim-admin/app/views/decidim/admin/feature_permissions/edit.html.erb +27 -0
  26. data/decidim-admin/app/views/decidim/admin/features/_feature.html.erb +10 -0
  27. data/decidim-admin/app/views/decidim/admin/features/edit.html.erb +1 -1
  28. data/decidim-admin/app/views/decidim/admin/features/new.html.erb +1 -1
  29. data/decidim-admin/app/views/decidim/admin/organization/_form.html.erb +34 -0
  30. data/decidim-admin/app/views/decidim/admin/organization/edit.html.erb +2 -2
  31. data/decidim-admin/app/views/decidim/admin/participatory_process_steps/edit.html.erb +1 -1
  32. data/decidim-admin/app/views/decidim/admin/participatory_process_steps/new.html.erb +1 -1
  33. data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +1 -1
  34. data/decidim-admin/app/views/decidim/admin/participatory_processes/_form.html.erb +17 -4
  35. data/decidim-admin/app/views/decidim/admin/participatory_processes/edit.html.erb +1 -1
  36. data/decidim-admin/app/views/decidim/admin/participatory_processes/index.html.erb +1 -1
  37. data/decidim-admin/app/views/decidim/admin/participatory_processes/new.html.erb +2 -2
  38. data/decidim-admin/app/views/decidim/admin/participatory_processes/show.html.erb +5 -2
  39. data/decidim-admin/app/views/decidim/admin/scopes/edit.html.erb +2 -2
  40. data/decidim-admin/app/views/decidim/admin/scopes/index.html.erb +1 -1
  41. data/decidim-admin/app/views/decidim/admin/scopes/new.html.erb +2 -2
  42. data/decidim-admin/app/views/decidim/admin/static_pages/_form.html.erb +1 -1
  43. data/decidim-admin/app/views/decidim/admin/static_pages/edit.html.erb +2 -2
  44. data/decidim-admin/app/views/decidim/admin/static_pages/index.html.erb +1 -1
  45. data/decidim-admin/app/views/decidim/admin/static_pages/new.html.erb +2 -2
  46. data/decidim-admin/app/views/decidim/admin/static_pages/show.html.erb +1 -1
  47. data/decidim-admin/app/views/decidim/admin/user_groups/index.html.erb +1 -1
  48. data/decidim-admin/app/views/decidim/admin/users/index.html.erb +1 -1
  49. data/decidim-admin/app/views/decidim/admin/users/new.html.erb +2 -2
  50. data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +1 -1
  51. data/decidim-admin/config/i18n-tasks.yml +4 -3
  52. data/decidim-admin/config/locales/ca.yml +20 -1
  53. data/decidim-admin/config/locales/en.yml +19 -0
  54. data/decidim-admin/config/locales/es.yml +19 -0
  55. data/decidim-admin/config/locales/eu.yml +5 -0
  56. data/decidim-admin/config/routes.rb +8 -1
  57. data/decidim-admin/db/seeds.rb +3 -1
  58. data/decidim-admin/spec/commands/create_participatory_process_admin_spec.rb +19 -0
  59. data/decidim-admin/spec/commands/update_organization_spec.rb +20 -0
  60. data/decidim-admin/spec/features/admin_invite_spec.rb +5 -3
  61. data/decidim-admin/spec/features/admin_manages_feature_permissions_spec.rb +44 -0
  62. data/decidim-admin/spec/features/admin_manages_features_spec.rb +38 -0
  63. data/decidim-admin/spec/features/admin_manages_participatory_process_admins_spec.rb +0 -2
  64. data/decidim-admin/spec/features/admin_manages_participatory_process_attachments_spec.rb +0 -2
  65. data/decidim-admin/spec/features/admin_manages_participatory_process_categories_spec.rb +0 -2
  66. data/decidim-admin/spec/features/admin_manages_participatory_process_steps_spec.rb +0 -2
  67. data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +0 -2
  68. data/decidim-admin/spec/features/admin_manages_user_groups_spec.rb +1 -3
  69. data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_process_admins_spec.rb +0 -2
  70. data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_process_attachments_spec.rb +0 -2
  71. data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_process_steps_spec.rb +0 -2
  72. data/decidim-admin/spec/features/participatory_process_admin_manages_participatory_processes_spec.rb +0 -2
  73. data/decidim-admin/spec/features/process_admin_manages_participatory_process_categories_spec.rb +0 -2
  74. data/decidim-admin/spec/forms/organization_form_spec.rb +11 -2
  75. data/decidim-admin/spec/models/participatory_process_user_role_spec.rb +17 -0
  76. data/decidim-admin/spec/shared/manage_process_steps_examples.rb +3 -2
  77. data/decidim-budgets/app/assets/images/decidim/budgets/icon.svg +16 -4
  78. data/decidim-budgets/app/assets/javascripts/decidim/budgets/progressFixed.js.es6 +23 -0
  79. data/decidim-budgets/app/assets/javascripts/decidim/budgets/projects.js.es6 +1 -0
  80. data/decidim-budgets/app/assets/stylesheets/decidim/budgets/budget/_budget-list.scss +1 -1
  81. data/decidim-budgets/app/commands/decidim/budgets/admin/create_project.rb +0 -1
  82. data/decidim-budgets/app/commands/decidim/budgets/admin/update_project.rb +0 -1
  83. data/decidim-budgets/app/controllers/decidim/budgets/admin/application_controller.rb +9 -0
  84. data/decidim-budgets/app/controllers/decidim/budgets/admin/attachments_controller.rb +29 -0
  85. data/decidim-budgets/app/controllers/decidim/budgets/line_items_controller.rb +2 -0
  86. data/decidim-budgets/app/controllers/decidim/budgets/orders_controller.rb +2 -0
  87. data/decidim-budgets/app/forms/decidim/budgets/admin/project_form.rb +1 -2
  88. data/decidim-budgets/app/models/decidim/budgets/project.rb +1 -0
  89. data/decidim-budgets/app/services/decidim/budgets/project_search.rb +0 -1
  90. data/decidim-budgets/app/views/decidim/budgets/admin/projects/_form.html.erb +0 -4
  91. data/decidim-budgets/app/views/decidim/budgets/admin/projects/edit.html.erb +1 -1
  92. data/decidim-budgets/app/views/decidim/budgets/admin/projects/index.html.erb +1 -0
  93. data/decidim-budgets/app/views/decidim/budgets/admin/projects/new.html.erb +1 -1
  94. data/decidim-budgets/app/views/decidim/budgets/line_items/update_budget.js.erb +2 -0
  95. data/decidim-budgets/app/views/decidim/budgets/projects/_project.html.erb +2 -2
  96. data/decidim-budgets/app/views/decidim/budgets/projects/_project_budget_button.html.erb +2 -2
  97. data/decidim-budgets/app/views/decidim/budgets/projects/index.html.erb +3 -2
  98. data/decidim-budgets/app/views/decidim/budgets/projects/show.html.erb +3 -7
  99. data/decidim-budgets/config/i18n-tasks.yml +1 -0
  100. data/decidim-budgets/config/locales/ca.yml +24 -5
  101. data/decidim-budgets/config/locales/en.yml +12 -3
  102. data/decidim-budgets/config/locales/es.yml +22 -3
  103. data/decidim-budgets/config/locales/eu.yml +5 -0
  104. data/decidim-budgets/db/migrate/20170207101750_remove_short_description_from_decidim_projects.rb +5 -0
  105. data/decidim-budgets/decidim-budgets.gemspec +1 -0
  106. data/decidim-budgets/lib/decidim/budgets/admin_engine.rb +4 -1
  107. data/decidim-budgets/lib/decidim/budgets/feature.rb +15 -4
  108. data/decidim-budgets/lib/decidim/budgets/test/factories.rb +2 -3
  109. data/decidim-budgets/spec/commands/create_project_spec.rb +0 -1
  110. data/decidim-budgets/spec/commands/update_project_spec.rb +0 -1
  111. data/decidim-budgets/spec/features/admin_manages_project_attachments_spec.rb +10 -0
  112. data/decidim-budgets/spec/features/admin_manages_projects_spec.rb +0 -2
  113. data/decidim-budgets/spec/features/orders_spec.rb +43 -5
  114. data/decidim-budgets/spec/features/process_admin_manages_project_attachments_spec.rb +12 -0
  115. data/decidim-budgets/spec/features/process_admin_manages_projects_spec.rb +0 -2
  116. data/decidim-budgets/spec/forms/project_form_spec.rb +0 -10
  117. data/decidim-budgets/spec/shared/manage_attachments_examples.rb +17 -0
  118. data/decidim-budgets/spec/shared/manage_projects_examples.rb +0 -7
  119. data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
  120. data/decidim-comments/app/commands/decidim/comments/create_comment.rb +10 -0
  121. data/decidim-comments/app/forms/decidim/comments/comment_form.rb +1 -1
  122. data/decidim-comments/app/frontend/comments/add_comment_form.component.jsx +33 -12
  123. data/decidim-comments/app/frontend/comments/add_comment_form.component.test.jsx +6 -0
  124. data/decidim-comments/app/frontend/comments/comment.component.jsx +7 -5
  125. data/decidim-comments/app/frontend/comments/comment_order_selector.component.jsx +2 -2
  126. data/decidim-comments/app/frontend/comments/comment_thread.component.jsx +5 -0
  127. data/decidim-comments/app/frontend/comments/comments.component.jsx +11 -0
  128. data/decidim-comments/app/frontend/comments/vote_button.component.jsx +5 -0
  129. data/decidim-comments/app/frontend/comments/vote_button_component.test.jsx +1 -1
  130. data/decidim-comments/app/frontend/entry.test.js +2 -0
  131. data/decidim-comments/app/mailers/decidim/comments/comment_notification_mailer.rb +31 -0
  132. data/decidim-comments/app/models/decidim/comments/comment.rb +6 -0
  133. data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/comment_created.html.erb +18 -0
  134. data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/reply_created.html.erb +18 -0
  135. data/decidim-comments/config/locales/ca.yml +17 -3
  136. data/decidim-comments/config/locales/en.yml +17 -3
  137. data/decidim-comments/config/locales/es.yml +17 -3
  138. data/decidim-comments/config/locales/eu.yml +5 -0
  139. data/decidim-comments/lib/decidim/comments.rb +1 -0
  140. data/decidim-comments/{app/helpers → lib}/decidim/comments/comments_helper.rb +0 -0
  141. data/decidim-comments/spec/commands/create_comment_spec.rb +68 -1
  142. data/decidim-comments/spec/features/comments_spec.rb +27 -20
  143. data/decidim-comments/spec/features/notifications_spec.rb +45 -0
  144. data/decidim-comments/spec/forms/comment_form_spec.rb +6 -0
  145. data/decidim-comments/spec/mailers/comment_notification_mailer_spec.rb +36 -0
  146. data/decidim-comments/spec/models/comment_spec.rb +8 -0
  147. data/decidim-comments/spec/spec_helper.rb +0 -1
  148. data/decidim-comments/spec/types/mutation_type_spec.rb +8 -7
  149. data/decidim-dev/config/locales/ca.yml +5 -0
  150. data/decidim-dev/config/locales/es.yml +5 -0
  151. data/decidim-dev/config/locales/eu.yml +5 -0
  152. data/decidim-dev/decidim-dev.gemspec +2 -1
  153. data/decidim-dev/lib/decidim/dev.rb +2 -0
  154. data/decidim-dev/lib/decidim/dev/dummy_authorization_handler.rb +1 -0
  155. data/decidim-dev/lib/decidim/dev/test/base_spec_helper.rb +4 -1
  156. data/decidim-dev/lib/decidim/dev/test/rspec_support/action_mailer.rb +19 -0
  157. data/decidim-dev/lib/decidim/dev/test/rspec_support/feature.rb +26 -3
  158. data/decidim-dev/lib/decidim/dev/test/rspec_support/translation_helpers.rb +1 -1
  159. data/decidim-meetings/app/forms/decidim/meetings/admin/meeting_form.rb +2 -2
  160. data/decidim-meetings/app/views/decidim/meetings/admin/meeting_closes/edit.html.erb +1 -1
  161. data/decidim-meetings/app/views/decidim/meetings/admin/meetings/edit.html.erb +1 -1
  162. data/decidim-meetings/app/views/decidim/meetings/admin/meetings/new.html.erb +1 -1
  163. data/decidim-meetings/app/views/decidim/meetings/meetings/index.html.erb +3 -1
  164. data/decidim-meetings/app/views/decidim/meetings/meetings/show.html.erb +11 -1
  165. data/decidim-meetings/config/locales/ca.yml +3 -3
  166. data/decidim-meetings/config/locales/en.yml +1 -1
  167. data/decidim-meetings/config/locales/es.yml +1 -1
  168. data/decidim-meetings/config/locales/eu.yml +5 -0
  169. data/decidim-meetings/decidim-meetings.gemspec +1 -1
  170. data/decidim-meetings/lib/decidim/meetings/feature.rb +1 -0
  171. data/decidim-meetings/spec/features/admin_manages_meetings_attachments_spec.rb +0 -2
  172. data/decidim-meetings/spec/features/admin_manages_meetings_spec.rb +0 -2
  173. data/decidim-meetings/spec/features/process_admin_manages_meetings_attachments_spec.rb +0 -2
  174. data/decidim-meetings/spec/features/process_admin_manages_meetings_spec.rb +0 -2
  175. data/decidim-pages/app/assets/images/decidim/pages/icon.svg +1 -3
  176. data/decidim-pages/app/views/decidim/pages/admin/pages/edit.html.erb +1 -1
  177. data/decidim-pages/app/views/decidim/pages/application/show.html.erb +4 -1
  178. data/decidim-pages/config/locales/eu.yml +7 -0
  179. data/decidim-pages/lib/decidim/pages/feature.rb +1 -0
  180. data/decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb +42 -5
  181. data/decidim-proposals/app/forms/decidim/proposals/proposal_form.rb +3 -1
  182. data/decidim-proposals/app/helpers/decidim/proposals/proposal_votes_helper.rb +1 -1
  183. data/decidim-proposals/app/models/decidim/proposals/abilities/current_user.rb +22 -4
  184. data/decidim-proposals/app/models/decidim/proposals/proposal.rb +2 -2
  185. data/decidim-proposals/app/services/decidim/proposals/proposal_search.rb +25 -13
  186. data/decidim-proposals/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +1 -1
  187. data/decidim-proposals/app/views/decidim/proposals/admin/proposals/new.html.erb +1 -1
  188. data/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb +9 -1
  189. data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal.html.erb +2 -6
  190. data/decidim-proposals/app/views/decidim/proposals/proposals/_proposals.html.erb +2 -1
  191. data/decidim-proposals/app/views/decidim/proposals/proposals/_tags.html.erb +10 -0
  192. data/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb +9 -9
  193. data/decidim-proposals/app/views/decidim/proposals/proposals/_votes_count.html.erb +2 -2
  194. data/decidim-proposals/app/views/decidim/proposals/proposals/index.html.erb +7 -3
  195. data/decidim-proposals/app/views/decidim/proposals/proposals/index.js.erb +6 -1
  196. data/decidim-proposals/app/views/decidim/proposals/proposals/new.html.erb +1 -1
  197. data/decidim-proposals/app/views/decidim/proposals/proposals/show.html.erb +22 -23
  198. data/decidim-proposals/config/i18n-tasks.yml +2 -0
  199. data/decidim-proposals/config/locales/ca.yml +23 -15
  200. data/decidim-proposals/config/locales/en.yml +12 -4
  201. data/decidim-proposals/config/locales/es.yml +12 -4
  202. data/decidim-proposals/config/locales/eu.yml +5 -0
  203. data/decidim-proposals/db/migrate/20170205082832_add_index_to_decidim_proposals_proposals_proposal_votes_count.rb +7 -0
  204. data/decidim-proposals/lib/decidim/proposals/feature.rb +10 -1
  205. data/decidim-proposals/lib/decidim/proposals/test/factories.rb +1 -1
  206. data/decidim-proposals/spec/commands/decidim/proposals/admin_create_proposal_spec.rb +0 -1
  207. data/decidim-proposals/spec/commands/decidim/proposals/create_proposal_spec.rb +0 -1
  208. data/decidim-proposals/spec/features/admin_manages_proposals_spec.rb +0 -2
  209. data/decidim-proposals/spec/features/process_admin_manages_proposals_spec.rb +0 -2
  210. data/decidim-proposals/spec/features/proposals_spec.rb +77 -0
  211. data/decidim-proposals/spec/features/vote_proposal_spec.rb +16 -1
  212. data/decidim-proposals/spec/forms/decidim/proposals/admin_proposal_form_spec.rb +0 -1
  213. data/decidim-proposals/spec/forms/decidim/proposals/proposal_form_spec.rb +0 -1
  214. data/decidim-proposals/spec/helpers/proposal_votes_helper_spec.rb +10 -0
  215. data/decidim-proposals/spec/services/decidim/proposals/proposal_search_spec.rb +56 -31
  216. data/decidim-proposals/spec/shared/create_proposal_examples.rb +2 -2
  217. data/decidim-results/app/views/decidim/results/admin/results/edit.html.erb +1 -1
  218. data/decidim-results/app/views/decidim/results/admin/results/new.html.erb +1 -1
  219. data/decidim-results/app/views/decidim/results/results/index.html.erb +3 -1
  220. data/decidim-results/app/views/decidim/results/results/show.html.erb +11 -1
  221. data/decidim-results/config/locales/ca.yml +2 -2
  222. data/decidim-results/config/locales/en.yml +1 -1
  223. data/decidim-results/config/locales/es.yml +1 -1
  224. data/decidim-results/config/locales/eu.yml +5 -0
  225. data/decidim-results/lib/decidim/results/feature.rb +1 -0
  226. data/decidim-results/spec/features/admin_manages_results_spec.rb +0 -2
  227. data/decidim-results/spec/features/process_admin_manages_results_spec.rb +0 -2
  228. data/decidim-system/app/assets/stylesheets/decidim/system/_foundation_and_overrides.scss +1 -1
  229. data/decidim-system/app/controllers/decidim/system/application_controller.rb +1 -0
  230. data/decidim-system/app/controllers/decidim/system/devise/sessions_controller.rb +1 -0
  231. data/decidim-system/app/views/decidim/system/admins/edit.html.erb +2 -2
  232. data/decidim-system/app/views/decidim/system/admins/index.html.erb +1 -1
  233. data/decidim-system/app/views/decidim/system/admins/new.html.erb +2 -2
  234. data/decidim-system/app/views/decidim/system/admins/show.html.erb +1 -1
  235. data/decidim-system/app/views/decidim/system/dashboard/show.html.erb +1 -1
  236. data/decidim-system/app/views/decidim/system/devise/passwords/edit.html.erb +1 -1
  237. data/decidim-system/app/views/decidim/system/devise/passwords/new.html.erb +1 -1
  238. data/decidim-system/app/views/decidim/system/devise/sessions/new.html.erb +1 -1
  239. data/decidim-system/app/views/decidim/system/organizations/edit.html.erb +1 -1
  240. data/decidim-system/app/views/decidim/system/organizations/index.html.erb +1 -1
  241. data/decidim-system/app/views/decidim/system/organizations/new.html.erb +2 -2
  242. data/decidim-system/app/views/decidim/system/organizations/show.html.erb +1 -1
  243. data/decidim-system/config/locales/eu.yml +7 -0
  244. data/decidim-system/spec/features/organizations_spec.rb +1 -2
  245. data/lib/generators/decidim/install_generator.rb +9 -0
  246. data/lib/generators/decidim/templates/initializer.rb +1 -0
  247. data/package.json +6 -6
  248. data/yarn.lock +743 -738
  249. metadata +53 -25
  250. data/decidim-comments/spec/support/dummy.rb +0 -20
  251. data/decidim-proposals/app/views/decidim/proposals/proposals/_share.html.erb +0 -33
@@ -33,7 +33,7 @@ describe "Vote Proposal", type: :feature do
33
33
  context "when the user is not logged in" do
34
34
  it "should be given the option to sign in" do
35
35
  visit_feature
36
-
36
+
37
37
  within ".card__support", match: :first do
38
38
  page.find('.card__button').click
39
39
  end
@@ -102,6 +102,21 @@ describe "Vote Proposal", type: :feature do
102
102
  end
103
103
  end
104
104
 
105
+ context "when the proposal is not voted yet but the user isn't authorized" do
106
+ before do
107
+ feature.update_attribute(:permissions, vote: { authorization_handler_name: "decidim/dummy_authorization_handler" })
108
+ visit_feature
109
+ end
110
+
111
+ it "should show a modal dialog" do
112
+ within "#proposal-#{proposal.id}-vote-button" do
113
+ page.find('.card__button').click
114
+ end
115
+
116
+ expect(page).to have_content("Authorization required")
117
+ end
118
+ end
119
+
105
120
  context "when the proposal is already voted" do
106
121
  before do
107
122
  create(:proposal_vote, proposal: proposal, author: user)
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  require "spec_helper"
3
- require_relative "../../../shared/proposal_form_examples"
4
3
 
5
4
  module Decidim
6
5
  module Proposals
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  require "spec_helper"
3
- require_relative "../../../shared/proposal_form_examples"
4
3
 
5
4
  module Decidim
6
5
  module Proposals
@@ -6,6 +6,7 @@ module Decidim
6
6
  describe ProposalVotesHelper do
7
7
  let(:organization) { create(:organization) }
8
8
  let(:vote_limit) { 10 }
9
+ let(:votes_enabled) { true }
9
10
  let(:proposal_feature) { create(:proposal_feature, organization: organization) }
10
11
  let(:user) { create(:user, organization: organization) }
11
12
 
@@ -13,6 +14,7 @@ module Decidim
13
14
  allow(helper).to receive(:current_user).and_return(user)
14
15
  allow(helper).to receive(:current_feature).and_return(proposal_feature)
15
16
  allow(helper).to receive(:feature_settings).and_return(double(vote_limit: vote_limit))
17
+ allow(helper).to receive(:current_settings).and_return(double(votes_enabled?: votes_enabled))
16
18
  end
17
19
 
18
20
  describe "#vote_button_classes" do
@@ -45,6 +47,14 @@ module Decidim
45
47
  end
46
48
  end
47
49
 
50
+ context "when the step_settings votes_enabled is false" do
51
+ let(:votes_enabled) { false }
52
+
53
+ it "returns false" do
54
+ expect(helper.vote_limit_enabled?).to be_falsy
55
+ end
56
+ end
57
+
48
58
  context "when the current_settings vote_limit is not present" do
49
59
  let(:vote_limit) { nil }
50
60
 
@@ -4,36 +4,33 @@ module Decidim
4
4
  module Proposals
5
5
  describe ProposalSearch do
6
6
  let(:feature) { create(:feature, manifest_name: "proposals") }
7
+ let(:scope1) { create :scope, organization: feature.organization }
8
+ let(:scope2) { create :scope, organization: feature.organization }
9
+ let(:participatory_process) { feature.participatory_process }
7
10
  let(:user) { create(:user, organization: feature.organization) }
8
- let!(:proposal) { create(:proposal, feature: feature)}
11
+ let!(:proposal) { create(:proposal, feature: feature, scope: scope1)}
9
12
 
10
13
  describe "results" do
11
- let(:random_seed) { 0.2 }
12
14
  let(:activity) { [] }
13
15
  let(:search_text) { nil }
14
16
  let(:origin) { nil }
17
+ let(:related_to) { nil }
15
18
  let(:state) { nil }
19
+ let(:scope_id) { nil }
16
20
 
17
21
  subject do
18
22
  described_class.new({
19
23
  feature: feature,
20
- random_seed: random_seed,
21
24
  activity: activity,
22
25
  search_text: search_text,
23
26
  state: state,
24
27
  origin: origin,
28
+ related_to: related_to,
29
+ scope_id: scope_id,
25
30
  current_user: user
26
31
  }).results
27
32
  end
28
33
 
29
- context "when given a random seed" do
30
- it "sets the seed at the database" do
31
- allow(Proposal.connection).to receive(:execute).with(anything)
32
- expect(Proposal.connection).to receive(:execute).with("SELECT setseed(0.2)").and_call_original
33
- subject
34
- end
35
- end
36
-
37
34
  it "only includes proposals from the given feature" do
38
35
  other_proposal = create(:proposal)
39
36
 
@@ -41,12 +38,6 @@ module Decidim
41
38
  expect(subject).not_to include(other_proposal)
42
39
  end
43
40
 
44
- it "randomizes the order of proposals" do
45
- allow(Proposal.connection).to receive(:execute).with(anything)
46
- expect_any_instance_of(Decidim::Proposals::Proposal::ActiveRecord_Relation).to receive(:reorder).with("RANDOM()").and_call_original
47
- subject
48
- end
49
-
50
41
  describe "when the filter includes search_text" do
51
42
  let(:search_text) { "dog" }
52
43
 
@@ -122,26 +113,60 @@ module Decidim
122
113
  end
123
114
  end
124
115
  end
125
- end
126
116
 
127
- describe "random_seed" do
128
- subject do
129
- described_class.new({
130
- feature: feature,
131
- random_seed: random_seed
132
- }).random_seed
133
- end
117
+ context "scope_id" do
118
+ let!(:proposal2) { create(:proposal, feature: feature, scope: scope2)}
119
+
120
+ context "when a single id is being sent" do
121
+ let(:scope_id) { scope1.id }
122
+
123
+ it "filters meetings by scope" do
124
+ expect(subject).to eq [proposal]
125
+ end
126
+ end
134
127
 
135
- context "without a given random seed" do
136
- let(:random_seed) { nil }
128
+ context "when multiple ids are sent" do
129
+ let(:scope_id) { [scope2.id, scope1.id] }
137
130
 
138
- it { is_expected.to be_within(1).of(0.0) }
131
+ it "filters meetings by scope" do
132
+ expect(subject).to match_array [proposal, proposal2]
133
+ end
134
+ end
139
135
  end
140
136
 
141
- context "with an invalid random seed" do
142
- let(:random_seed) { ["foo", 2, -10].sample }
137
+ describe "when the filter includes related_to" do
138
+ context "when filtering by related to meetings" do
139
+ let(:related_to) { "Decidim::Meetings::Meeting".underscore }
140
+ let(:meetings_feature) { create(:feature, manifest_name: "meetings", participatory_process: participatory_process) }
141
+ let(:meeting) { create :meeting, feature: meetings_feature }
142
+
143
+ it "returns only proposals related to meetings" do
144
+ related_proposal = create(:proposal, :accepted, feature: feature)
145
+ related_proposal_2 = create(:proposal, :accepted, feature: feature)
146
+ create_list(:proposal, 3, feature: feature)
147
+ meeting.link_resources([related_proposal], "proposals_from_meeting")
148
+ related_proposal_2.link_resources([meeting], "proposals_from_meeting")
149
+
150
+ expect(subject).to match_array([related_proposal, related_proposal_2])
151
+ end
152
+ end
143
153
 
144
- it { is_expected.to be_within(1).of(0.0) }
154
+ context "when filtering by related to results" do
155
+ let(:related_to) { "Decidim::Results::Result".underscore }
156
+ let(:results_feature) { create(:feature, manifest_name: "results", participatory_process: participatory_process) }
157
+ let(:result) { create :result, feature: results_feature }
158
+
159
+
160
+ it "returns only proposals related to results" do
161
+ related_proposal = create(:proposal, :accepted, feature: feature)
162
+ related_proposal_2 = create(:proposal, :accepted, feature: feature)
163
+ create_list(:proposal, 3, feature: feature)
164
+ result.link_resources([related_proposal], "included_proposals")
165
+ related_proposal_2.link_resources([result], "included_proposals")
166
+
167
+ expect(subject).to match_array([related_proposal, related_proposal_2])
168
+ end
169
+ end
145
170
  end
146
171
  end
147
172
  end
@@ -16,8 +16,8 @@ RSpec.shared_examples "create a proposal" do |with_author|
16
16
  describe "call" do
17
17
  let(:form_params) do
18
18
  {
19
- title: "Proposal title",
20
- body: "Proposal body"
19
+ title: "A reasonable proposal title",
20
+ body: "A reasonable proposal body"
21
21
  }
22
22
  end
23
23
 
@@ -1,6 +1,6 @@
1
1
  <h3><%= t ".title" %></h3>
2
2
 
3
- <%= form_for(@form) do |f| %>
3
+ <%= decidim_form_for(@form) do |f| %>
4
4
  <%= render partial: 'form', object: f %>
5
5
 
6
6
  <div class="actions">
@@ -1,6 +1,6 @@
1
1
  <h3><%= t ".title" %></h3>
2
2
 
3
- <%= form_for(@form) do |f| %>
3
+ <%= decidim_form_for(@form) do |f| %>
4
4
  <%= render partial: 'form', object: f %>
5
5
 
6
6
  <div class="actions">
@@ -1,4 +1,6 @@
1
- <% content_for(:title, t(".title")) %>
1
+ <% add_meta_tags({
2
+ title: t(".meta_title", feature_name: translated_attribute(current_feature.name))
3
+ }) %>
2
4
 
3
5
  <div class="row columns">
4
6
  <div class="title-action">
@@ -1,4 +1,10 @@
1
- <% content_for(:title, translated_attribute(result.title)) %>
1
+ <% provide(:title, translated_attribute(result.title)) %>
2
+
3
+ <% add_meta_tags({
4
+ description: translated_attribute(result.description),
5
+ title: translated_attribute(result.title),
6
+ url: result_url(result.id)
7
+ }) %>
2
8
 
3
9
  <div class="row column view-header">
4
10
  <h2 class="heading2"><%= translated_attribute result.title %></h2>
@@ -34,6 +40,7 @@
34
40
  </div>
35
41
  </div>
36
42
  </div>
43
+ <%= render partial: "decidim/shared/share_modal" %>
37
44
  </div>
38
45
  <div class="columns mediumlarge-8 mediumlarge-pull-4">
39
46
  <div class="section">
@@ -50,3 +57,6 @@
50
57
  <%= comments_for result, arguable: true, votable: true %>
51
58
  <% end %>
52
59
  <% end %>
60
+
61
+ <%= javascript_include_tag "decidim/proposals/social_share" %>
62
+ <%= stylesheet_link_tag "decidim/proposals/social_share" %>
@@ -50,12 +50,12 @@ ca:
50
50
  scopes: Àmbits
51
51
  search: Cerca
52
52
  index:
53
- title: Resultats
53
+ meta_title: "%{feature_name}"
54
54
  show:
55
55
  stats:
56
56
  attendees: Assistents
57
57
  comments: Comentaris
58
58
  contributions: Aportacions
59
- meetings: Llistat de trobades
59
+ meetings: Trobades
60
60
  proposals: Propostes
61
61
  votes: Suports
@@ -51,7 +51,7 @@ en:
51
51
  scopes: Scopes
52
52
  search: Search
53
53
  index:
54
- title: Results
54
+ meta_title: "%{feature_name}"
55
55
  show:
56
56
  stats:
57
57
  attendees: Attendees
@@ -50,7 +50,7 @@ es:
50
50
  scopes: Ámbitos
51
51
  search: Buscar
52
52
  index:
53
- title: Resultados
53
+ meta_title: "%{feature_name}"
54
54
  show:
55
55
  stats:
56
56
  attendees: Asistentes
@@ -0,0 +1,5 @@
1
+ eu:
2
+ decidim:
3
+ features:
4
+ results:
5
+ name: Emaitzak
@@ -31,6 +31,7 @@ Decidim.register_feature(:results) do |feature|
31
31
  feature = Decidim::Feature.create!(
32
32
  name: Decidim::Features::Namer.new(process.organization.available_locales, :results).i18n_name,
33
33
  manifest_name: :results,
34
+ published_at: Time.current,
34
35
  participatory_process: process
35
36
  )
36
37
 
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "spec_helper"
4
- require_relative "../shared/admin_shared_context"
5
- require_relative "../shared/manage_results_examples"
6
4
 
7
5
  describe "Admin manages results", type: :feature do
8
6
  include_context "admin"
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "spec_helper"
4
- require_relative "../shared/admin_shared_context"
5
- require_relative "../shared/manage_results_examples"
6
4
 
7
5
  describe "Process admin manages results", type: :feature do
8
6
  include_context "admin"
@@ -26,7 +26,7 @@
26
26
  @include foundation-drilldown-menu;
27
27
  @include foundation-dropdown;
28
28
  @include foundation-dropdown-menu;
29
- @include foundation-flex-video;
29
+ @include foundation-responsive-embed;
30
30
  @include foundation-label;
31
31
  @include foundation-media-object;
32
32
  @include foundation-menu;
@@ -7,6 +7,7 @@ module Decidim
7
7
  protect_from_forgery with: :exception, prepend: true
8
8
 
9
9
  helper Decidim::TranslationsHelper
10
+ helper Decidim::DecidimFormHelper
10
11
  end
11
12
  end
12
13
  end
@@ -5,6 +5,7 @@ module Decidim
5
5
  # Custom Sessions controller for Devise in order to use a custom layout
6
6
  # and views.
7
7
  class SessionsController < ::Devise::SessionsController
8
+ helper Decidim::DecidimFormHelper
8
9
  layout "decidim/system/login"
9
10
  end
10
11
  end
@@ -1,8 +1,8 @@
1
- <% content_for :title do %>
1
+ <% provide :title do %>
2
2
  <h2><%= t ".title" %></h2>
3
3
  <% end %>
4
4
 
5
- <%= form_for(@form) do |f| %>
5
+ <%= decidim_form_for(@form) do |f| %>
6
6
  <%= render partial: 'form', object: f %>
7
7
 
8
8
  <div class="actions">
@@ -1,4 +1,4 @@
1
- <% content_for :title do %>
1
+ <% provide :title do %>
2
2
  <h2><%= t ".title" %></h2>
3
3
  <% end %>
4
4
 
@@ -1,8 +1,8 @@
1
- <% content_for :title do %>
1
+ <% provide :title do %>
2
2
  <h2><%= t ".title" %></h2>
3
3
  <% end %>
4
4
 
5
- <%= form_for(@form) do |f| %>
5
+ <%= decidim_form_for(@form) do |f| %>
6
6
  <%= render partial: 'form', object: f %>
7
7
 
8
8
  <div class="actions">
@@ -1,4 +1,4 @@
1
- <% content_for :title do %>
1
+ <% provide :title do %>
2
2
  <h2><%= link_to @admin.email, @admin %></h2>
3
3
  <% end %>
4
4
 
@@ -1,3 +1,3 @@
1
- <% content_for :title do %>
1
+ <% provide :title do %>
2
2
  <h2><%= t("decidim.system.titles.dashboard") %></h2>
3
3
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <h2>Change your password</h2>
2
2
 
3
- <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
3
+ <%= decidim_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
4
4
  <%= devise_error_messages! %>
5
5
  <%= f.hidden_field :reset_password_token %>
6
6
 
@@ -1,6 +1,6 @@
1
1
  <h2>Forgot your password?</h2>
2
2
 
3
- <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
3
+ <%= decidim_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
4
4
  <%= devise_error_messages! %>
5
5
 
6
6
  <div class="field">
@@ -1,6 +1,6 @@
1
1
  <h2>Log in</h2>
2
2
 
3
- <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
3
+ <%= decidim_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
4
4
  <div class="field">
5
5
  <%= f.email_field :email, autofocus: true %>
6
6
  </div>