decidim 0.0.4 → 0.0.5
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/.eslintrc.json +2 -5
- data/.mention-bot +2 -1
- data/.yardopts +8 -0
- data/Gemfile.lock +64 -62
- data/README.md +11 -9
- data/decidim-admin/app/assets/javascripts/decidim/admin/sort_steps.js.es6 +3 -3
- data/decidim-admin/app/assets/stylesheets/decidim/admin/_email_preview.scss +5 -0
- data/decidim-admin/app/assets/stylesheets/decidim/admin/application.scss +1 -0
- data/decidim-admin/app/commands/decidim/admin/create_newsletter.rb +30 -0
- data/decidim-admin/app/commands/decidim/admin/deliver_newsletter.rb +29 -0
- data/decidim-admin/app/commands/decidim/admin/destroy_participatory_process_step.rb +9 -0
- data/decidim-admin/app/commands/decidim/admin/update_newsletter.rb +33 -0
- data/decidim-admin/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/features_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/newsletters_controller.rb +115 -0
- data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +4 -4
- data/decidim-admin/app/forms/decidim/admin/newsletter_form.rb +15 -0
- data/decidim-admin/app/jobs/decidim/admin/newsletter_delivery_job.rb +18 -0
- data/decidim-admin/app/jobs/decidim/admin/newsletter_job.rb +32 -0
- data/decidim-admin/app/models/decidim/admin/abilities/admin_user.rb +4 -0
- data/decidim-admin/app/models/decidim/admin/abilities/base.rb +4 -0
- data/decidim-admin/app/models/decidim/admin/abilities/collaborator_user.rb +19 -0
- data/decidim-admin/app/models/decidim/admin/abilities/participatory_process_admin.rb +1 -1
- data/decidim-admin/app/queries/decidim/admin/manageable_participatory_processes_for_user.rb +1 -1
- data/decidim-admin/app/views/decidim/admin/newsletters/_form.html.erb +5 -0
- data/decidim-admin/app/views/decidim/admin/newsletters/edit.html.erb +11 -0
- data/decidim-admin/app/views/decidim/admin/newsletters/index.html.erb +47 -0
- data/decidim-admin/app/views/decidim/admin/newsletters/new.html.erb +11 -0
- data/decidim-admin/app/views/decidim/admin/newsletters/show.html.erb +14 -0
- data/decidim-admin/app/views/decidim/admin/participatory_process_steps/_form.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_processes/_form.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/static_pages/_form.html.erb +1 -1
- data/decidim-admin/app/views/layouts/decidim/admin/_sidebar.html.erb +1 -0
- data/decidim-admin/config/locales/ca.yml +40 -0
- data/decidim-admin/config/locales/en.yml +40 -0
- data/decidim-admin/config/locales/es.yml +40 -0
- data/decidim-admin/config/routes.rb +7 -0
- data/decidim-admin/decidim-admin.gemspec +0 -1
- data/decidim-admin/lib/decidim/admin/engine.rb +1 -0
- data/decidim-admin/lib/decidim/admin/features/base_controller.rb +5 -1
- data/decidim-admin/spec/commands/create_newsletter_spec.rb +62 -0
- data/decidim-admin/spec/commands/deliver_newsletter_spec.rb +45 -0
- data/decidim-admin/spec/commands/destroy_participatory_process_step_spec.rb +12 -0
- data/decidim-admin/spec/commands/update_newsletter_spec.rb +64 -0
- data/decidim-admin/spec/features/admin_manages_newsletters_spec.rb +147 -0
- data/decidim-admin/spec/features/admin_manages_participatory_processes_spec.rb +1 -5
- data/decidim-admin/spec/features/static_pages_spec.rb +16 -0
- data/decidim-admin/spec/forms/newsletter_form_spec.rb +47 -0
- data/decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb +25 -0
- data/decidim-admin/spec/jobs/newsletter_job_spec.rb +29 -0
- data/decidim-admin/spec/models/abilities/collaborator_user_spec.rb +66 -0
- data/decidim-admin/spec/organization_dashboard_constraint_spec.rb +55 -0
- data/decidim-admin/spec/queries/manageable_participatory_processes_for_user_spec.rb +8 -0
- data/decidim-admin/spec/shared/manage_processes_examples.rb +1 -5
- data/decidim-api/lib/decidim/api.rb +2 -7
- data/decidim-api/lib/decidim/api/{types/mutation.rb → mutation_type.rb} +0 -0
- data/decidim-api/lib/decidim/api/{types/query.rb → query_type.rb} +0 -0
- data/decidim-budgets/app/assets/javascripts/decidim/budgets/projects.js.es6 +4 -4
- data/decidim-budgets/app/commands/decidim/budgets/add_line_item.rb +4 -2
- data/decidim-budgets/app/commands/decidim/budgets/checkout.rb +7 -3
- data/decidim-budgets/app/models/decidim/budgets/order.rb +16 -1
- data/decidim-budgets/app/models/decidim/budgets/project.rb +16 -0
- data/decidim-budgets/app/views/decidim/budgets/line_items/update_budget.js.erb +7 -7
- data/decidim-budgets/app/views/decidim/budgets/projects/_budget_confirm.html.erb +27 -25
- data/decidim-budgets/app/views/decidim/budgets/projects/_budget_summary.html.erb +4 -13
- data/decidim-budgets/app/views/decidim/budgets/projects/_order_progress.html.erb +23 -21
- data/decidim-budgets/app/views/decidim/budgets/projects/_order_selected_projects.html.erb +25 -23
- data/decidim-budgets/app/views/decidim/budgets/projects/_order_total_budget.html.erb +3 -1
- data/decidim-budgets/app/views/decidim/budgets/projects/_project.html.erb +32 -30
- data/decidim-budgets/app/views/decidim/budgets/projects/_projects.html.erb +1 -3
- data/decidim-budgets/app/views/decidim/budgets/projects/index.html.erb +0 -4
- data/decidim-budgets/app/views/decidim/budgets/projects/show.html.erb +5 -6
- data/decidim-budgets/config/i18n-tasks.yml +1 -0
- data/decidim-budgets/config/locales/ca.yml +7 -2
- data/decidim-budgets/config/locales/en.yml +17 -6
- data/decidim-budgets/config/locales/es.yml +7 -2
- data/decidim-budgets/lib/decidim/budgets/feature.rb +2 -2
- data/decidim-budgets/spec/commands/add_line_item_spec.rb +16 -3
- data/decidim-budgets/spec/commands/cancel_order_spec.rb +7 -1
- data/decidim-budgets/spec/commands/checkout_spec.rb +9 -2
- data/decidim-budgets/spec/commands/remove_line_item_spec.rb +16 -5
- data/decidim-budgets/spec/features/orders_spec.rb +8 -2
- data/decidim-budgets/spec/models/order_spec.rb +31 -2
- data/decidim-budgets/spec/shared/admin_shared_context.rb +1 -1
- data/decidim-comments/README.md +1 -1
- data/decidim-comments/app/assets/javascripts/decidim/comments/bundle.js +0 -0
- data/decidim-comments/app/frontend/comments/add_comment_form.component.jsx +156 -93
- data/decidim-comments/app/frontend/comments/add_comment_form.component.test.jsx +36 -23
- data/decidim-comments/app/frontend/comments/add_comment_form.mutation.graphql +5 -3
- data/decidim-comments/app/frontend/comments/add_comment_form_commentable.fragment.graphql +4 -0
- data/decidim-comments/app/frontend/comments/add_comment_form_session.fragment.graphql +6 -0
- data/decidim-comments/app/frontend/comments/comment.component.jsx +11 -13
- data/decidim-comments/app/frontend/comments/comment.component.test.jsx +22 -21
- data/decidim-comments/app/frontend/comments/comment.fragment.graphql +4 -4
- data/decidim-comments/app/frontend/comments/comment_data.fragment.graphql +4 -3
- data/decidim-comments/app/frontend/comments/comment_order_selector.component.jsx +1 -1
- data/decidim-comments/app/frontend/comments/comment_thread.component.jsx +3 -3
- data/decidim-comments/app/frontend/comments/comment_thread.component.test.jsx +3 -3
- data/decidim-comments/app/frontend/comments/comment_thread.fragment.graphql +1 -1
- data/decidim-comments/app/frontend/comments/comments.component.jsx +47 -39
- data/decidim-comments/app/frontend/comments/comments.component.test.jsx +51 -38
- data/decidim-comments/app/frontend/comments/comments.query.graphql +10 -4
- data/decidim-comments/app/frontend/comments/down_vote_button.component.jsx +6 -3
- data/decidim-comments/app/frontend/comments/up_vote_button.component.jsx +7 -4
- data/decidim-comments/app/frontend/support/generate_comments_data.js +4 -4
- data/decidim-comments/app/models/decidim/comments/comment.rb +7 -9
- data/decidim-comments/app/queries/decidim/comments/{comments_with_replies.rb → sorted_comments.rb} +3 -8
- data/decidim-comments/app/types/decidim/comments/commentable_interface.rb +44 -0
- data/decidim-comments/app/types/decidim/comments/commentable_mutation_type.rb +29 -0
- data/decidim-comments/app/types/decidim/comments/commentable_type.rb +14 -0
- data/decidim-comments/config/locales/ca.yml +3 -1
- data/decidim-comments/config/locales/en.yml +5 -2
- data/decidim-comments/config/locales/es.yml +3 -1
- data/decidim-comments/lib/decidim/comments.rb +4 -0
- data/decidim-comments/{app/types/decidim/comments → lib/decidim/comments/api}/add_comment_type.rb +0 -0
- data/decidim-comments/{app/types/decidim/comments → lib/decidim/comments/api}/comment_mutation_type.rb +0 -0
- data/decidim-comments/{app/types/decidim/comments → lib/decidim/comments/api}/comment_type.rb +11 -17
- data/decidim-comments/lib/decidim/comments/commentable.rb +45 -0
- data/decidim-comments/lib/decidim/comments/comments_helper.rb +15 -10
- data/decidim-comments/lib/decidim/comments/mutation_extensions.rb +8 -16
- data/decidim-comments/lib/decidim/comments/query_extensions.rb +5 -8
- data/decidim-comments/lib/decidim/comments/test/factories.rb +3 -3
- data/decidim-comments/spec/commands/vote_comment_spec.rb +3 -1
- data/decidim-comments/spec/features/comments_spec.rb +28 -14
- data/decidim-comments/spec/features/notifications_spec.rb +1 -1
- data/decidim-comments/spec/helpers/comments_helper_spec.rb +4 -27
- data/decidim-comments/spec/models/comment_spec.rb +7 -11
- data/decidim-comments/spec/models/comment_vote_spec.rb +3 -1
- data/decidim-comments/spec/models/seed_spec.rb +3 -4
- data/decidim-comments/spec/queries/{comments_with_replies_spec.rb → sorted_comments_spec.rb} +12 -29
- data/decidim-comments/spec/types/comment_type_spec.rb +23 -17
- data/decidim-comments/spec/types/commentable_mutation_type_spec.rb +34 -0
- data/decidim-comments/spec/types/commentable_type_spec.rb +48 -0
- data/decidim-comments/spec/types/mutation_type_spec.rb +5 -22
- data/decidim-comments/spec/types/query_type_spec.rb +0 -24
- data/decidim-dev/config/i18n-tasks.yml +4 -0
- data/decidim-dev/decidim-dev.gemspec +1 -1
- data/decidim-dev/lib/decidim/dev/test/rspec_support/action_mailer.rb +10 -4
- data/decidim-dev/lib/decidim/dev/test/rspec_support/feature.rb +6 -5
- data/decidim-dev/lib/decidim/dev/test/rspec_support/i18n.rb +0 -1
- data/decidim-meetings/app/assets/javascripts/decidim/meetings/map.js.es6.erb +8 -3
- data/decidim-meetings/app/assets/stylesheets/decidim/meetings/map.css +3 -1
- data/decidim-meetings/app/controllers/decidim/meetings/meetings_controller.rb +2 -2
- data/decidim-meetings/app/forms/decidim/meetings/admin/close_meeting_form.rb +2 -1
- data/decidim-meetings/app/helpers/decidim/meetings/map_helper.rb +1 -0
- data/decidim-meetings/app/services/decidim/meetings/meeting_search.rb +7 -3
- data/decidim-meetings/app/views/decidim/meetings/meetings/_datetime.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/_filters.html.erb +5 -5
- data/decidim-meetings/app/views/decidim/meetings/meetings/_linked_meetings.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/index.html.erb +1 -5
- data/decidim-meetings/app/views/decidim/meetings/meetings/show.html.erb +16 -9
- data/decidim-meetings/config/locales/ca.yml +2 -3
- data/decidim-meetings/config/locales/en.yml +2 -3
- data/decidim-meetings/config/locales/es.yml +2 -3
- data/decidim-meetings/spec/features/explore_meetings_spec.rb +75 -24
- data/decidim-meetings/spec/forms/close_meeting_form_spec.rb +1 -1
- data/decidim-meetings/spec/services/meeting_search_spec.rb +15 -12
- data/decidim-meetings/vendor/assets/javascripts/leaflet.markercluster.js +7 -0
- data/decidim-meetings/vendor/assets/stylesheets/MarkerCluster.Default.css +60 -0
- data/decidim-meetings/vendor/assets/stylesheets/MarkerCluster.css +14 -0
- data/decidim-pages/app/models/decidim/pages/page.rb +22 -0
- data/decidim-pages/app/views/decidim/pages/application/show.html.erb +2 -6
- data/decidim-pages/config/locales/ca.yml +2 -2
- data/decidim-pages/config/locales/en.yml +2 -2
- data/decidim-pages/config/locales/es.yml +2 -2
- data/decidim-pages/lib/decidim/pages/feature.rb +2 -2
- data/decidim-pages/spec/features/page_show_spec.rb +0 -33
- data/decidim-proposals/app/controllers/decidim/proposals/admin/proposal_answers_controller.rb +2 -0
- data/decidim-proposals/app/controllers/decidim/proposals/admin/proposals_controller.rb +2 -0
- data/decidim-proposals/app/models/decidim/proposals/abilities/admin_user.rb +45 -0
- data/decidim-proposals/app/models/decidim/proposals/abilities/process_admin_user.rb +57 -0
- data/decidim-proposals/app/models/decidim/proposals/proposal.rb +21 -0
- data/decidim-proposals/app/views/decidim/proposals/admin/proposals/_form.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/admin/proposals/index.html.erb +16 -10
- data/decidim-proposals/app/views/decidim/proposals/proposal_votes/update_buttons_and_counters.js.erb +4 -4
- data/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb +7 -3
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal.html.erb +2 -6
- data/decidim-proposals/app/views/decidim/proposals/proposals/_remaining_votes_count.html.erb +3 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_tags.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb +23 -21
- data/decidim-proposals/app/views/decidim/proposals/proposals/_votes_count.html.erb +9 -6
- data/decidim-proposals/app/views/decidim/proposals/proposals/_votes_limit.html.erb +1 -3
- data/decidim-proposals/app/views/decidim/proposals/proposals/index.html.erb +0 -4
- data/decidim-proposals/app/views/decidim/proposals/proposals/new.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/show.html.erb +2 -6
- data/decidim-proposals/config/locales/ca.yml +8 -1
- data/decidim-proposals/config/locales/en.yml +8 -1
- data/decidim-proposals/config/locales/es.yml +8 -1
- data/decidim-proposals/lib/decidim/proposals/admin_engine.rb +7 -0
- data/decidim-proposals/lib/decidim/proposals/feature.rb +6 -2
- data/decidim-proposals/spec/features/proposals_spec.rb +226 -40
- data/decidim-proposals/spec/models/decidim/proposals/abilities/admin_user_spec.rb +62 -0
- data/decidim-proposals/spec/models/decidim/proposals/abilities/process_admin_user_spec.rb +63 -0
- data/decidim-proposals/spec/shared/manage_proposals_examples.rb +161 -50
- data/decidim-results/app/models/decidim/results/result.rb +21 -0
- data/decidim-results/app/views/decidim/results/results/index.html.erb +0 -4
- data/decidim-results/app/views/decidim/results/results/show.html.erb +2 -8
- data/decidim-results/config/i18n-tasks.yml +1 -0
- data/decidim-results/config/locales/ca.yml +5 -2
- data/decidim-results/config/locales/en.yml +5 -2
- data/decidim-results/config/locales/es.yml +5 -2
- data/decidim-results/lib/decidim/results/feature.rb +2 -2
- data/decidim-results/spec/services/result_stats_calculator_spec.rb +2 -2
- data/decidim-results/spec/shared/admin_shared_context.rb +1 -1
- data/decidim-system/config/i18n-tasks.yml +1 -1
- data/package.json +50 -51
- data/yarn.lock +198 -151
- metadata +69 -36
- data/decidim-admin/spec/features/admin_access_control.rb +0 -52
- data/decidim-api/lib/decidim/api/types/author_interface.rb +0 -13
- data/decidim-api/lib/decidim/api/types/localized_string.rb +0 -13
- data/decidim-api/lib/decidim/api/types/translated_field.rb +0 -44
- data/decidim-api/spec/types/localized_string_type_spec.rb +0 -31
- data/decidim-api/spec/types/translated_field_type_spec.rb +0 -69
- data/decidim-comments/app/frontend/comments/add_comment_form.fragment.graphql +0 -6
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
describe Decidim::Proposals::Abilities::AdminUser do
|
5
|
+
let(:user) { build(:user, :admin) }
|
6
|
+
let(:context) { {} }
|
7
|
+
|
8
|
+
subject { described_class.new(user, context) }
|
9
|
+
|
10
|
+
context "when the user is not an admin" do
|
11
|
+
let(:user) { build(:user) }
|
12
|
+
|
13
|
+
it "doesn't have any permission" do
|
14
|
+
expect(subject.permissions[:can]).to be_empty
|
15
|
+
expect(subject.permissions[:cannot]).to be_empty
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it { is_expected.to be_able_to(:manage, Decidim::Proposals::Proposal) }
|
20
|
+
|
21
|
+
context "when creation is disabled" do
|
22
|
+
let(:context) do
|
23
|
+
{
|
24
|
+
current_settings: double(creation_enabled?: false),
|
25
|
+
feature_settings: double(official_proposals_enabled: true)
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
it { is_expected.not_to be_able_to(:create, Decidim::Proposals::Proposal) }
|
30
|
+
end
|
31
|
+
|
32
|
+
context "when official proposals are disabled" do
|
33
|
+
let(:context) do
|
34
|
+
{
|
35
|
+
current_settings: double(creation_enabled?: true),
|
36
|
+
feature_settings: double(official_proposals_enabled: false)
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
it { is_expected.not_to be_able_to(:create, Decidim::Proposals::Proposal) }
|
41
|
+
end
|
42
|
+
|
43
|
+
context "when proposal_answering is disabled in step level" do
|
44
|
+
let(:context) do
|
45
|
+
{
|
46
|
+
current_settings: double(proposal_answering_enabled: false)
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
it { is_expected.not_to be_able_to(:update, Decidim::Proposals::Proposal) }
|
51
|
+
end
|
52
|
+
|
53
|
+
context "when proposal_answering is disabled in feature level" do
|
54
|
+
let(:context) do
|
55
|
+
{
|
56
|
+
feature_settings: double(proposal_answering_enabled: false)
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
it { is_expected.not_to be_able_to(:update, Decidim::Proposals::Proposal) }
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
describe Decidim::Proposals::Abilities::ProcessAdminUser do
|
5
|
+
let(:user) { build(:user) }
|
6
|
+
let(:user_process) { create :participatory_process, organization: user.organization }
|
7
|
+
let(:context) { {} }
|
8
|
+
|
9
|
+
subject { described_class.new(user, context) }
|
10
|
+
|
11
|
+
context "when the user is an admin" do
|
12
|
+
let(:user) { build(:user, :admin) }
|
13
|
+
|
14
|
+
it "doesn't have any permission" do
|
15
|
+
expect(subject.permissions[:can]).to be_empty
|
16
|
+
expect(subject.permissions[:cannot]).to be_empty
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it { is_expected.to be_able_to(:manage, Decidim::Proposals::Proposal) }
|
21
|
+
|
22
|
+
context "when creation is disabled" do
|
23
|
+
let(:context) do
|
24
|
+
{
|
25
|
+
current_settings: double(creation_enabled?: false),
|
26
|
+
feature_settings: double(official_proposals_enabled: true)
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
it { is_expected.not_to be_able_to(:create, Decidim::Proposals::Proposal) }
|
31
|
+
end
|
32
|
+
|
33
|
+
context "when official proposals are disabled" do
|
34
|
+
let(:context) do
|
35
|
+
{
|
36
|
+
current_settings: double(creation_enabled?: true),
|
37
|
+
feature_settings: double(official_proposals_enabled: false)
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
it { is_expected.not_to be_able_to(:create, Decidim::Proposals::Proposal) }
|
42
|
+
end
|
43
|
+
|
44
|
+
context "when proposal_answering is disabled in step level" do
|
45
|
+
let(:context) do
|
46
|
+
{
|
47
|
+
current_settings: double(proposal_answering_enabled: false)
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
it { is_expected.not_to be_able_to(:update, Decidim::Proposals::Proposal) }
|
52
|
+
end
|
53
|
+
|
54
|
+
context "when proposal_answering is disabled in feature level" do
|
55
|
+
let(:context) do
|
56
|
+
{
|
57
|
+
feature_settings: double(proposal_answering_enabled: false)
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
it { is_expected.not_to be_able_to(:update, Decidim::Proposals::Proposal) }
|
62
|
+
end
|
63
|
+
end
|
@@ -12,77 +12,188 @@ RSpec.shared_examples "manage proposals" do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
context "creation" do
|
16
|
+
context "when official_proposals setting is enabled" do
|
17
|
+
before do
|
18
|
+
current_feature.update_attributes(settings: { official_proposals_enabled: true } )
|
19
|
+
end
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
context "when creation is enabled" do
|
22
|
+
before do
|
23
|
+
current_feature.update_attributes(
|
24
|
+
step_settings: {
|
25
|
+
current_feature.participatory_process.active_step.id => {
|
26
|
+
creation_enabled: true
|
27
|
+
}
|
28
|
+
}
|
29
|
+
)
|
30
|
+
end
|
23
31
|
|
24
|
-
|
25
|
-
|
32
|
+
context "when scoped_proposals setting is enabled" do
|
33
|
+
before do
|
34
|
+
current_feature.update_attributes(settings: { scoped_proposals_enabled: true } )
|
35
|
+
end
|
36
|
+
|
37
|
+
it "can be filtered by scope" do
|
38
|
+
find(".actions .new").click
|
39
|
+
|
40
|
+
within "form" do
|
41
|
+
expect(page).to have_content(/Scope/i)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when scoped_proposals setting is not enabled" do
|
47
|
+
before do
|
48
|
+
current_feature.update_attributes(settings: { scoped_proposals_enabled: false } )
|
49
|
+
end
|
50
|
+
|
51
|
+
it "cannot be filtered by scope" do
|
52
|
+
find(".actions .new").click
|
53
|
+
|
54
|
+
within "form" do
|
55
|
+
expect(page).not_to have_content(/Scope/i)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
it "creates a new proposal" do
|
61
|
+
find(".actions .new").click
|
26
62
|
|
27
|
-
|
28
|
-
|
63
|
+
within ".new_proposal" do
|
64
|
+
fill_in :proposal_title, with: "Make decidim great again"
|
65
|
+
fill_in :proposal_body, with: "Decidim is great but it can be better"
|
66
|
+
select category.name["en"], from: :proposal_category_id
|
67
|
+
select scope.name, from: :proposal_scope_id
|
68
|
+
|
69
|
+
find("*[type=submit]").click
|
70
|
+
end
|
71
|
+
|
72
|
+
within ".flash" do
|
73
|
+
expect(page).to have_content("successfully")
|
74
|
+
end
|
75
|
+
|
76
|
+
within "table" do
|
77
|
+
proposal = Decidim::Proposals::Proposal.last
|
78
|
+
|
79
|
+
expect(page).to have_content("Make decidim great again")
|
80
|
+
expect(proposal.body).to eq("Decidim is great but it can be better")
|
81
|
+
expect(proposal.category).to eq(category)
|
82
|
+
expect(proposal.scope).to eq(scope)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
29
86
|
end
|
30
87
|
|
31
|
-
|
32
|
-
|
88
|
+
context "when official_proposals setting is disabled" do
|
89
|
+
before do
|
90
|
+
current_feature.update_attributes(settings: { official_proposals_enabled: false } )
|
91
|
+
end
|
33
92
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
93
|
+
it "cannot create a new proposal" do
|
94
|
+
visit_feature
|
95
|
+
expect(page).not_to have_selector(".actions .new")
|
96
|
+
end
|
38
97
|
end
|
39
98
|
end
|
40
99
|
|
41
|
-
|
42
|
-
|
43
|
-
|
100
|
+
context "when the proposal_answering feature setting is enabled" do
|
101
|
+
before do
|
102
|
+
current_feature.update_attributes(settings: { proposal_answering_enabled: true } )
|
44
103
|
end
|
45
104
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
105
|
+
context "when the proposal_answering step setting is enabled" do
|
106
|
+
before do
|
107
|
+
current_feature.update_attributes(
|
108
|
+
step_settings: {
|
109
|
+
current_feature.participatory_process.active_step.id => {
|
110
|
+
proposal_answering_enabled: true
|
111
|
+
}
|
112
|
+
}
|
113
|
+
)
|
114
|
+
end
|
57
115
|
|
58
|
-
|
59
|
-
|
60
|
-
|
116
|
+
it "can reject a proposal" do
|
117
|
+
within find("tr", text: proposal.title) do
|
118
|
+
click_link "Answer"
|
119
|
+
end
|
120
|
+
|
121
|
+
within ".edit_proposal_answer" do
|
122
|
+
fill_in_i18n(
|
123
|
+
:proposal_answer_answer,
|
124
|
+
"#answer-tabs",
|
125
|
+
en: "The proposal doesn't make any sense",
|
126
|
+
es: "La propuesta no tiene sentido",
|
127
|
+
ca: "La proposta no te sentit"
|
128
|
+
)
|
129
|
+
choose "Rejected"
|
130
|
+
click_button "Answer proposal"
|
131
|
+
end
|
132
|
+
|
133
|
+
within ".flash" do
|
134
|
+
expect(page).to have_content("Proposal successfully answered")
|
135
|
+
end
|
61
136
|
|
62
|
-
|
63
|
-
|
64
|
-
|
137
|
+
within find("tr", text: proposal.title) do
|
138
|
+
within find("td:nth-child(4)") do
|
139
|
+
expect(page).to have_content("Rejected")
|
140
|
+
end
|
141
|
+
end
|
65
142
|
end
|
66
|
-
end
|
67
|
-
end
|
68
143
|
|
69
|
-
|
70
|
-
|
71
|
-
|
144
|
+
it "can accept a proposal" do
|
145
|
+
within find("tr", text: proposal.title) do
|
146
|
+
click_link "Answer"
|
147
|
+
end
|
148
|
+
|
149
|
+
within ".edit_proposal_answer" do
|
150
|
+
choose "Accepted"
|
151
|
+
click_button "Answer proposal"
|
152
|
+
end
|
153
|
+
|
154
|
+
within ".flash" do
|
155
|
+
expect(page).to have_content("Proposal successfully answered")
|
156
|
+
end
|
157
|
+
|
158
|
+
within find("tr", text: proposal.title) do
|
159
|
+
within find("td:nth-child(4)") do
|
160
|
+
expect(page).to have_content("Accepted")
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
72
164
|
end
|
73
165
|
|
74
|
-
|
75
|
-
|
76
|
-
|
166
|
+
context "when the proposal_answering step setting is disabled" do
|
167
|
+
before do
|
168
|
+
current_feature.update_attributes(
|
169
|
+
step_settings: {
|
170
|
+
current_feature.participatory_process.active_step.id => {
|
171
|
+
proposal_answering_enabled: false
|
172
|
+
}
|
173
|
+
}
|
174
|
+
)
|
175
|
+
end
|
176
|
+
|
177
|
+
it "cannot answer a proposal" do
|
178
|
+
visit current_path
|
179
|
+
|
180
|
+
within find("tr", text: proposal.title) do
|
181
|
+
expect(page).to have_no_css("a", text: "Answer")
|
182
|
+
end
|
183
|
+
end
|
77
184
|
end
|
185
|
+
end
|
78
186
|
|
79
|
-
|
80
|
-
|
187
|
+
context "when the proposal_answering feature setting is disabled" do
|
188
|
+
before do
|
189
|
+
current_feature.update_attributes(settings: { proposal_answering_enabled: false } )
|
81
190
|
end
|
82
191
|
|
83
|
-
|
84
|
-
|
85
|
-
|
192
|
+
it "cannot answer a proposal" do
|
193
|
+
visit current_path
|
194
|
+
|
195
|
+
within find("tr", text: proposal.title) do
|
196
|
+
expect(page).to have_no_css("a", text: "Answer")
|
86
197
|
end
|
87
198
|
end
|
88
199
|
end
|
@@ -8,8 +8,29 @@ module Decidim
|
|
8
8
|
include Decidim::HasFeature
|
9
9
|
include Decidim::HasScope
|
10
10
|
include Decidim::HasCategory
|
11
|
+
include Decidim::Comments::Commentable
|
11
12
|
|
12
13
|
feature_manifest_name "results"
|
14
|
+
|
15
|
+
# Public: Overrides the `commentable?` Commentable concern method.
|
16
|
+
def commentable?
|
17
|
+
feature.settings.comments_enabled?
|
18
|
+
end
|
19
|
+
|
20
|
+
# Public: Overrides the `accepts_new_comments?` Commentable concern method.
|
21
|
+
def accepts_new_comments?
|
22
|
+
commentable? && !feature.active_step_settings.comments_blocked
|
23
|
+
end
|
24
|
+
|
25
|
+
# Public: Overrides the `comments_have_alignment?` Commentable concern method.
|
26
|
+
def comments_have_alignment?
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
# Public: Overrides the `comments_have_votes?` Commentable concern method.
|
31
|
+
def comments_have_votes?
|
32
|
+
true
|
33
|
+
end
|
13
34
|
end
|
14
35
|
end
|
15
36
|
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
<% add_meta_tags({
|
1
|
+
<% add_decidim_meta_tags({
|
4
2
|
description: translated_attribute(result.description),
|
5
3
|
title: translated_attribute(result.title),
|
6
4
|
url: result_url(result.id)
|
@@ -52,11 +50,7 @@
|
|
52
50
|
</div>
|
53
51
|
</div>
|
54
52
|
|
55
|
-
<%=
|
56
|
-
<% if feature_settings.comments_always_enabled || current_settings.comments_enabled %>
|
57
|
-
<%= comments_for result, arguable: true, votable: true %>
|
58
|
-
<% end %>
|
59
|
-
<% end %>
|
53
|
+
<%= comments_for result %>
|
60
54
|
|
61
55
|
<%= javascript_include_tag "decidim/proposals/social_share" %>
|
62
56
|
<%= stylesheet_link_tag "decidim/proposals/social_share" %>
|
@@ -3,6 +3,11 @@ ca:
|
|
3
3
|
features:
|
4
4
|
results:
|
5
5
|
name: Resultats
|
6
|
+
settings:
|
7
|
+
global:
|
8
|
+
comments_enabled: Comentaris habilitats
|
9
|
+
step:
|
10
|
+
comments_blocked: Comentaris bloquejats
|
6
11
|
resource_links:
|
7
12
|
included_proposals:
|
8
13
|
proposals: Propostes incloses en aquest resultat
|
@@ -49,8 +54,6 @@ ca:
|
|
49
54
|
category: Categoria
|
50
55
|
scopes: Àmbits
|
51
56
|
search: Cerca
|
52
|
-
index:
|
53
|
-
meta_title: "%{feature_name}"
|
54
57
|
show:
|
55
58
|
stats:
|
56
59
|
attendees: Assistents
|