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
@@ -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_projects_examples"
6
4
 
7
5
  describe "Admin manages projects", type: :feature do
8
6
  include_context "admin"
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  # frozen_string_literal: true
2
3
  require "spec_helper"
3
4
 
@@ -49,13 +50,30 @@ describe "Orders", type: :feature do
49
50
  expect(page).to have_content project.title[I18n.locale]
50
51
  end
51
52
 
52
- within ".budget-summary__progressbox" do
53
+ within "#order-progress .budget-summary__progressbox" do
53
54
  expect(page).to have_content "25%"
54
55
  expect(page).to have_selector("button.small:disabled")
55
56
  end
56
57
  end
57
58
  end
58
59
 
60
+ context "and isn't authorized" do
61
+ before do
62
+ feature.update_attribute(:permissions, vote: {
63
+ authorization_handler_name: "decidim/dummy_authorization_handler"
64
+ })
65
+ visit_feature
66
+ end
67
+
68
+ it "shows a modal dialog" do
69
+ within "#project-#{project.id}-item" do
70
+ page.find('.budget--list__action').click
71
+ end
72
+
73
+ expect(page).to have_content("Authorization required")
74
+ end
75
+ end
76
+
59
77
  context "and has pending order" do
60
78
  let!(:order) { create(:order, user: user, feature: feature) }
61
79
  let!(:line_item) { create(:line_item, order: order, project: project) }
@@ -72,7 +90,7 @@ describe "Orders", type: :feature do
72
90
  expect(page).not_to have_content "1 project selected"
73
91
  expect(page).not_to have_selector ".budget-summary__selected"
74
92
 
75
- within ".budget-summary__progressbox" do
93
+ within "#order-progress .budget-summary__progressbox" do
76
94
  expect(page).to have_content "0%"
77
95
  end
78
96
 
@@ -105,7 +123,7 @@ describe "Orders", type: :feature do
105
123
 
106
124
  expect(page).to have_selector '.budget-list__data--added', count: 2
107
125
 
108
- within ".budget-summary__progressbox" do
126
+ within "#order-progress .budget-summary__progressbox" do
109
127
  page.find('.button.small').click
110
128
  end
111
129
 
@@ -117,7 +135,7 @@ describe "Orders", type: :feature do
117
135
 
118
136
  expect(page).to have_content("successfully")
119
137
 
120
- within ".budget-summary__progressbox" do
138
+ within "#order-progress .budget-summary__progressbox" do
121
139
  expect(page).not_to have_selector("button.small")
122
140
  end
123
141
  end
@@ -136,7 +154,7 @@ describe "Orders", type: :feature do
136
154
 
137
155
  expect(page).to have_content("successfully")
138
156
 
139
- within ".budget-summary__progressbox" do
157
+ within "#order-progress .budget-summary__progressbox" do
140
158
  expect(page).to have_selector("button.small:disabled")
141
159
  end
142
160
 
@@ -146,4 +164,24 @@ describe "Orders", type: :feature do
146
164
  end
147
165
  end
148
166
  end
167
+
168
+ describe "show" do
169
+ let!(:project) { create(:project, feature: feature, budget: 25_000_000) }
170
+
171
+ before do
172
+ visit decidim_budgets.project_path(
173
+ id: project.id,
174
+ participatory_process_id: participatory_process,
175
+ feature_id: feature
176
+ )
177
+ end
178
+
179
+ let(:attached_to) { project }
180
+ it_behaves_like "has attachments"
181
+
182
+ it "shows the feature" do
183
+ expect(page).to have_i18n_content(project.title)
184
+ expect(page).to have_i18n_content(project.description)
185
+ end
186
+ end
149
187
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+ require_relative "../shared/admin_shared_context"
5
+ require_relative "../shared/manage_attachments_examples"
6
+
7
+ describe "Process admin manages project attachments", type: :feature do
8
+ include_context "admin"
9
+ let(:user) { process_admin }
10
+
11
+ it_behaves_like "manage project attachments"
12
+ end
@@ -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_projects_examples"
6
4
 
7
5
  describe "Process admin manages projects", type: :feature do
8
6
  include_context "admin"
@@ -18,9 +18,6 @@ describe Decidim::Budgets::Admin::ProjectForm do
18
18
  let(:description) do
19
19
  Decidim::Faker::Localized.sentence(3)
20
20
  end
21
- let(:short_description) do
22
- Decidim::Faker::Localized.sentence(3)
23
- end
24
21
  let(:budget) { Faker::Number.number(8) }
25
22
  let(:scope) { create :scope, organization: organization }
26
23
  let(:scope_id) { scope.id }
@@ -32,7 +29,6 @@ describe Decidim::Budgets::Admin::ProjectForm do
32
29
  decidim_category_id: category_id,
33
30
  title_en: title[:en],
34
31
  description_en: description[:en],
35
- short_description_en: short_description[:en],
36
32
  budget: budget
37
33
  }
38
34
  end
@@ -53,12 +49,6 @@ describe Decidim::Budgets::Admin::ProjectForm do
53
49
  it { is_expected.not_to be_valid }
54
50
  end
55
51
 
56
- describe "when short_description is missing" do
57
- let(:short_description) { { en: nil } }
58
-
59
- it { is_expected.not_to be_valid }
60
- end
61
-
62
52
  describe "when budget is missing" do
63
53
  let(:budget) { nil }
64
54
 
@@ -0,0 +1,17 @@
1
+ require "decidim/admin/test/manage_attachments_examples"
2
+
3
+ RSpec.shared_examples "manage project attachments" do
4
+ let(:attached_to) { project }
5
+
6
+ before do
7
+ switch_to_host(organization.host)
8
+ login_as user, scope: :user
9
+ visit decidim_admin.manage_feature_path(participatory_process_id: participatory_process, feature_id: current_feature)
10
+
11
+ within find("tr", text: translated(project.title)) do
12
+ click_link "Attachments"
13
+ end
14
+ end
15
+
16
+ it_behaves_like "manage attachments examples"
17
+ end
@@ -49,13 +49,6 @@ RSpec.shared_examples "manage projects" do
49
49
  es: "Mi proyecto",
50
50
  ca: "El meu projecte"
51
51
  )
52
- fill_in_i18n_editor(
53
- :project_short_description,
54
- "#short_description-tabs",
55
- en: "Short description",
56
- es: "Descripción corta",
57
- ca: "Descripció curta"
58
- )
59
52
  fill_in_i18n_editor(
60
53
  :project_description,
61
54
  "#description-tabs",
@@ -22,6 +22,8 @@ module Decidim
22
22
  return broadcast(:invalid) if form.invalid?
23
23
 
24
24
  create_comment
25
+ send_notification_to_author unless @author == @commentable.author
26
+
25
27
  broadcast(:ok, @comment)
26
28
  end
27
29
 
@@ -36,6 +38,14 @@ module Decidim
36
38
  alignment: form.alignment,
37
39
  decidim_user_group_id: form.user_group_id)
38
40
  end
41
+
42
+ def send_notification_to_author
43
+ if @comment.depth > 0 && @commentable.author.replies_notifications?
44
+ CommentNotificationMailer.reply_created(@author, @comment, @commentable, @comment.root_commentable).deliver_later
45
+ elsif @comment.depth == 0 && @commentable.author.comments_notifications?
46
+ CommentNotificationMailer.comment_created(@author, @comment, @commentable).deliver_later
47
+ end
48
+ end
39
49
  end
40
50
  end
41
51
  end
@@ -10,7 +10,7 @@ module Decidim
10
10
 
11
11
  mimic :comment
12
12
 
13
- validates :body, presence: true
13
+ validates :body, presence: true, length: { maximum: 1000 }
14
14
  validates :alignment, inclusion: { in: [0, 1, -1] }, if: ->(form) { form.alignment.present? }
15
15
  end
16
16
  end
@@ -31,19 +31,34 @@ export class AddCommentForm extends Component {
31
31
  };
32
32
  }
33
33
 
34
+ componentDidMount() {
35
+ if ($(document).foundation) {
36
+ $(this.form).foundation();
37
+ }
38
+ }
39
+
34
40
  render() {
35
- const { submitButtonClassName, commentableType, commentableId } = this.props;
41
+ const { submitButtonClassName, commentableType, commentableId, maxLength } = this.props;
36
42
  const { disabled } = this.state;
37
43
 
38
44
  return (
39
45
  <div className="add-comment">
40
46
  {this._renderHeading()}
41
47
  {this._renderOpinionButtons()}
42
- <form onSubmit={(evt) => this._addComment(evt)}>
48
+ <form
49
+ onSubmit={(evt) => this._addComment(evt)}
50
+ data-abide
51
+ data-live-validate="true"
52
+ data-validate-on-blur="true"
53
+ ref={(form) => this.form = form}
54
+ >
43
55
  {this._renderCommentAs()}
44
56
  <div className="field">
45
57
  <label className="show-for-sr" htmlFor={`add-comment-${commentableType}-${commentableId}`}>{ I18n.t("components.add_comment_form.form.body.label") }</label>
46
58
  {this._renderTextArea()}
59
+ <span className="form-error">
60
+ { I18n.t("components.add_comment_form.form.form_error", { length: maxLength }) }
61
+ </span>
47
62
  <input
48
63
  type="submit"
49
64
  className={submitButtonClassName}
@@ -81,12 +96,15 @@ export class AddCommentForm extends Component {
81
96
  * @returns {Void|DOMElement} - The heading or an empty element
82
97
  */
83
98
  _renderTextArea() {
84
- const { commentableType, commentableId, autoFocus} = this.props;
99
+ const { commentableType, commentableId, autoFocus, maxLength } = this.props;
85
100
 
86
101
  let textAreaProps = {
87
102
  ref: (textarea) => {this.bodyTextArea = textarea},
88
103
  id: `add-comment-${commentableType}-${commentableId}`,
89
104
  rows: "4",
105
+ maxLength,
106
+ required: "required",
107
+ pattern: `^(.){0,${maxLength}}$`,
90
108
  placeholder: I18n.t("components.add_comment_form.form.body.placeholder"),
91
109
  onChange: (evt) => this._checkCommentBody(evt.target.value)
92
110
  };
@@ -107,7 +125,7 @@ export class AddCommentForm extends Component {
107
125
  _renderOpinionButtons() {
108
126
  const { arguable } = this.props;
109
127
  const { alignment } = this.state;
110
- const buttonClassName = classnames('button', 'small', 'button--muted');
128
+ const buttonClassName = classnames('button', 'tiny', 'button--muted');
111
129
  const okButtonClassName = classnames(buttonClassName, 'opinion-toggle--ok', {
112
130
  'is-active': alignment === 1
113
131
  });
@@ -126,7 +144,6 @@ export class AddCommentForm extends Component {
126
144
  onClick={() => this.setState({ alignment: 1 })}
127
145
  >
128
146
  <Icon name="icon-thumb-up" />
129
- { I18n.t("components.add_comment_form.opinion.in_favor") }
130
147
  </button>
131
148
  <button
132
149
  className={neutralButtonClassName}
@@ -139,7 +156,6 @@ export class AddCommentForm extends Component {
139
156
  onClick={() => this.setState({ alignment: -1 })}
140
157
  >
141
158
  <Icon name="icon-thumb-down" />
142
- { I18n.t("components.add_comment_form.opinion.against") }
143
159
  </button>
144
160
  </div>
145
161
  );
@@ -220,11 +236,6 @@ export class AddCommentForm extends Component {
220
236
  }
221
237
  }
222
238
 
223
- AddCommentForm.defaultProps = {
224
- showTitle: true,
225
- submitButtonClassName: 'button button--sc'
226
- };
227
-
228
239
  AddCommentForm.propTypes = {
229
240
  addComment: PropTypes.func.isRequired,
230
241
  session: PropTypes.shape({
@@ -243,7 +254,17 @@ AddCommentForm.propTypes = {
243
254
  submitButtonClassName: PropTypes.string.isRequired,
244
255
  onCommentAdded: PropTypes.func,
245
256
  arguable: PropTypes.bool,
246
- autoFocus: PropTypes.bool
257
+ autoFocus: PropTypes.bool,
258
+ maxLength: PropTypes.number.isRequired
259
+ };
260
+
261
+ AddCommentForm.defaultProps = {
262
+ onCommentAdded: function() {},
263
+ showTitle: true,
264
+ submitButtonClassName: 'button button--sc',
265
+ arguable: false,
266
+ autoFocus: false,
267
+ maxLength: 1000
247
268
  };
248
269
 
249
270
  AddCommentForm.fragments = {
@@ -51,6 +51,12 @@ describe("<AddCommentForm />", () => {
51
51
  expect(wrapper).to.have.prop('submitButtonClassName').equal('button button--sc');
52
52
  });
53
53
 
54
+ it("should have a default prop maxLength of 1000", () => {
55
+ const wrapper = mount(<AddCommentForm addComment={addCommentStub} session={session} commentableId={commentableId} commentableType={commentableType} />);
56
+ expect(wrapper).to.have.prop('maxLength').equal(1000);
57
+ });
58
+
59
+
54
60
  it("should use prop submitButtonClassName as a className prop for submit button", () => {
55
61
  const wrapper = shallow(<AddCommentForm addComment={addCommentStub} session={session} commentableId={commentableId} commentableType={commentableType} submitButtonClassName="button small hollow" />);
56
62
  expect(wrapper.find('input[type="submit"]')).to.have.className('button');
@@ -241,11 +241,6 @@ Comment.fragments = {
241
241
  `
242
242
  };
243
243
 
244
- Comment.defaultProps = {
245
- articleClassName: 'comment',
246
- isRootComment: false
247
- };
248
-
249
244
  Comment.propTypes = {
250
245
  comment: PropTypes.oneOfType([
251
246
  propType(Comment.fragments.comment).isRequired,
@@ -259,4 +254,11 @@ Comment.propTypes = {
259
254
  votable: PropTypes.bool
260
255
  };
261
256
 
257
+ Comment.defaultProps = {
258
+ articleClassName: 'comment',
259
+ isRootComment: false,
260
+ session: null,
261
+ votable: false
262
+ };
263
+
262
264
  export default Comment;
@@ -44,7 +44,7 @@ class CommentOrderSelector extends Component {
44
44
  <a href="" onClick={(event) => this._updateOrder(event, "older")} >
45
45
  { I18n.t("components.comment_order_selector.order.older") }
46
46
  </a>
47
- </li>
47
+ </li>
48
48
  <li>
49
49
  <a href="" onClick={(event) => this._updateOrder(event, "most_discussed")} >
50
50
  { I18n.t("components.comment_order_selector.order.most_discussed") }
@@ -57,7 +57,7 @@ class CommentOrderSelector extends Component {
57
57
  );
58
58
  }
59
59
 
60
- _updateOrder(event, orderBy) {
60
+ _updateOrder(event, orderBy) {
61
61
  event.preventDefault();
62
62
  this.setState({ orderBy });
63
63
  this.props.reorderComments(orderBy);
@@ -67,4 +67,9 @@ CommentThread.propTypes = {
67
67
  votable: PropTypes.bool
68
68
  };
69
69
 
70
+ CommentThread.defaultProps = {
71
+ session: null,
72
+ votable: false
73
+ };
74
+
70
75
  export default CommentThread;
@@ -107,6 +107,13 @@ Comments.propTypes = {
107
107
  reorderComments: PropTypes.func.isRequired
108
108
  };
109
109
 
110
+ Comments.defaultProps = {
111
+ loading: false,
112
+ comments: null,
113
+ session: null,
114
+ commentableId: null
115
+ };
116
+
110
117
  /**
111
118
  * Wrap the Comments component with a GraphQL query and children
112
119
  * fragments.
@@ -166,4 +173,8 @@ CommentsApplication.propTypes = {
166
173
  }).isRequired
167
174
  };
168
175
 
176
+ CommentsApplication.defaultProps = {
177
+ commentableId: null
178
+ };
179
+
169
180
  export default CommentsApplication;
@@ -24,4 +24,9 @@ VoteButton.propTypes = {
24
24
  disabled: PropTypes.bool
25
25
  };
26
26
 
27
+ VoteButton.defaultProps = {
28
+ selectedClass: "selected",
29
+ disabled: false
30
+ };
31
+
27
32
  export default VoteButton;
@@ -12,7 +12,7 @@ describe("<VoteButton />", () => {
12
12
 
13
13
  it("should render the number of votes passed as a prop", () => {
14
14
  const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} />);
15
- expect(wrapper.find('button')).to.include.text(10);
15
+ expect(wrapper.find('button').text()).to.match(/10/);
16
16
  });
17
17
 
18
18
  it("should render a button with the given buttonClassName", () => {