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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile.lock +49 -55
- data/README.md +2 -1
- data/Rakefile +4 -4
- data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_label-required.scss +3 -0
- data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_title_bar.scss +57 -1
- data/decidim-admin/app/commands/decidim/admin/create_participatory_process_admin.rb +28 -7
- data/decidim-admin/app/commands/decidim/admin/create_participatory_process_step.rb +2 -1
- data/decidim-admin/app/commands/decidim/admin/destroy_participatory_process_step.rb +5 -2
- data/decidim-admin/app/commands/decidim/admin/update_feature.rb +1 -0
- data/decidim-admin/app/commands/decidim/admin/update_organization.rb +10 -5
- data/decidim-admin/app/commands/decidim/admin/update_participatory_process.rb +4 -2
- data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +2 -0
- data/decidim-admin/app/controllers/decidim/admin/concerns/has_attachments.rb +10 -1
- data/decidim-admin/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +0 -5
- data/decidim-admin/app/controllers/decidim/admin/features/base_controller.rb +0 -1
- data/decidim-admin/app/controllers/decidim/admin/moderations_controller.rb +7 -4
- data/decidim-admin/app/controllers/decidim/admin/organization_controller.rb +9 -3
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +17 -0
- data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +11 -3
- data/decidim-admin/app/forms/decidim/admin/feature_form.rb +6 -0
- data/decidim-admin/app/forms/decidim/admin/organization_form.rb +5 -0
- data/decidim-admin/app/forms/decidim/admin/participatory_process_copy_form.rb +2 -3
- data/decidim-admin/app/forms/decidim/admin/participatory_process_form.rb +2 -0
- data/decidim-admin/app/forms/decidim/admin/static_page_form.rb +6 -0
- data/decidim-admin/app/helpers/decidim/admin/menu_helper.rb +1 -1
- data/decidim-admin/app/jobs/decidim/admin/newsletter_job.rb +9 -5
- data/decidim-admin/app/views/decidim/admin/attachments/_form.html.erb +1 -12
- data/decidim-admin/app/views/decidim/admin/features/_feature.html.erb +2 -2
- data/decidim-admin/app/views/decidim/admin/features/_form.html.erb +18 -0
- data/decidim-admin/app/views/decidim/admin/moderations/_report.html.erb +2 -2
- data/decidim-admin/app/views/decidim/admin/organization/_form.html.erb +5 -35
- data/decidim-admin/app/views/decidim/admin/participatory_process_groups/_form.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +16 -0
- data/decidim-admin/app/views/decidim/admin/participatory_processes/_form.html.erb +2 -14
- data/decidim-admin/app/views/layouts/decidim/admin/_title_bar.html.erb +26 -19
- data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +2 -2
- data/decidim-admin/bin/rails +2 -2
- data/decidim-admin/config/i18n-tasks.yml +2 -0
- data/decidim-admin/config/locales/ca.yml +9 -5
- data/decidim-admin/config/locales/en.yml +9 -5
- data/decidim-admin/config/locales/es.yml +11 -5
- data/decidim-admin/config/locales/eu.yml +0 -5
- data/decidim-admin/config/locales/fr.yml +18 -23
- data/decidim-admin/config/locales/it.yml +0 -5
- data/decidim-admin/config/routes.rb +5 -3
- data/decidim-admin/decidim-admin.gemspec +2 -2
- data/decidim-admin/lib/decidim/admin/test/manage_attachments_examples.rb +1 -2
- data/decidim-admin/spec/commands/create_participatory_process_admin_spec.rb +42 -26
- data/decidim-admin/spec/commands/create_participatory_process_spec.rb +2 -1
- data/decidim-admin/spec/commands/create_participatory_process_step_spec.rb +56 -0
- data/decidim-admin/spec/commands/destroy_participatory_process_step_spec.rb +2 -2
- data/decidim-admin/spec/commands/update_feature_spec.rb +6 -0
- data/decidim-admin/spec/controllers/participatory_processes_controller_spec.rb +3 -6
- data/decidim-admin/spec/features/admin_copy_participatory_process_spec.rb +9 -9
- data/decidim-admin/spec/features/admin_manages_features_spec.rb +32 -0
- data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +3 -4
- data/decidim-admin/spec/forms/static_page_form_spec.rb +12 -0
- data/decidim-admin/spec/jobs/newsletter_job_spec.rb +3 -0
- data/decidim-admin/spec/shared/manage_process_admins_examples.rb +22 -0
- data/decidim-admin/spec/shared/manage_processes_examples.rb +6 -0
- data/decidim-admin/spec/spec_helper.rb +4 -0
- data/decidim-api/bin/rails +2 -2
- data/decidim-api/decidim-api.gemspec +3 -3
- data/decidim-api/spec/spec_helper.rb +4 -0
- data/decidim-api/spec/types/query_type_spec.rb +2 -2
- data/decidim-budgets/app/models/decidim/budgets/project.rb +5 -0
- data/decidim-budgets/bin/rails +2 -2
- data/decidim-budgets/config/locales/fr.yml +2 -2
- data/decidim-budgets/decidim-budgets.gemspec +2 -2
- data/decidim-budgets/lib/decidim/budgets/feature.rb +1 -1
- data/decidim-budgets/spec/spec_helper.rb +4 -0
- data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
- data/decidim-comments/app/commands/decidim/comments/create_comment.rb +10 -14
- data/decidim-comments/app/frontend/application/application.component.tsx +1 -1
- data/decidim-comments/app/frontend/comments/add_comment_form.component.test.tsx +33 -26
- data/decidim-comments/app/frontend/comments/add_comment_form.component.tsx +109 -83
- data/decidim-comments/app/frontend/comments/comment.component.test.tsx +29 -24
- data/decidim-comments/app/frontend/comments/comment.component.tsx +12 -5
- data/decidim-comments/app/frontend/comments/comment_thread.component.test.tsx +12 -7
- data/decidim-comments/app/frontend/comments/comment_thread.component.tsx +7 -2
- data/decidim-comments/app/frontend/comments/comments.component.tsx +26 -15
- data/decidim-comments/app/frontend/comments/down_vote_button.component.test.tsx +9 -4
- data/decidim-comments/app/frontend/comments/down_vote_button.component.tsx +56 -37
- data/decidim-comments/app/frontend/comments/up_vote_button.component.test.tsx +9 -4
- data/decidim-comments/app/frontend/comments/up_vote_button.component.tsx +31 -16
- data/decidim-comments/app/frontend/comments/vote_button.component.tsx +3 -0
- data/decidim-comments/app/mailers/decidim/comments/comment_notification_mailer.rb +8 -6
- data/decidim-comments/app/models/decidim/comments/comment.rb +13 -1
- data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/comment_created.html.erb +1 -1
- data/decidim-comments/app/views/decidim/comments/comment_notification_mailer/reply_created.html.erb +1 -1
- data/decidim-comments/bin/rails +2 -2
- data/decidim-comments/config/locales/ca.yml +2 -0
- data/decidim-comments/config/locales/en.yml +2 -0
- data/decidim-comments/config/locales/es.yml +2 -0
- data/decidim-comments/config/locales/fr.yml +2 -2
- data/decidim-comments/decidim-comments.gemspec +3 -3
- data/decidim-comments/lib/decidim/comments/commentable.rb +1 -0
- data/decidim-comments/spec/commands/create_comment_spec.rb +22 -54
- data/decidim-comments/spec/features/notifications_spec.rb +2 -6
- data/decidim-comments/spec/mailers/comment_notification_mailer_spec.rb +5 -4
- data/decidim-comments/spec/models/comment_spec.rb +32 -2
- data/decidim-comments/spec/shared/author_localised_email.rb +2 -3
- data/decidim-comments/spec/spec_helper.rb +4 -0
- data/decidim-dev/decidim-dev.gemspec +3 -4
- data/decidim-dev/lib/decidim/dev.rb +23 -1
- data/decidim-dev/lib/decidim/dev/common_rake.rb +3 -0
- data/decidim-dev/lib/decidim/dev/railtie.rb +3 -3
- data/decidim-dev/lib/decidim/dev/test/base_spec_helper.rb +4 -3
- data/decidim-dev/lib/decidim/dev/test/rspec_support/capybara.rb +3 -0
- data/decidim-dev/lib/decidim/dev/test/rspec_support/feature.rb +8 -0
- data/decidim-dev/lib/decidim/dev/test/rspec_support/feature_context.rb +4 -2
- data/decidim-dev/lib/decidim/dev/test/rspec_support/geocoder.rb +7 -2
- data/decidim-dev/lib/decidim/dev/test/rspec_support/phantomjs_polyfills/phantomjs-getOwnPropertyNames.js +16 -0
- data/decidim-dev/lib/decidim/dev/test/rspec_support/warden.rb +17 -1
- data/decidim-meetings/app/helpers/decidim/meetings/application_helper.rb +1 -0
- data/decidim-meetings/app/helpers/decidim/meetings/meetings_helper.rb +24 -0
- data/decidim-meetings/app/views/decidim/meetings/meetings/_meetings.html.erb +1 -1
- data/decidim-meetings/bin/rails +2 -2
- data/decidim-meetings/config/locales/ca.yml +1 -0
- data/decidim-meetings/config/locales/en.yml +2 -1
- data/decidim-meetings/config/locales/es.yml +1 -0
- data/decidim-meetings/config/locales/fr.yml +5 -5
- data/decidim-meetings/decidim-meetings.gemspec +2 -2
- data/decidim-meetings/lib/decidim/meetings/feature.rb +1 -1
- data/decidim-meetings/spec/features/admin_manages_meetings_attachments_spec.rb +1 -1
- data/decidim-meetings/spec/features/admin_manages_meetings_spec.rb +1 -1
- data/decidim-meetings/spec/features/explore_meetings_spec.rb +1 -1
- data/decidim-meetings/spec/features/process_admin_manages_meetings_attachments_spec.rb +1 -1
- data/decidim-meetings/spec/features/process_admin_manages_meetings_spec.rb +1 -1
- data/decidim-meetings/spec/helpers/meetings_helper_spec.rb +16 -0
- data/decidim-meetings/spec/spec_helper.rb +4 -0
- data/decidim-pages/app/models/decidim/pages/page.rb +5 -0
- data/decidim-pages/bin/rails +2 -2
- data/decidim-pages/decidim-pages.gemspec +2 -2
- data/decidim-pages/lib/decidim/pages/feature.rb +1 -1
- data/decidim-pages/spec/commands/destroy_page_spec.rb +1 -1
- data/decidim-pages/spec/spec_helper.rb +4 -0
- data/decidim-proposals/app/assets/config/decidim_proposals_manifest.js +1 -0
- data/decidim-proposals/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +23 -0
- data/decidim-proposals/app/forms/decidim/proposals/proposal_form.rb +7 -1
- data/decidim-proposals/app/models/decidim/proposals/proposal.rb +14 -2
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal.html.erb +1 -0
- data/decidim-proposals/app/views/decidim/proposals/proposals/new.html.erb +5 -0
- data/decidim-proposals/bin/rails +2 -2
- data/decidim-proposals/config/locales/fr.yml +11 -11
- data/decidim-proposals/db/migrate/20170307085300_migrate_proposal_reports_data_to_reports.rb +1 -1
- data/decidim-proposals/decidim-proposals.gemspec +2 -2
- data/decidim-proposals/lib/decidim/proposals/feature.rb +1 -1
- data/decidim-proposals/spec/features/proposals_spec.rb +8 -2
- data/decidim-proposals/spec/models/decidim/proposals/proposal_spec.rb +35 -0
- data/decidim-proposals/spec/shared/create_proposal_examples.rb +20 -14
- data/decidim-proposals/spec/shared/manage_proposals_examples.rb +13 -16
- data/decidim-proposals/spec/shared/proposal_form_examples.rb +22 -16
- data/decidim-proposals/spec/spec_helper.rb +4 -0
- data/decidim-results/app/models/decidim/results/result.rb +10 -0
- data/decidim-results/bin/rails +2 -2
- data/decidim-results/config/locales/fr.yml +2 -2
- data/decidim-results/decidim-results.gemspec +2 -2
- data/decidim-results/lib/decidim/results/feature.rb +1 -1
- data/decidim-results/spec/features/comments_spec.rb +10 -0
- data/decidim-results/spec/spec_helper.rb +4 -0
- data/decidim-surveys/app/models/decidim/surveys/survey_question.rb +2 -0
- data/decidim-surveys/bin/rails +2 -2
- data/decidim-surveys/decidim-surveys.gemspec +2 -2
- data/decidim-surveys/lib/decidim/surveys/feature.rb +3 -2
- data/decidim-surveys/spec/forms/decidim/surveys/admin/survey_question_form_spec.rb +1 -1
- data/decidim-surveys/spec/models/decidim/surveys/survey_question_spec.rb +7 -1
- data/decidim-surveys/spec/spec_helper.rb +5 -0
- data/decidim-system/app/controllers/decidim/system/application_controller.rb +1 -1
- data/decidim-system/app/controllers/decidim/system/devise/sessions_controller.rb +1 -0
- data/decidim-system/app/helpers/decidim/system/menu_helper.rb +1 -1
- data/decidim-system/app/views/decidim/system/shared/_notices.html.erb +11 -0
- data/decidim-system/app/views/layouts/decidim/system/application.html.erb +1 -1
- data/decidim-system/app/views/layouts/decidim/system/login.html.erb +1 -1
- data/decidim-system/bin/rails +2 -2
- data/decidim-system/config/locales/ca.yml +4 -0
- data/decidim-system/config/locales/en.yml +4 -0
- data/decidim-system/config/locales/es.yml +4 -0
- data/decidim-system/db/migrate/20160919105637_devise_create_decidim_admins.rb +5 -5
- data/decidim-system/db/seeds.rb +1 -1
- data/decidim-system/decidim-system.gemspec +2 -2
- data/decidim-system/spec/factories.rb +2 -2
- data/decidim-system/spec/features/manage_admins_spec.rb +3 -3
- data/decidim-system/spec/spec_helper.rb +4 -0
- data/decidim.gemspec +6 -6
- data/docs/how_to_create_a_plugin.md +2 -2
- data/lib/generators/decidim/app_generator.rb +1 -1
- data/lib/generators/decidim/install_generator.rb +35 -27
- data/lib/generators/decidim/templates/Gemfile.erb +1 -0
- data/lib/generators/decidim/templates/initializer.rb +7 -1
- data/logo.svg +62 -0
- data/package.json +37 -35
- data/tsconfig.json +3 -0
- data/yarn.lock +1017 -486
- metadata +32 -25
- data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_language-chooser.scss +0 -4
@@ -72,7 +72,7 @@ Decidim.register_feature(:proposals) do |feature|
|
|
72
72
|
end
|
73
73
|
|
74
74
|
feature.seeds do
|
75
|
-
Decidim::ParticipatoryProcess.
|
75
|
+
Decidim::ParticipatoryProcess.find_each do |process|
|
76
76
|
next unless process.steps.any?
|
77
77
|
|
78
78
|
feature = Decidim::Feature.create!(
|
@@ -87,7 +87,7 @@ describe "Proposals", type: :feature do
|
|
87
87
|
expect(page).to have_content(user.name)
|
88
88
|
end
|
89
89
|
|
90
|
-
context "when geocoding is enabled" do
|
90
|
+
context "when geocoding is enabled", :serves_map do
|
91
91
|
let!(:feature) do
|
92
92
|
create(:proposal_feature,
|
93
93
|
:with_creation_enabled,
|
@@ -103,6 +103,9 @@ describe "Proposals", type: :feature do
|
|
103
103
|
within ".new_proposal" do
|
104
104
|
fill_in :proposal_title, with: "Oriol for president"
|
105
105
|
fill_in :proposal_body, with: "He will solve everything"
|
106
|
+
|
107
|
+
check :proposal_has_address
|
108
|
+
|
106
109
|
fill_in :proposal_address, with: address
|
107
110
|
select category.name["en"], from: :proposal_category_id
|
108
111
|
select scope.name, from: :proposal_scope_id
|
@@ -149,7 +152,7 @@ describe "Proposals", type: :feature do
|
|
149
152
|
expect(page).to have_content(user_group.name)
|
150
153
|
end
|
151
154
|
|
152
|
-
context "when geocoding is enabled" do
|
155
|
+
context "when geocoding is enabled", :serves_map do
|
153
156
|
let!(:feature) do
|
154
157
|
create(:proposal_feature,
|
155
158
|
:with_creation_enabled,
|
@@ -165,6 +168,9 @@ describe "Proposals", type: :feature do
|
|
165
168
|
within ".new_proposal" do
|
166
169
|
fill_in :proposal_title, with: "Oriol for president"
|
167
170
|
fill_in :proposal_body, with: "He will solve everything"
|
171
|
+
|
172
|
+
check :proposal_has_address
|
173
|
+
|
168
174
|
fill_in :proposal_address, with: address
|
169
175
|
select category.name["en"], from: :proposal_category_id
|
170
176
|
select scope.name, from: :proposal_scope_id
|
@@ -5,6 +5,7 @@ require "spec_helper"
|
|
5
5
|
module Decidim
|
6
6
|
module Proposals
|
7
7
|
describe Proposal do
|
8
|
+
let(:comments_notifications) { true }
|
8
9
|
let(:proposal) { build(:proposal) }
|
9
10
|
subject { proposal }
|
10
11
|
|
@@ -47,6 +48,40 @@ module Decidim
|
|
47
48
|
it { is_expected.to be_answered }
|
48
49
|
it { is_expected.to be_rejected }
|
49
50
|
end
|
51
|
+
|
52
|
+
describe "#notifiable?" do
|
53
|
+
let(:context_author) { create(:user, organization: subject.author.organization) }
|
54
|
+
|
55
|
+
context "when the context author is the same as the proposal's author" do
|
56
|
+
let(:context_author) { subject.author }
|
57
|
+
|
58
|
+
it "is not notifiable" do
|
59
|
+
expect(subject.notifiable?(author: context_author)).to be_falsy
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "when the context author is not the same as the proposal's author" do
|
64
|
+
context "when the comment's author has not comments notifications enabled" do
|
65
|
+
before do
|
66
|
+
expect(subject.author).to receive(:comments_notifications?).and_return(false)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "is not notifiable" do
|
70
|
+
expect(subject.notifiable?(author: context_author)).to be_falsy
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context "when the comment's author has comments notifications enabled" do
|
75
|
+
before do
|
76
|
+
expect(subject.author).to receive(:comments_notifications?).and_return(true)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "is not notifiable" do
|
80
|
+
expect(subject.notifiable?(author: context_author)).to be_truthy
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
50
85
|
end
|
51
86
|
end
|
52
87
|
end
|
@@ -14,6 +14,7 @@ RSpec.shared_examples "create a proposal" do |with_author|
|
|
14
14
|
end
|
15
15
|
let(:author) { create(:user, organization: organization) } if with_author
|
16
16
|
|
17
|
+
let(:has_address) { false }
|
17
18
|
let(:address) { nil }
|
18
19
|
let(:latitude) { 40.1234 }
|
19
20
|
let(:longitude) { 2.1234 }
|
@@ -23,7 +24,8 @@ RSpec.shared_examples "create a proposal" do |with_author|
|
|
23
24
|
{
|
24
25
|
title: "A reasonable proposal title",
|
25
26
|
body: "A reasonable proposal body",
|
26
|
-
address: address
|
27
|
+
address: address,
|
28
|
+
has_address: has_address
|
27
29
|
}
|
28
30
|
end
|
29
31
|
|
@@ -74,22 +76,26 @@ RSpec.shared_examples "create a proposal" do |with_author|
|
|
74
76
|
context "when geocoding is enabled" do
|
75
77
|
let(:feature) { create(:proposal_feature, :with_geocoding_enabled) }
|
76
78
|
|
77
|
-
context "when the address is
|
78
|
-
let(:
|
79
|
+
context "when the has address checkbox is checked" do
|
80
|
+
let(:has_address) { true }
|
79
81
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
82
|
+
context "when the address is present" do
|
83
|
+
let(:address) { "Carrer Pare Llaurador 113, baixos, 08224 Terrassa" }
|
84
|
+
|
85
|
+
before do
|
86
|
+
Geocoder::Lookup::Test.add_stub(
|
87
|
+
address,
|
88
|
+
[{ "latitude" => latitude, "longitude" => longitude }]
|
89
|
+
)
|
90
|
+
end
|
86
91
|
|
87
|
-
|
88
|
-
|
89
|
-
|
92
|
+
it "sets the latitude and longitude" do
|
93
|
+
command.call
|
94
|
+
proposal = Decidim::Proposals::Proposal.last
|
90
95
|
|
91
|
-
|
92
|
-
|
96
|
+
expect(proposal.latitude).to eq(latitude)
|
97
|
+
expect(proposal.longitude).to eq(longitude)
|
98
|
+
end
|
93
99
|
end
|
94
100
|
end
|
95
101
|
end
|
@@ -29,13 +29,12 @@ RSpec.shared_examples "manage proposals" do
|
|
29
29
|
context "creation" do
|
30
30
|
context "when official_proposals setting is enabled" do
|
31
31
|
before do
|
32
|
-
current_feature.settings
|
33
|
-
current_feature.save
|
32
|
+
current_feature.update_attributes!(settings: { official_proposals_enabled: true })
|
34
33
|
end
|
35
34
|
|
36
35
|
context "when creation is enabled" do
|
37
36
|
before do
|
38
|
-
current_feature.update_attributes(
|
37
|
+
current_feature.update_attributes!(
|
39
38
|
step_settings: {
|
40
39
|
current_feature.participatory_process.active_step.id => {
|
41
40
|
creation_enabled: true
|
@@ -46,20 +45,18 @@ RSpec.shared_examples "manage proposals" do
|
|
46
45
|
|
47
46
|
context "when process is not related to any scope" do
|
48
47
|
before do
|
49
|
-
participatory_process.update_attributes(scope: nil)
|
48
|
+
participatory_process.update_attributes!(scope: nil)
|
49
|
+
|
50
|
+
click_link "New"
|
50
51
|
end
|
51
52
|
|
52
53
|
it "can be related to a scope" do
|
53
|
-
find(".card-title a.button").click
|
54
|
-
|
55
54
|
within "form" do
|
56
55
|
expect(page).to have_content(/Scope/i)
|
57
56
|
end
|
58
57
|
end
|
59
58
|
|
60
59
|
it "creates a new proposal" do
|
61
|
-
find(".card-title a.button").click
|
62
|
-
|
63
60
|
within ".new_proposal" do
|
64
61
|
fill_in :proposal_title, with: "Make decidim great again"
|
65
62
|
fill_in :proposal_body, with: "Decidim is great but it can be better"
|
@@ -86,7 +83,7 @@ RSpec.shared_examples "manage proposals" do
|
|
86
83
|
|
87
84
|
context "when process is related to a scope" do
|
88
85
|
before do
|
89
|
-
participatory_process.update_attributes(scope: scope)
|
86
|
+
participatory_process.update_attributes!(scope: scope)
|
90
87
|
end
|
91
88
|
|
92
89
|
it "cannot be related to a scope" do
|
@@ -123,7 +120,7 @@ RSpec.shared_examples "manage proposals" do
|
|
123
120
|
|
124
121
|
context "when geocoding is enabled" do
|
125
122
|
before do
|
126
|
-
current_feature.update_attributes(settings: { geocoding_enabled: true })
|
123
|
+
current_feature.update_attributes!(settings: { geocoding_enabled: true })
|
127
124
|
end
|
128
125
|
|
129
126
|
it "creates a new proposal related to the process scope" do
|
@@ -157,7 +154,7 @@ RSpec.shared_examples "manage proposals" do
|
|
157
154
|
|
158
155
|
context "when official_proposals setting is disabled" do
|
159
156
|
before do
|
160
|
-
current_feature.update_attributes(settings: { official_proposals_enabled: false })
|
157
|
+
current_feature.update_attributes!(settings: { official_proposals_enabled: false })
|
161
158
|
end
|
162
159
|
|
163
160
|
it "cannot create a new proposal" do
|
@@ -169,12 +166,12 @@ RSpec.shared_examples "manage proposals" do
|
|
169
166
|
|
170
167
|
context "when the proposal_answering feature setting is enabled" do
|
171
168
|
before do
|
172
|
-
current_feature.update_attributes(settings: { proposal_answering_enabled: true })
|
169
|
+
current_feature.update_attributes!(settings: { proposal_answering_enabled: true })
|
173
170
|
end
|
174
171
|
|
175
172
|
context "when the proposal_answering step setting is enabled" do
|
176
173
|
before do
|
177
|
-
current_feature.update_attributes(
|
174
|
+
current_feature.update_attributes!(
|
178
175
|
step_settings: {
|
179
176
|
current_feature.participatory_process.active_step.id => {
|
180
177
|
proposal_answering_enabled: true
|
@@ -241,7 +238,7 @@ RSpec.shared_examples "manage proposals" do
|
|
241
238
|
answered_at: Time.current
|
242
239
|
)
|
243
240
|
|
244
|
-
visit
|
241
|
+
visit manage_feature_path(current_feature)
|
245
242
|
|
246
243
|
within find("tr", text: proposal.title) do
|
247
244
|
within find("td:nth-child(4)") do
|
@@ -269,7 +266,7 @@ RSpec.shared_examples "manage proposals" do
|
|
269
266
|
|
270
267
|
context "when the proposal_answering step setting is disabled" do
|
271
268
|
before do
|
272
|
-
current_feature.update_attributes(
|
269
|
+
current_feature.update_attributes!(
|
273
270
|
step_settings: {
|
274
271
|
current_feature.participatory_process.active_step.id => {
|
275
272
|
proposal_answering_enabled: false
|
@@ -290,7 +287,7 @@ RSpec.shared_examples "manage proposals" do
|
|
290
287
|
|
291
288
|
context "when the proposal_answering feature setting is disabled" do
|
292
289
|
before do
|
293
|
-
current_feature.update_attributes(settings: { proposal_answering_enabled: false })
|
290
|
+
current_feature.update_attributes!(settings: { proposal_answering_enabled: false })
|
294
291
|
end
|
295
292
|
|
296
293
|
it "cannot answer a proposal" do
|
@@ -12,6 +12,7 @@ RSpec.shared_examples "a proposal form" do
|
|
12
12
|
let(:scope_id) { scope.try(:id) }
|
13
13
|
let(:latitude) { 40.1234 }
|
14
14
|
let(:longitude) { 2.1234 }
|
15
|
+
let(:has_address) { false }
|
15
16
|
let(:address) { nil }
|
16
17
|
let(:params) do
|
17
18
|
{
|
@@ -20,7 +21,8 @@ RSpec.shared_examples "a proposal form" do
|
|
20
21
|
author: author,
|
21
22
|
category_id: category_id,
|
22
23
|
scope_id: scope_id,
|
23
|
-
address: address
|
24
|
+
address: address,
|
25
|
+
has_address: has_address
|
24
26
|
}
|
25
27
|
end
|
26
28
|
|
@@ -70,24 +72,28 @@ RSpec.shared_examples "a proposal form" do
|
|
70
72
|
context "when geocoding is enabled" do
|
71
73
|
let(:feature) { create(:proposal_feature, :with_geocoding_enabled) }
|
72
74
|
|
73
|
-
context "when the address is
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
context "when the address is present" do
|
78
|
-
let(:address) { "Carrer Pare Llaurador 113, baixos, 08224 Terrassa" }
|
75
|
+
context "when the has address checkbox is checked" do
|
76
|
+
let(:has_address) { true }
|
79
77
|
|
80
|
-
|
81
|
-
|
82
|
-
address,
|
83
|
-
[{ "latitude" => latitude, "longitude" => longitude }]
|
84
|
-
)
|
78
|
+
context "when the address is not present" do
|
79
|
+
it { is_expected.to be_invalid }
|
85
80
|
end
|
86
81
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
82
|
+
context "when the address is present" do
|
83
|
+
let(:address) { "Carrer Pare Llaurador 113, baixos, 08224 Terrassa" }
|
84
|
+
|
85
|
+
before do
|
86
|
+
Geocoder::Lookup::Test.add_stub(
|
87
|
+
address,
|
88
|
+
[{ "latitude" => latitude, "longitude" => longitude }]
|
89
|
+
)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "validates the address and store its coordinates" do
|
93
|
+
expect(subject).to be_valid
|
94
|
+
expect(subject.latitude).to eq(latitude)
|
95
|
+
expect(subject.longitude).to eq(longitude)
|
96
|
+
end
|
91
97
|
end
|
92
98
|
end
|
93
99
|
end
|
@@ -33,6 +33,16 @@ module Decidim
|
|
33
33
|
def comments_have_votes?
|
34
34
|
true
|
35
35
|
end
|
36
|
+
|
37
|
+
# Public: Overrides the `notifiable?` Notifiable concern method.
|
38
|
+
def notifiable?(_context)
|
39
|
+
true
|
40
|
+
end
|
41
|
+
|
42
|
+
# Public: Overrides the `users_to_notify` Notifiable concern method.
|
43
|
+
def users_to_notify
|
44
|
+
Decidim::Admin::ProcessAdmins.for(feature.participatory_process)
|
45
|
+
end
|
36
46
|
end
|
37
47
|
end
|
38
48
|
end
|
data/decidim-results/bin/rails
CHANGED
@@ -8,8 +8,8 @@ ENGINE_ROOT = File.expand_path("..", __dir__)
|
|
8
8
|
ENGINE_PATH = File.expand_path("../lib/decidim/results/engine", __dir__)
|
9
9
|
|
10
10
|
# Set up gems listed in the Gemfile.
|
11
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("
|
12
|
-
require "bundler/setup"
|
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"
|
@@ -3,7 +3,7 @@ fr:
|
|
3
3
|
attributes:
|
4
4
|
result:
|
5
5
|
decidim_category_id: Catégorie
|
6
|
-
decidim_scope_id:
|
6
|
+
decidim_scope_id: Zone d'application
|
7
7
|
description: Description
|
8
8
|
proposal_ids: Propositions incluses
|
9
9
|
title: Titre
|
@@ -62,7 +62,7 @@ fr:
|
|
62
62
|
filters:
|
63
63
|
category: Catégorie
|
64
64
|
category_prompt: Sélectionner une catégorie
|
65
|
-
scopes:
|
65
|
+
scopes: Zones d'application
|
66
66
|
search: Rechercher
|
67
67
|
filters_small_view:
|
68
68
|
close_modal: Fermer la fenêtre de dialogue
|
@@ -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
|
13
|
-
s.summary
|
12
|
+
s.name = "decidim-results"
|
13
|
+
s.summary = "A results 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"]
|
@@ -34,7 +34,7 @@ Decidim.register_feature(:results) do |feature|
|
|
34
34
|
end
|
35
35
|
|
36
36
|
feature.seeds do
|
37
|
-
Decidim::ParticipatoryProcess.
|
37
|
+
Decidim::ParticipatoryProcess.find_each do |process|
|
38
38
|
next unless process.steps.any?
|
39
39
|
|
40
40
|
feature = Decidim::Feature.create!(
|
@@ -4,6 +4,16 @@ require "spec_helper"
|
|
4
4
|
|
5
5
|
describe "Comments", type: :feature, perform_enqueued: true do
|
6
6
|
let!(:feature) { create(:result_feature, organization: organization) }
|
7
|
+
let!(:participatory_process) { feature.participatory_process }
|
8
|
+
let!(:participatory_process_admin) do
|
9
|
+
user = create(:user, :confirmed, organization: organization)
|
10
|
+
Decidim::Admin::ParticipatoryProcessUserRole.create!(
|
11
|
+
role: :admin,
|
12
|
+
user: user,
|
13
|
+
participatory_process: participatory_process
|
14
|
+
)
|
15
|
+
user
|
16
|
+
end
|
7
17
|
let!(:commentable) { create(:result, feature: feature) }
|
8
18
|
|
9
19
|
let(:resource_path) { decidim_results.result_path(commentable, feature_id: feature, participatory_process_id: feature.participatory_process) }
|
@@ -8,6 +8,8 @@ module Decidim
|
|
8
8
|
|
9
9
|
belongs_to :survey, class_name: "Survey", foreign_key: "decidim_survey_id"
|
10
10
|
|
11
|
+
validates :question_type, inclusion: { in: TYPES }
|
12
|
+
|
11
13
|
# Rectify can't handle a hash when using the from_model method so
|
12
14
|
# the answer options must be converted to struct.
|
13
15
|
def answer_options
|
data/decidim-surveys/bin/rails
CHANGED
@@ -8,8 +8,8 @@ ENGINE_ROOT = File.expand_path("..", __dir__)
|
|
8
8
|
ENGINE_PATH = File.expand_path("../lib/decidim/surveys/engine", __dir__)
|
9
9
|
|
10
10
|
# Set up gems listed in the Gemfile.
|
11
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("
|
12
|
-
require "bundler/setup"
|
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"
|