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
@@ -111,9 +111,6 @@ it:
|
|
111
111
|
edit:
|
112
112
|
title: Modifica allegato
|
113
113
|
update: Aggiorna
|
114
|
-
form:
|
115
|
-
current_file: File corrente
|
116
|
-
url: URL
|
117
114
|
new:
|
118
115
|
create: Crea allegato
|
119
116
|
title: Nuovo allegato
|
@@ -381,9 +378,7 @@ it:
|
|
381
378
|
edit:
|
382
379
|
update: Aggiorna
|
383
380
|
form:
|
384
|
-
current_image: Immagine corrente
|
385
381
|
title: Informazioni generali
|
386
|
-
url: URL
|
387
382
|
index:
|
388
383
|
not_published: Non pubblicato
|
389
384
|
published: Pubblicato
|
@@ -16,7 +16,11 @@ Decidim::Admin::Engine.routes.draw do
|
|
16
16
|
post :ordering, to: "participatory_process_step_ordering#create"
|
17
17
|
end
|
18
18
|
end
|
19
|
-
resources :user_roles, controller: "participatory_process_user_roles"
|
19
|
+
resources :user_roles, controller: "participatory_process_user_roles" do
|
20
|
+
member do
|
21
|
+
post :resend_invitation, to: "participatory_process_user_roles#resend_invitation"
|
22
|
+
end
|
23
|
+
end
|
20
24
|
resources :attachments, controller: "participatory_process_attachments"
|
21
25
|
|
22
26
|
resources :features do
|
@@ -44,8 +48,6 @@ Decidim::Admin::Engine.routes.draw do
|
|
44
48
|
mount manifest.admin_engine, at: "/", as: "decidim_admin_#{manifest.name}"
|
45
49
|
end
|
46
50
|
end
|
47
|
-
|
48
|
-
get "/", to: redirect("/404"), as: :manage_feature
|
49
51
|
end
|
50
52
|
|
51
53
|
resources :static_pages
|
@@ -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-admin"
|
13
|
+
s.summary = "Organization administration"
|
14
14
|
s.description = "Organization administration to manage a single organization."
|
15
15
|
s.files = Dir["{app,config,db,lib,vendor}/**/*", "Rakefile", "README.md"]
|
16
16
|
|
@@ -25,8 +25,7 @@ RSpec.shared_examples "manage attachments examples" do
|
|
25
25
|
|
26
26
|
expect(page).to have_selector("input#attachment_title_en[value='#{translated(attachment.title, locale: :en)}']")
|
27
27
|
expect(page).to have_selector("input#attachment_description_en[value='#{translated(attachment.description, locale: :en)}']")
|
28
|
-
expect(page).to
|
29
|
-
expect(page).to have_css("img[src~='#{attachment.thumbnail_url}']")
|
28
|
+
expect(page).to have_css("img[src~='#{attachment.url}']")
|
30
29
|
end
|
31
30
|
|
32
31
|
it "can add attachments to a process" do
|
@@ -21,7 +21,7 @@ describe Decidim::Admin::CreateParticipatoryProcessAdmin do
|
|
21
21
|
|
22
22
|
subject { described_class.new(form, current_user, my_process) }
|
23
23
|
|
24
|
-
context "when
|
24
|
+
context "when the form is not valid" do
|
25
25
|
let(:invalid) { true }
|
26
26
|
|
27
27
|
it "is not valid" do
|
@@ -29,41 +29,57 @@ describe Decidim::Admin::CreateParticipatoryProcessAdmin do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
context "when
|
33
|
-
|
32
|
+
context "when everything is ok" do
|
33
|
+
it "creates the user role" do
|
34
|
+
subject.call
|
35
|
+
roles = Decidim::Admin::ParticipatoryProcessUserRole.where(user: user)
|
34
36
|
|
35
|
-
|
37
|
+
expect(roles.count).to eq 1
|
38
|
+
expect(roles.first.role).to eq "admin"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "creates a new user with no application admin privileges" do
|
36
42
|
subject.call
|
37
|
-
expect(Decidim::User.last.
|
43
|
+
expect(Decidim::User.last.roles).not_to include("admin")
|
38
44
|
end
|
39
|
-
end
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
context "when there is no user with the given email" do
|
47
|
+
let(:email) { "does_not_exist@example.com" }
|
48
|
+
|
49
|
+
it "creates a new user with said email" do
|
50
|
+
subject.call
|
51
|
+
expect(Decidim::User.last.email).to eq(email)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "creates a new user with no application admin privileges" do
|
55
|
+
subject.call
|
56
|
+
expect(Decidim::User.last.roles).not_to include("admin")
|
57
|
+
end
|
49
58
|
end
|
50
59
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
60
|
+
context "when a user and a role already exist" do
|
61
|
+
before do
|
62
|
+
subject.call
|
63
|
+
end
|
55
64
|
|
56
|
-
|
65
|
+
it "doesn't get created twice" do
|
66
|
+
expect { subject.call }.to broadcast(:ok)
|
67
|
+
|
68
|
+
roles = Decidim::Admin::ParticipatoryProcessUserRole.where(user: user)
|
69
|
+
|
70
|
+
expect(roles.count).to eq 1
|
71
|
+
expect(roles.first.role).to eq "admin"
|
72
|
+
end
|
57
73
|
end
|
58
|
-
end
|
59
74
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
75
|
+
context "when the user hasn't accepted the invitation" do
|
76
|
+
before do
|
77
|
+
user.invite!
|
78
|
+
end
|
64
79
|
|
65
|
-
|
66
|
-
|
80
|
+
it "gets the invitation resent" do
|
81
|
+
expect { subject.call }.to have_enqueued_job(ActionMailer::DeliveryJob)
|
82
|
+
end
|
67
83
|
end
|
68
84
|
end
|
69
85
|
end
|
@@ -82,10 +82,11 @@ describe Decidim::Admin::CreateParticipatoryProcess do
|
|
82
82
|
expect { subject.call }.to broadcast(:ok)
|
83
83
|
end
|
84
84
|
|
85
|
-
it "adds the default step" do
|
85
|
+
it "adds the default active step" do
|
86
86
|
subject.call do
|
87
87
|
on(:ok) do |process|
|
88
88
|
expect(process.steps.count).to eq(1)
|
89
|
+
expect(process.steps.first).to be_active
|
89
90
|
end
|
90
91
|
end
|
91
92
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
describe Decidim::Admin::CreateParticipatoryProcessStep do
|
6
|
+
let(:participatory_process) { create :participatory_process }
|
7
|
+
let(:form) do
|
8
|
+
instance_double(
|
9
|
+
Decidim::Admin::ParticipatoryProcessStepForm,
|
10
|
+
title: { en: "title" },
|
11
|
+
description: { en: "description" },
|
12
|
+
start_date: Time.current,
|
13
|
+
end_date: Time.current + 1.week,
|
14
|
+
invalid?: invalid
|
15
|
+
)
|
16
|
+
end
|
17
|
+
let(:invalid) { false }
|
18
|
+
|
19
|
+
subject { described_class.new(form, participatory_process) }
|
20
|
+
|
21
|
+
context "when the form is not valid" do
|
22
|
+
let(:invalid) { true }
|
23
|
+
|
24
|
+
it "broadcasts invalid" do
|
25
|
+
expect { subject.call }.to broadcast(:invalid)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when everything is ok" do
|
30
|
+
it "creates a participatory process step" do
|
31
|
+
expect { subject.call }.to change { Decidim::ParticipatoryProcessStep.count }.by(1)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "broadcasts ok" do
|
35
|
+
expect { subject.call }.to broadcast(:ok)
|
36
|
+
end
|
37
|
+
|
38
|
+
context "when the process has no active steps" do
|
39
|
+
it "creates the step as active" do
|
40
|
+
subject.call
|
41
|
+
expect(Decidim::ParticipatoryProcessStep.last).to be_active
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context "when the process has active steps" do
|
46
|
+
before do
|
47
|
+
create(:participatory_process_step, participatory_process: participatory_process, active: true)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "creates the step as active" do
|
51
|
+
subject.call
|
52
|
+
expect(Decidim::ParticipatoryProcessStep.last).not_to be_active
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -52,8 +52,8 @@ describe Decidim::Admin::DestroyParticipatoryProcessStep, class: true do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
context "when trying to destroy the last step" do
|
55
|
-
it "broadcasts
|
56
|
-
expect { subject.call(active_step) }.to broadcast(:
|
55
|
+
it "broadcasts ok" do
|
56
|
+
expect { subject.call(active_step) }.to broadcast(:ok)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -25,6 +25,12 @@ module Decidim
|
|
25
25
|
dummy_global_attribute_1: true,
|
26
26
|
dummy_global_attribute_2: false
|
27
27
|
},
|
28
|
+
default_step_settings: {
|
29
|
+
step.id.to_s => {
|
30
|
+
dummy_step_attribute_1: true,
|
31
|
+
dummy_step_attribute_2: false
|
32
|
+
}
|
33
|
+
},
|
28
34
|
step_settings: {
|
29
35
|
step.id.to_s => {
|
30
36
|
dummy_step_attribute_1: true,
|
@@ -6,19 +6,16 @@ module Decidim
|
|
6
6
|
module Admin
|
7
7
|
describe ParticipatoryProcessesController, type: :controller do
|
8
8
|
let(:organization) { create(:organization) }
|
9
|
-
let
|
9
|
+
let(:user) { create(:user, :admin, :confirmed, organization: organization) }
|
10
10
|
|
11
11
|
before do
|
12
12
|
@request.env["decidim.current_organization"] = organization
|
13
|
+
sign_in user, scope: :user
|
13
14
|
end
|
14
15
|
|
15
16
|
describe "GET show" do
|
16
17
|
context "process in another organization" do
|
17
|
-
let(:
|
18
|
-
|
19
|
-
before do
|
20
|
-
sign_in user, scope: :user
|
21
|
-
end
|
18
|
+
let!(:external_process) { create :participatory_process }
|
22
19
|
|
23
20
|
it "is not visible to the user" do
|
24
21
|
expect do
|
@@ -25,13 +25,13 @@ describe "Admin copy participatory process", type: :feature do
|
|
25
25
|
|
26
26
|
within ".copy_participatory_process" do
|
27
27
|
fill_in_i18n(
|
28
|
-
:
|
29
|
-
"#
|
28
|
+
:participatory_process_title,
|
29
|
+
"#participatory_process-title-tabs",
|
30
30
|
en: "Copy participatory process",
|
31
31
|
es: "Copia del proceso participativo",
|
32
32
|
ca: "Còpia del procés participatiu"
|
33
33
|
)
|
34
|
-
fill_in :
|
34
|
+
fill_in :participatory_process_slug, with: "pp-copy"
|
35
35
|
click_button "Copy"
|
36
36
|
end
|
37
37
|
|
@@ -47,18 +47,18 @@ describe "Admin copy participatory process", type: :feature do
|
|
47
47
|
|
48
48
|
within ".copy_participatory_process" do
|
49
49
|
fill_in_i18n(
|
50
|
-
:
|
51
|
-
"#
|
50
|
+
:participatory_process_title,
|
51
|
+
"#participatory_process-title-tabs",
|
52
52
|
en: "Copy participatory process",
|
53
53
|
es: "Copia del proceso participativo",
|
54
54
|
ca: "Còpia del procés participatiu"
|
55
55
|
)
|
56
|
-
fill_in :
|
56
|
+
fill_in :participatory_process_slug, with: "pp-copy-with-steps"
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
it "copies the process with steps" do
|
61
|
-
page.check("
|
61
|
+
page.check("participatory_process[copy_steps]")
|
62
62
|
click_button "Copy"
|
63
63
|
|
64
64
|
expect(page).to have_content("successfully")
|
@@ -74,7 +74,7 @@ describe "Admin copy participatory process", type: :feature do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it "copies the process with categories" do
|
77
|
-
page.check("
|
77
|
+
page.check("participatory_process[copy_categories]")
|
78
78
|
click_button "Copy"
|
79
79
|
|
80
80
|
expect(page).to have_content("successfully")
|
@@ -90,7 +90,7 @@ describe "Admin copy participatory process", type: :feature do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
it "copies the process with features" do
|
93
|
-
page.check("
|
93
|
+
page.check("participatory_process[copy_features]")
|
94
94
|
click_button "Copy"
|
95
95
|
|
96
96
|
expect(page).to have_content("successfully")
|
@@ -127,6 +127,38 @@ describe "Admin manages features", type: :feature do
|
|
127
127
|
expect(all("input[type=checkbox]").first).to be_checked
|
128
128
|
end
|
129
129
|
end
|
130
|
+
|
131
|
+
context "when the process doesn't have active steps" do
|
132
|
+
let!(:participatory_process) do
|
133
|
+
create(:participatory_process, organization: organization)
|
134
|
+
end
|
135
|
+
|
136
|
+
it "updates the default step settings" do
|
137
|
+
within ".feature-#{feature.id}" do
|
138
|
+
page.find(".action-icon--configure").click
|
139
|
+
end
|
140
|
+
|
141
|
+
within ".edit_feature" do
|
142
|
+
within ".default-step-settings" do
|
143
|
+
all("input[type=checkbox]").first.click
|
144
|
+
end
|
145
|
+
|
146
|
+
find("*[type=submit]").click
|
147
|
+
end
|
148
|
+
|
149
|
+
within ".callout-wrapper" do
|
150
|
+
expect(page).to have_content("successfully")
|
151
|
+
end
|
152
|
+
|
153
|
+
within find("tr", text: "My feature") do
|
154
|
+
page.find(".action-icon--configure").click
|
155
|
+
end
|
156
|
+
|
157
|
+
within ".default-step-settings" do
|
158
|
+
expect(all("input[type=checkbox]").first).to be_checked
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
130
162
|
end
|
131
163
|
|
132
164
|
describe "remove a feature" do
|
@@ -65,10 +65,9 @@ describe "Admin manage participatory processes", type: :feature do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
within ".container" do
|
68
|
-
expect(
|
69
|
-
expect(page).to
|
70
|
-
expect(page).to
|
71
|
-
expect(page).to have_css("img[src*='#{image2_filename}']")
|
68
|
+
expect(current_path).to eq decidim_admin.participatory_process_steps_path(Decidim::ParticipatoryProcess.last)
|
69
|
+
expect(page).to have_content("STEPS")
|
70
|
+
expect(page).to have_content("Introduction")
|
72
71
|
end
|
73
72
|
end
|
74
73
|
|
@@ -69,6 +69,18 @@ module Decidim
|
|
69
69
|
it { is_expected.to be_invalid }
|
70
70
|
end
|
71
71
|
|
72
|
+
context "when slug is invalid" do
|
73
|
+
let(:slug) { "#Slug.Invalid!" }
|
74
|
+
|
75
|
+
it { is_expected.to be_invalid }
|
76
|
+
end
|
77
|
+
|
78
|
+
context "when slug is not downcase" do
|
79
|
+
let(:slug) { "SLUG" }
|
80
|
+
|
81
|
+
it { is_expected.to be_valid }
|
82
|
+
end
|
83
|
+
|
72
84
|
context "when slug is not unique" do
|
73
85
|
before do
|
74
86
|
create(:static_page, organization: organization, slug: slug)
|
@@ -7,9 +7,12 @@ module Decidim
|
|
7
7
|
describe NewsletterJob do
|
8
8
|
let!(:newsletter) { create(:newsletter, organization: organization, total_deliveries: 0) }
|
9
9
|
let!(:organization) { create(:organization) }
|
10
|
+
let!(:another_organization) { create(:organization) }
|
10
11
|
let!(:deliverable_user) { create(:user, :confirmed, newsletter_notifications: true, organization: organization) }
|
12
|
+
let!(:another_deliverable_user) { create(:user, :confirmed, newsletter_notifications: true, organization: another_organization) }
|
11
13
|
let!(:undeliverable_user) { create(:user, newsletter_notifications: true, organization: organization) }
|
12
14
|
let!(:non_deliverable_user) { create(:user, :confirmed, newsletter_notifications: false, organization: organization) }
|
15
|
+
let!(:deleted_user) { create(:user, :confirmed, :deleted, newsletter_notifications: true, organization: organization) }
|
13
16
|
|
14
17
|
it "delivers a newsletter to a the eligible users" do
|
15
18
|
expect(NewsletterDeliveryJob).to receive(:perform_later).with(deliverable_user, newsletter)
|
@@ -78,5 +78,27 @@ RSpec.shared_examples "manage process admins examples" do
|
|
78
78
|
expect(page).not_to have_content(other_user.email)
|
79
79
|
end
|
80
80
|
end
|
81
|
+
|
82
|
+
context "when the user has not accepted the invitation" do
|
83
|
+
before do
|
84
|
+
form = Decidim::Admin::ParticipatoryProcessUserRoleForm.from_params(name: "test",
|
85
|
+
email: "test@example.org",
|
86
|
+
role: "admin")
|
87
|
+
Decidim::Admin::CreateParticipatoryProcessAdmin.call(form, user, participatory_process)
|
88
|
+
visit current_path
|
89
|
+
end
|
90
|
+
|
91
|
+
it "resends the invitation to the user" do
|
92
|
+
within "#process_admins" do
|
93
|
+
within find("#process_admins tr", text: "test@example.org") do
|
94
|
+
page.find(".action-icon.resend-invitation").click
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
within ".callout-wrapper" do
|
99
|
+
expect(page).to have_content("successfully")
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
81
103
|
end
|
82
104
|
end
|