decidim 0.3.2 → 0.4.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 (198) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/Gemfile.lock +49 -55
  4. data/README.md +2 -1
  5. data/Rakefile +4 -4
  6. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_label-required.scss +3 -0
  7. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_title_bar.scss +57 -1
  8. data/decidim-admin/app/commands/decidim/admin/create_participatory_process_admin.rb +28 -7
  9. data/decidim-admin/app/commands/decidim/admin/create_participatory_process_step.rb +2 -1
  10. data/decidim-admin/app/commands/decidim/admin/destroy_participatory_process_step.rb +5 -2
  11. data/decidim-admin/app/commands/decidim/admin/update_feature.rb +1 -0
  12. data/decidim-admin/app/commands/decidim/admin/update_organization.rb +10 -5
  13. data/decidim-admin/app/commands/decidim/admin/update_participatory_process.rb +4 -2
  14. data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +2 -0
  15. data/decidim-admin/app/controllers/decidim/admin/concerns/has_attachments.rb +10 -1
  16. data/decidim-admin/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +0 -5
  17. data/decidim-admin/app/controllers/decidim/admin/features/base_controller.rb +0 -1
  18. data/decidim-admin/app/controllers/decidim/admin/moderations_controller.rb +7 -4
  19. data/decidim-admin/app/controllers/decidim/admin/organization_controller.rb +9 -3
  20. data/decidim-admin/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +17 -0
  21. data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +11 -3
  22. data/decidim-admin/app/forms/decidim/admin/feature_form.rb +6 -0
  23. data/decidim-admin/app/forms/decidim/admin/organization_form.rb +5 -0
  24. data/decidim-admin/app/forms/decidim/admin/participatory_process_copy_form.rb +2 -3
  25. data/decidim-admin/app/forms/decidim/admin/participatory_process_form.rb +2 -0
  26. data/decidim-admin/app/forms/decidim/admin/static_page_form.rb +6 -0
  27. data/decidim-admin/app/helpers/decidim/admin/menu_helper.rb +1 -1
  28. data/decidim-admin/app/jobs/decidim/admin/newsletter_job.rb +9 -5
  29. data/decidim-admin/app/views/decidim/admin/attachments/_form.html.erb +1 -12
  30. data/decidim-admin/app/views/decidim/admin/features/_feature.html.erb +2 -2
  31. data/decidim-admin/app/views/decidim/admin/features/_form.html.erb +18 -0
  32. data/decidim-admin/app/views/decidim/admin/moderations/_report.html.erb +2 -2
  33. data/decidim-admin/app/views/decidim/admin/organization/_form.html.erb +5 -35
  34. data/decidim-admin/app/views/decidim/admin/participatory_process_groups/_form.html.erb +1 -1
  35. data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +16 -0
  36. data/decidim-admin/app/views/decidim/admin/participatory_processes/_form.html.erb +2 -14
  37. data/decidim-admin/app/views/layouts/decidim/admin/_title_bar.html.erb +26 -19
  38. data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +2 -2
  39. data/decidim-admin/bin/rails +2 -2
  40. data/decidim-admin/config/i18n-tasks.yml +2 -0
  41. data/decidim-admin/config/locales/ca.yml +9 -5
  42. data/decidim-admin/config/locales/en.yml +9 -5
  43. data/decidim-admin/config/locales/es.yml +11 -5
  44. data/decidim-admin/config/locales/eu.yml +0 -5
  45. data/decidim-admin/config/locales/fr.yml +18 -23
  46. data/decidim-admin/config/locales/it.yml +0 -5
  47. data/decidim-admin/config/routes.rb +5 -3
  48. data/decidim-admin/decidim-admin.gemspec +2 -2
  49. data/decidim-admin/lib/decidim/admin/test/manage_attachments_examples.rb +1 -2
  50. data/decidim-admin/spec/commands/create_participatory_process_admin_spec.rb +42 -26
  51. data/decidim-admin/spec/commands/create_participatory_process_spec.rb +2 -1
  52. data/decidim-admin/spec/commands/create_participatory_process_step_spec.rb +56 -0
  53. data/decidim-admin/spec/commands/destroy_participatory_process_step_spec.rb +2 -2
  54. data/decidim-admin/spec/commands/update_feature_spec.rb +6 -0
  55. data/decidim-admin/spec/controllers/participatory_processes_controller_spec.rb +3 -6
  56. data/decidim-admin/spec/features/admin_copy_participatory_process_spec.rb +9 -9
  57. data/decidim-admin/spec/features/admin_manages_features_spec.rb +32 -0
  58. data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +3 -4
  59. data/decidim-admin/spec/forms/static_page_form_spec.rb +12 -0
  60. data/decidim-admin/spec/jobs/newsletter_job_spec.rb +3 -0
  61. data/decidim-admin/spec/shared/manage_process_admins_examples.rb +22 -0
  62. data/decidim-admin/spec/shared/manage_processes_examples.rb +6 -0
  63. data/decidim-admin/spec/spec_helper.rb +4 -0
  64. data/decidim-api/bin/rails +2 -2
  65. data/decidim-api/decidim-api.gemspec +3 -3
  66. data/decidim-api/spec/spec_helper.rb +4 -0
  67. data/decidim-api/spec/types/query_type_spec.rb +2 -2
  68. data/decidim-budgets/app/models/decidim/budgets/project.rb +5 -0
  69. data/decidim-budgets/bin/rails +2 -2
  70. data/decidim-budgets/config/locales/fr.yml +2 -2
  71. data/decidim-budgets/decidim-budgets.gemspec +2 -2
  72. data/decidim-budgets/lib/decidim/budgets/feature.rb +1 -1
  73. data/decidim-budgets/spec/spec_helper.rb +4 -0
  74. data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
  75. data/decidim-comments/app/commands/decidim/comments/create_comment.rb +10 -14
  76. data/decidim-comments/app/frontend/application/application.component.tsx +1 -1
  77. data/decidim-comments/app/frontend/comments/add_comment_form.component.test.tsx +33 -26
  78. data/decidim-comments/app/frontend/comments/add_comment_form.component.tsx +109 -83
  79. data/decidim-comments/app/frontend/comments/comment.component.test.tsx +29 -24
  80. data/decidim-comments/app/frontend/comments/comment.component.tsx +12 -5
  81. data/decidim-comments/app/frontend/comments/comment_thread.component.test.tsx +12 -7
  82. data/decidim-comments/app/frontend/comments/comment_thread.component.tsx +7 -2
  83. data/decidim-comments/app/frontend/comments/comments.component.tsx +26 -15
  84. data/decidim-comments/app/frontend/comments/down_vote_button.component.test.tsx +9 -4
  85. data/decidim-comments/app/frontend/comments/down_vote_button.component.tsx +56 -37
  86. data/decidim-comments/app/frontend/comments/up_vote_button.component.test.tsx +9 -4
  87. data/decidim-comments/app/frontend/comments/up_vote_button.component.tsx +31 -16
  88. data/decidim-comments/app/frontend/comments/vote_button.component.tsx +3 -0
  89. data/decidim-comments/app/mailers/decidim/comments/comment_notification_mailer.rb +8 -6
  90. data/decidim-comments/app/models/decidim/comments/comment.rb +13 -1
  91. data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/comment_created.html.erb +1 -1
  92. data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/reply_created.html.erb +1 -1
  93. data/decidim-comments/bin/rails +2 -2
  94. data/decidim-comments/config/locales/ca.yml +2 -0
  95. data/decidim-comments/config/locales/en.yml +2 -0
  96. data/decidim-comments/config/locales/es.yml +2 -0
  97. data/decidim-comments/config/locales/fr.yml +2 -2
  98. data/decidim-comments/decidim-comments.gemspec +3 -3
  99. data/decidim-comments/lib/decidim/comments/commentable.rb +1 -0
  100. data/decidim-comments/spec/commands/create_comment_spec.rb +22 -54
  101. data/decidim-comments/spec/features/notifications_spec.rb +2 -6
  102. data/decidim-comments/spec/mailers/comment_notification_mailer_spec.rb +5 -4
  103. data/decidim-comments/spec/models/comment_spec.rb +32 -2
  104. data/decidim-comments/spec/shared/author_localised_email.rb +2 -3
  105. data/decidim-comments/spec/spec_helper.rb +4 -0
  106. data/decidim-dev/decidim-dev.gemspec +3 -4
  107. data/decidim-dev/lib/decidim/dev.rb +23 -1
  108. data/decidim-dev/lib/decidim/dev/common_rake.rb +3 -0
  109. data/decidim-dev/lib/decidim/dev/railtie.rb +3 -3
  110. data/decidim-dev/lib/decidim/dev/test/base_spec_helper.rb +4 -3
  111. data/decidim-dev/lib/decidim/dev/test/rspec_support/capybara.rb +3 -0
  112. data/decidim-dev/lib/decidim/dev/test/rspec_support/feature.rb +8 -0
  113. data/decidim-dev/lib/decidim/dev/test/rspec_support/feature_context.rb +4 -2
  114. data/decidim-dev/lib/decidim/dev/test/rspec_support/geocoder.rb +7 -2
  115. data/decidim-dev/lib/decidim/dev/test/rspec_support/phantomjs_polyfills/phantomjs-getOwnPropertyNames.js +16 -0
  116. data/decidim-dev/lib/decidim/dev/test/rspec_support/warden.rb +17 -1
  117. data/decidim-meetings/app/helpers/decidim/meetings/application_helper.rb +1 -0
  118. data/decidim-meetings/app/helpers/decidim/meetings/meetings_helper.rb +24 -0
  119. data/decidim-meetings/app/views/decidim/meetings/meetings/_meetings.html.erb +1 -1
  120. data/decidim-meetings/bin/rails +2 -2
  121. data/decidim-meetings/config/locales/ca.yml +1 -0
  122. data/decidim-meetings/config/locales/en.yml +2 -1
  123. data/decidim-meetings/config/locales/es.yml +1 -0
  124. data/decidim-meetings/config/locales/fr.yml +5 -5
  125. data/decidim-meetings/decidim-meetings.gemspec +2 -2
  126. data/decidim-meetings/lib/decidim/meetings/feature.rb +1 -1
  127. data/decidim-meetings/spec/features/admin_manages_meetings_attachments_spec.rb +1 -1
  128. data/decidim-meetings/spec/features/admin_manages_meetings_spec.rb +1 -1
  129. data/decidim-meetings/spec/features/explore_meetings_spec.rb +1 -1
  130. data/decidim-meetings/spec/features/process_admin_manages_meetings_attachments_spec.rb +1 -1
  131. data/decidim-meetings/spec/features/process_admin_manages_meetings_spec.rb +1 -1
  132. data/decidim-meetings/spec/helpers/meetings_helper_spec.rb +16 -0
  133. data/decidim-meetings/spec/spec_helper.rb +4 -0
  134. data/decidim-pages/app/models/decidim/pages/page.rb +5 -0
  135. data/decidim-pages/bin/rails +2 -2
  136. data/decidim-pages/decidim-pages.gemspec +2 -2
  137. data/decidim-pages/lib/decidim/pages/feature.rb +1 -1
  138. data/decidim-pages/spec/commands/destroy_page_spec.rb +1 -1
  139. data/decidim-pages/spec/spec_helper.rb +4 -0
  140. data/decidim-proposals/app/assets/config/decidim_proposals_manifest.js +1 -0
  141. data/decidim-proposals/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +23 -0
  142. data/decidim-proposals/app/forms/decidim/proposals/proposal_form.rb +7 -1
  143. data/decidim-proposals/app/models/decidim/proposals/proposal.rb +14 -2
  144. data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal.html.erb +1 -0
  145. data/decidim-proposals/app/views/decidim/proposals/proposals/new.html.erb +5 -0
  146. data/decidim-proposals/bin/rails +2 -2
  147. data/decidim-proposals/config/locales/fr.yml +11 -11
  148. data/decidim-proposals/db/migrate/20170307085300_migrate_proposal_reports_data_to_reports.rb +1 -1
  149. data/decidim-proposals/decidim-proposals.gemspec +2 -2
  150. data/decidim-proposals/lib/decidim/proposals/feature.rb +1 -1
  151. data/decidim-proposals/spec/features/proposals_spec.rb +8 -2
  152. data/decidim-proposals/spec/models/decidim/proposals/proposal_spec.rb +35 -0
  153. data/decidim-proposals/spec/shared/create_proposal_examples.rb +20 -14
  154. data/decidim-proposals/spec/shared/manage_proposals_examples.rb +13 -16
  155. data/decidim-proposals/spec/shared/proposal_form_examples.rb +22 -16
  156. data/decidim-proposals/spec/spec_helper.rb +4 -0
  157. data/decidim-results/app/models/decidim/results/result.rb +10 -0
  158. data/decidim-results/bin/rails +2 -2
  159. data/decidim-results/config/locales/fr.yml +2 -2
  160. data/decidim-results/decidim-results.gemspec +2 -2
  161. data/decidim-results/lib/decidim/results/feature.rb +1 -1
  162. data/decidim-results/spec/features/comments_spec.rb +10 -0
  163. data/decidim-results/spec/spec_helper.rb +4 -0
  164. data/decidim-surveys/app/models/decidim/surveys/survey_question.rb +2 -0
  165. data/decidim-surveys/bin/rails +2 -2
  166. data/decidim-surveys/decidim-surveys.gemspec +2 -2
  167. data/decidim-surveys/lib/decidim/surveys/feature.rb +3 -2
  168. data/decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb +1 -1
  169. data/decidim-surveys/spec/models/decidim/surveys/survey_question_spec.rb +7 -1
  170. data/decidim-surveys/spec/spec_helper.rb +5 -0
  171. data/decidim-system/app/controllers/decidim/system/application_controller.rb +1 -1
  172. data/decidim-system/app/controllers/decidim/system/devise/sessions_controller.rb +1 -0
  173. data/decidim-system/app/helpers/decidim/system/menu_helper.rb +1 -1
  174. data/decidim-system/app/views/decidim/system/shared/_notices.html.erb +11 -0
  175. data/decidim-system/app/views/layouts/decidim/system/application.html.erb +1 -1
  176. data/decidim-system/app/views/layouts/decidim/system/login.html.erb +1 -1
  177. data/decidim-system/bin/rails +2 -2
  178. data/decidim-system/config/locales/ca.yml +4 -0
  179. data/decidim-system/config/locales/en.yml +4 -0
  180. data/decidim-system/config/locales/es.yml +4 -0
  181. data/decidim-system/db/migrate/20160919105637_devise_create_decidim_admins.rb +5 -5
  182. data/decidim-system/db/seeds.rb +1 -1
  183. data/decidim-system/decidim-system.gemspec +2 -2
  184. data/decidim-system/spec/factories.rb +2 -2
  185. data/decidim-system/spec/features/manage_admins_spec.rb +3 -3
  186. data/decidim-system/spec/spec_helper.rb +4 -0
  187. data/decidim.gemspec +6 -6
  188. data/docs/how_to_create_a_plugin.md +2 -2
  189. data/lib/generators/decidim/app_generator.rb +1 -1
  190. data/lib/generators/decidim/install_generator.rb +35 -27
  191. data/lib/generators/decidim/templates/Gemfile.erb +1 -0
  192. data/lib/generators/decidim/templates/initializer.rb +7 -1
  193. data/logo.svg +62 -0
  194. data/package.json +37 -35
  195. data/tsconfig.json +3 -0
  196. data/yarn.lock +1017 -486
  197. metadata +32 -25
  198. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_language-chooser.scss +0 -4
@@ -90,6 +90,7 @@ es:
90
90
  map: Mapa
91
91
  start_time: Fecha de inicio
92
92
  title: Título
93
+ read_more: "(leer más)"
93
94
  resource_links:
94
95
  meetings_through_proposals:
95
96
  meeting_results: 'Resultados relacionados:'
@@ -10,7 +10,7 @@ fr:
10
10
  meeting:
11
11
  address: Adresse
12
12
  decidim_category_id: Catégorie
13
- decidim_scope_id: Domaine d'application
13
+ decidim_scope_id: Zone d'application
14
14
  description: Description
15
15
  end_time: Heure de fin
16
16
  location: Lieu
@@ -24,7 +24,7 @@ fr:
24
24
  meetings:
25
25
  actions:
26
26
  attachments: Documents liés
27
- close: Fermer
27
+ close: Clore
28
28
  confirm_destroy: Êtes-vous sûr de vouloir supprimer cette rencontre?
29
29
  destroy: Supprimer
30
30
  edit: Modifier
@@ -34,7 +34,7 @@ fr:
34
34
  admin:
35
35
  meeting_closes:
36
36
  edit:
37
- close: Fermer
37
+ close: Clore
38
38
  title: Clore la rencontre
39
39
  meetings:
40
40
  close:
@@ -64,7 +64,7 @@ fr:
64
64
  category_prompt: Sélectionner une catégorie
65
65
  date: Date
66
66
  past: Passées
67
- scopes: Domaines d'application
67
+ scopes: Zone d'application
68
68
  search: Rechercher
69
69
  upcoming: À venir
70
70
  filters_small_view:
@@ -95,5 +95,5 @@ fr:
95
95
  meeting_results: 'Résultats associés :'
96
96
  result_meetings: 'Rencontres connexes :'
97
97
  proposals_from_meeting:
98
- meeting_proposals: 'Propositions connexes :'
98
+ meeting_proposals: 'Propositions créées à cette rencontre :'
99
99
  proposal_meetings: 'Rencontre connexes :'
@@ -9,8 +9,8 @@ require_relative "../decidim-core/lib/decidim/core/version"
9
9
  Gem::Specification.new do |s|
10
10
  Decidim.add_default_gemspec_properties(s)
11
11
 
12
- s.name = "decidim-meetings"
13
- s.summary = "A meetings component for decidim's participatory processes."
12
+ s.name = "decidim-meetings"
13
+ s.summary = "A meetings component for decidim's participatory processes."
14
14
  s.description = s.summary
15
15
 
16
16
  s.files = Dir["{app,config,db,lib}/**/*", "Rakefile", "README.md"]
@@ -24,7 +24,7 @@ Decidim.register_feature(:meetings) do |feature|
24
24
  end
25
25
 
26
26
  feature.seeds do
27
- Decidim::ParticipatoryProcess.all.each do |process|
27
+ Decidim::ParticipatoryProcess.find_each do |process|
28
28
  next unless process.steps.any?
29
29
 
30
30
  feature = Decidim::Feature.create!(
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- describe "Admin manages meetings attachments", type: :feature do
5
+ describe "Admin manages meetings attachments", type: :feature, serves_map: true do
6
6
  let(:manifest_name) { "meetings" }
7
7
  let!(:meeting) { create :meeting, scope: scope, feature: current_feature }
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- describe "Admin manages meetings", type: :feature do
5
+ describe "Admin manages meetings", type: :feature, serves_map: true do
6
6
  let(:manifest_name) { "meetings" }
7
7
  let!(:meeting) { create :meeting, scope: scope, feature: current_feature }
8
8
 
@@ -101,7 +101,7 @@ describe "Explore meetings", type: :feature do
101
101
  end
102
102
  end
103
103
 
104
- context "show" do
104
+ context "show", :serves_map do
105
105
  let(:meetings_count) { 1 }
106
106
  let(:meeting) { meetings.first }
107
107
  let(:date) { 10.days.from_now }
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- describe "Process admin manages meetings attachments", type: :feature do
5
+ describe "Process admin manages meetings attachments", type: :feature, serves_map: true do
6
6
  let(:manifest_name) { "meetings" }
7
7
  let!(:meeting) { create :meeting, scope: scope, feature: current_feature }
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- describe "Process admin manages meetings", type: :feature do
5
+ describe "Process admin manages meetings", type: :feature, serves_map: true do
6
6
  let(:manifest_name) { "meetings" }
7
7
  let!(:meeting) { create :meeting, scope: scope, feature: current_feature }
8
8
 
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ module Decidim
6
+ module Meetings
7
+ describe MeetingsHelper do
8
+ describe "meeting_description" do
9
+ it "truncates meeting description respecting the html tags" do
10
+ meeting = create(:meeting, description: { "en" => "<p>This is a long description with some <b>bold text</b></p>" })
11
+ expect(helper.meeting_description(meeting, 40)).to match("<p>This is a long description with some <b>bol</b>...")
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,5 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "decidim/dev"
4
+
3
5
  ENV["ENGINE_NAME"] = File.dirname(__dir__).split("/").last
4
6
 
7
+ Decidim::Dev.dummy_app_path = File.expand_path(File.join("..", "spec", "decidim_dummy_app"))
8
+
5
9
  require "decidim/dev/test/base_spec_helper"
@@ -35,6 +35,11 @@ module Decidim
35
35
  def comments_have_votes?
36
36
  true
37
37
  end
38
+
39
+ # Public: Overrides the `notifiable?` Notifiable concern method.
40
+ def notifiable?(_context)
41
+ false
42
+ end
38
43
  end
39
44
  end
40
45
  end
@@ -8,8 +8,8 @@ ENGINE_ROOT = File.expand_path("..", __dir__)
8
8
  ENGINE_PATH = File.expand_path("../lib/decidim/pages/engine", __dir__)
9
9
 
10
10
  # Set up gems listed in the Gemfile.
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
- require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __dir__)
12
+ require "bundler/setup"
13
13
 
14
14
  require "rails/all"
15
15
  require "rails/engine/commands"
@@ -9,8 +9,8 @@ require_relative "../decidim-core/lib/decidim/core/version"
9
9
  Gem::Specification.new do |s|
10
10
  Decidim.add_default_gemspec_properties(s)
11
11
 
12
- s.name = "decidim-pages"
13
- s.summary = "A pages component for decidim's participatory processes."
12
+ s.name = "decidim-pages"
13
+ s.summary = "A pages component for decidim's participatory processes."
14
14
  s.description = s.summary
15
15
 
16
16
  s.files = Dir["{app,config,db,lib}/**/*", "Rakefile", "README.md"]
@@ -45,7 +45,7 @@ Decidim.register_feature(:pages) do |feature|
45
45
  end
46
46
 
47
47
  feature.seeds do
48
- Decidim::ParticipatoryProcess.all.each do |process|
48
+ Decidim::ParticipatoryProcess.find_each do |process|
49
49
  next unless process.steps.any?
50
50
 
51
51
  feature = Decidim::Feature.create!(
@@ -7,7 +7,7 @@ module Decidim
7
7
  describe DestroyPage, :db do
8
8
  describe "call" do
9
9
  let(:feature) { create(:feature, manifest_name: "pages") }
10
- let!(:page) { create(:page, feature: feature) }
10
+ let!(:page) { create(:page, feature: feature) }
11
11
  let(:command) { described_class.new(feature) }
12
12
 
13
13
  it "broadcasts ok" do
@@ -1,5 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "decidim/dev"
4
+
3
5
  ENV["ENGINE_NAME"] = File.dirname(__dir__).split("/").last
4
6
 
7
+ Decidim::Dev.dummy_app_path = File.expand_path(File.join("..", "spec", "decidim_dummy_app"))
8
+
5
9
  require "decidim/dev/test/base_spec_helper"
@@ -1 +1,2 @@
1
1
  //= link decidim/proposals/social_share.js
2
+ //= link decidim/proposals/add_proposal.js
@@ -0,0 +1,23 @@
1
+ $(() => {
2
+ window.DecidimProposals = window.DecidimProposals || {};
3
+
4
+ window.DecidimProposals.bindProposalAddress = () => {
5
+ const $checkbox = $('#proposal_has_address');
6
+ const $addressInput = $('#address_input');
7
+
8
+ if ($checkbox.length > 0) {
9
+ const toggleInput = () => {
10
+ if ($checkbox[0].checked) {
11
+ $addressInput.show();
12
+ } else {
13
+ $addressInput.hide();
14
+ }
15
+ }
16
+ toggleInput();
17
+ $checkbox.on('change', toggleInput);
18
+ }
19
+ };
20
+
21
+ window.DecidimProposals.bindProposalAddress();
22
+ });
23
+
@@ -14,11 +14,13 @@ module Decidim
14
14
  attribute :category_id, Integer
15
15
  attribute :scope_id, Integer
16
16
  attribute :user_group_id, Integer
17
+ attribute :has_address, Boolean
17
18
 
18
19
  validates :title, :body, presence: true, etiquette: true
19
20
  validates :title, length: { maximum: 150 }
20
21
  validates :body, length: { maximum: 500 }, etiquette: true
21
- validates :address, geocoding: true, if: -> { current_feature.settings.geocoding_enabled? }
22
+ validates :address, geocoding: true, if: ->(form) { Decidim.geocoder.present? && form.has_address? }
23
+ validates :address, presence: true, if: ->(form) { form.has_address? }
22
24
  validates :category, presence: true, if: ->(form) { form.category_id.present? }
23
25
  validates :scope, presence: true, if: ->(form) { form.scope_id.present? }
24
26
 
@@ -47,6 +49,10 @@ module Decidim
47
49
  def scope
48
50
  @scope ||= process_scope || organization_scopes.where(id: scope_id).first
49
51
  end
52
+
53
+ def has_address?
54
+ current_feature.settings.geocoding_enabled? && has_address
55
+ end
50
56
  end
51
57
  end
52
58
  end
@@ -21,8 +21,8 @@ module Decidim
21
21
 
22
22
  geocoded_by :address, http_headers: ->(proposal) { { "Referer" => proposal.feature.organization.host } }
23
23
 
24
- scope :accepted, -> { where(state: "accepted") }
25
- scope :rejected, -> { where(state: "rejected") }
24
+ scope :accepted, -> { where(state: "accepted") }
25
+ scope :rejected, -> { where(state: "rejected") }
26
26
 
27
27
  def self.order_randomly(seed)
28
28
  transaction do
@@ -91,6 +91,18 @@ module Decidim
91
91
  def reported_content_url
92
92
  ResourceLocatorPresenter.new(self).url
93
93
  end
94
+
95
+ # Public: Overrides the `notifiable?` Notifiable concern method.
96
+ # When a proposal is commented the proposal's author is notified if it is not the same
97
+ # who has commented the proposal and if the proposal's author has comment notifications enabled.
98
+ def notifiable?(context)
99
+ context[:author] != author && author.comments_notifications?
100
+ end
101
+
102
+ # Public: Overrides the `users_to_notify` Notifiable concern method.
103
+ def users_to_notify
104
+ [author]
105
+ end
94
106
  end
95
107
  end
96
108
  end
@@ -8,6 +8,7 @@
8
8
  <div class="card__author author-data author-data--small">
9
9
  <%= render partial: "author", locals: { proposal: proposal } %>
10
10
  </div>
11
+ <%= feature_reference(proposal, class: "reference--text-left") %>
11
12
  </div>
12
13
  <%= render partial: "proposal_badge", locals: { proposal: proposal } %>
13
14
  <p><%= truncate(proposal.body, length: 100) %></p>
@@ -20,6 +20,9 @@
20
20
 
21
21
  <% if feature_settings.geocoding_enabled? %>
22
22
  <div class="field">
23
+ <%= form.check_box :has_address %>
24
+ </div>
25
+ <div class="field" id="address_input">
23
26
  <%= form.text_field :address %>
24
27
  </div>
25
28
  <% end %>
@@ -50,3 +53,5 @@
50
53
  </div>
51
54
  </div>
52
55
  </div>
56
+
57
+ <%= javascript_include_tag "decidim/proposals/add_proposal" %>
@@ -8,8 +8,8 @@ ENGINE_ROOT = File.expand_path("..", __dir__)
8
8
  ENGINE_PATH = File.expand_path("../lib/decidim/proposals/engine", __dir__)
9
9
 
10
10
  # Set up gems listed in the Gemfile.
11
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
- require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __dir__)
12
+ require "bundler/setup"
13
13
 
14
14
  require "rails/all"
15
15
  require "rails/engine/commands"
@@ -4,7 +4,7 @@ fr:
4
4
  proposal:
5
5
  body: Corps de texte
6
6
  category_id: Catégorie
7
- scope_id: Domaine d'application
7
+ scope_id: Zone d'application
8
8
  title: Titre
9
9
  user_group_id: Créer une proposition en tant que
10
10
  proposal_answer:
@@ -21,12 +21,12 @@ fr:
21
21
  comments_enabled: Commentaires activés
22
22
  geocoding_enabled: Géocodage activé
23
23
  official_proposals_enabled: Propositions officielles activées
24
- proposal_answering_enabled: Réponse aux propositions activée
24
+ proposal_answering_enabled: '"Réponses aux propositions" activé'
25
25
  vote_limit: Limite de vote
26
26
  step:
27
27
  comments_blocked: Commentaires bloqués
28
28
  creation_enabled: Module propositions activé
29
- proposal_answering_enabled: Réponse aux propositions activée
29
+ proposal_answering_enabled: '"Réponses aux propositions" activé'
30
30
  votes_blocked: Votes bloqués
31
31
  votes_enabled: Votes activés
32
32
  votes_hidden: Cacher les votes (si les votes sont activés, le compte des votes sera caché)
@@ -43,7 +43,7 @@ fr:
43
43
  name: Proposition
44
44
  proposal_answers:
45
45
  edit:
46
- accepted: Publié
46
+ accepted: Retenue
47
47
  answer_proposal: Répondre
48
48
  rejected: Refusée
49
49
  title: Réponse à la proposition %{title}
@@ -62,7 +62,7 @@ fr:
62
62
  create: Créer
63
63
  title: Créer une proposition
64
64
  answers:
65
- accepted: Publié
65
+ accepted: Retenues
66
66
  not_answered: Resté sans réponse
67
67
  rejected: Refusée
68
68
  create:
@@ -73,7 +73,7 @@ fr:
73
73
  fields:
74
74
  category: Catégorie
75
75
  official_proposal: Proposition officielle
76
- scope: Domaine d'application
76
+ scope: Zone d'application
77
77
  state: Etat
78
78
  title: Titre
79
79
  proposals:
@@ -82,7 +82,7 @@ fr:
82
82
  one: 1 proposition
83
83
  other: "%{count} propositions"
84
84
  filters:
85
- accepted: Publié
85
+ accepted: Retenues
86
86
  activity: Activité
87
87
  all: Toutes
88
88
  category: Catégorie
@@ -92,10 +92,10 @@ fr:
92
92
  origin: Retour à l'original
93
93
  rejected: Refusée
94
94
  related_to: Liée à
95
- scopes: Domaines d'application
95
+ scopes: Zones d'application
96
96
  search: Rechercher
97
97
  state: État
98
- voted: Voté
98
+ voted: Votées
99
99
  filters_small_view:
100
100
  close_modal: Fermer la fenêtre de dialogue
101
101
  filter: Filtrer
@@ -111,7 +111,7 @@ fr:
111
111
  new:
112
112
  back: Retour
113
113
  select_a_category: Veuillez sélectionner une catégorie
114
- send: Envoyer
114
+ send: Publier
115
115
  title: Nouvelle proposition
116
116
  orders:
117
117
  label: 'Classement des propositions par:'
@@ -119,7 +119,7 @@ fr:
119
119
  random: Aléatoire
120
120
  recent: Les plus récents
121
121
  show:
122
- proposal_accepted_reason: 'Cette proposition a été acceptée parce que :'
122
+ proposal_accepted_reason: 'Cette proposition a été retenue parce que :'
123
123
  proposal_rejected_reason: 'Cette proposition a été refusée parce que:'
124
124
  report: Signaler
125
125
  vote_button:
@@ -7,7 +7,7 @@ class MigrateProposalReportsDataToReports < ActiveRecord::Migration[5.0]
7
7
  end
8
8
 
9
9
  def change
10
- Decidim::Proposals::ProposalReport.all.each do |proposal_report|
10
+ Decidim::Proposals::ProposalReport.find_each do |proposal_report|
11
11
  moderation = Decidim::Moderation.find_or_create_by!(reportable: proposal_report.proposal,
12
12
  participatory_process: proposal_report.proposal.feature.participatory_process)
13
13
  Decidim::Report.create!(moderation: moderation,
@@ -9,8 +9,8 @@ require_relative "../decidim-core/lib/decidim/core/version"
9
9
  Gem::Specification.new do |s|
10
10
  Decidim.add_default_gemspec_properties(s)
11
11
 
12
- s.name = "decidim-proposals"
13
- s.summary = "A proposals component for decidim's participatory processes."
12
+ s.name = "decidim-proposals"
13
+ s.summary = "A proposals component for decidim's participatory processes."
14
14
  s.description = s.summary
15
15
 
16
16
  s.files = Dir["{app,config,db,lib}/**/*", "Rakefile", "README.md"]