decidim 0.4.0 → 0.4.1
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/CHANGELOG.md +1626 -0
- data/Gemfile.lock +82 -82
- data/decidim-admin/app/assets/stylesheets/decidim/admin/_variables.scss +2 -0
- data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_cards.scss +6 -0
- data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_typography.scss +4 -0
- data/decidim-admin/app/commands/decidim/admin/create_participatory_process_admin.rb +3 -5
- data/decidim-admin/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/categories_controller.rb +9 -9
- data/decidim-admin/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +1 -8
- data/decidim-admin/app/controllers/decidim/admin/exports_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/feature_permissions_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/features/base_controller.rb +0 -5
- data/decidim-admin/app/controllers/decidim/admin/features_controller.rb +4 -4
- data/decidim-admin/app/controllers/decidim/admin/moderations_controller.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_attachments_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_copies_controller.rb +3 -9
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_publications_controller.rb +4 -4
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_steps_controller.rb +6 -6
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +13 -15
- data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +16 -18
- data/decidim-admin/app/controllers/decidim/admin/users_controller.rb +4 -4
- data/decidim-admin/app/forms/decidim/admin/participatory_process_user_role_form.rb +2 -2
- data/decidim-admin/app/models/decidim/admin/abilities/{admin_user.rb → admin_ability.rb} +3 -6
- data/decidim-admin/app/models/decidim/admin/abilities/{base.rb → base_ability.rb} +1 -4
- data/decidim-admin/app/models/decidim/admin/abilities/{participatory_process_admin.rb → participatory_process_admin_ability.rb} +18 -28
- data/decidim-admin/app/models/decidim/admin/abilities/participatory_process_collaborator_ability.rb +19 -0
- data/decidim-admin/app/models/decidim/admin/abilities/participatory_process_moderator_ability.rb +23 -0
- data/decidim-admin/app/queries/decidim/admin/process_admins.rb +1 -1
- data/decidim-admin/app/views/decidim/admin/categories/index.html.erb +9 -9
- data/decidim-admin/app/views/decidim/admin/categories/new.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/features/_form.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/features/edit.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/features/new.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_copies/new.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_groups/index.html.erb +5 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_steps/index.html.erb +9 -9
- data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +6 -6
- data/decidim-admin/app/views/decidim/admin/participatory_processes/edit.html.erb +6 -6
- data/decidim-admin/app/views/decidim/admin/participatory_processes/index.html.erb +11 -1
- data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +18 -18
- data/decidim-admin/config/locales/ca.yml +4 -3
- data/decidim-admin/config/locales/en.yml +1 -0
- data/decidim-admin/config/locales/es.yml +1 -2
- data/decidim-admin/db/migrate/20170714083651_rename_participatory_process_user_roles_table.rb +7 -0
- data/decidim-admin/lib/decidim/admin/engine.rb +8 -6
- data/decidim-admin/lib/decidim/admin/test/factories.rb +1 -1
- data/decidim-admin/spec/commands/create_participatory_process_admin_spec.rb +4 -4
- data/decidim-admin/spec/models/abilities/{admin_user_spec.rb → admin_ability_spec.rb} +1 -1
- data/decidim-admin/spec/models/abilities/{participatory_process_admin_spec.rb → participatory_process_admin_ability_spec.rb} +3 -3
- data/decidim-admin/spec/models/abilities/participatory_process_collaborator_ability_spec.rb +18 -0
- data/decidim-admin/spec/queries/process_admins_spec.rb +1 -1
- data/decidim-admin/spec/views/decidim/static_pages/_form.html.erb_spec.rb +1 -1
- data/decidim-budgets/config/locales/ca.yml +2 -2
- data/decidim-comments/app/models/decidim/comments/abilities/admin_ability.rb +19 -0
- data/decidim-comments/app/models/decidim/comments/abilities/{admin_user.rb → current_user_ability.rb} +4 -6
- data/decidim-comments/app/models/decidim/comments/abilities/participatory_process_admin_ability.rb +19 -0
- data/decidim-comments/app/models/decidim/comments/abilities/participatory_process_moderator_ability.rb +19 -0
- data/decidim-comments/lib/decidim/comments/admin_engine.rb +5 -2
- data/decidim-comments/lib/decidim/comments/engine.rb +6 -0
- data/decidim-comments/spec/models/abilities/{admin_user_spec.rb → admin_ability_spec.rb} +1 -1
- data/decidim-comments/spec/models/abilities/{process_admin_user_spec.rb → participatory_process_admin_ability_spec.rb} +3 -2
- data/decidim-meetings/app/controllers/decidim/meetings/meeting_widgets_controller.rb +1 -0
- data/decidim-meetings/app/controllers/decidim/meetings/meetings_controller.rb +2 -2
- data/decidim-meetings/app/views/decidim/meetings/meeting_widgets/show.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/_meetings.html.erb +2 -0
- data/decidim-meetings/config/locales/ca.yml +1 -1
- data/decidim-meetings/spec/features/explore_meetings_spec.rb +11 -0
- data/decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb +2 -1
- data/decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb +1 -1
- data/decidim-proposals/app/helpers/decidim/proposals/application_helper.rb +23 -11
- data/decidim-proposals/app/models/decidim/proposals/abilities/{admin_user.rb → admin_ability.rb} +5 -12
- data/decidim-proposals/app/models/decidim/proposals/abilities/{current_user.rb → current_user_ability.rb} +1 -2
- data/decidim-proposals/app/models/decidim/proposals/abilities/{process_admin_user.rb → participatory_process_admin_ability.rb} +10 -22
- data/decidim-proposals/app/models/decidim/proposals/abilities/participatory_process_moderator_ability.rb +19 -0
- data/decidim-proposals/app/models/decidim/proposals/proposal.rb +8 -0
- data/decidim-proposals/app/services/decidim/proposals/proposal_search.rb +5 -2
- data/decidim-proposals/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal_badge.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposals.html.erb +10 -1
- data/decidim-proposals/config/locales/ca.yml +3 -0
- data/decidim-proposals/config/locales/en.yml +3 -0
- data/decidim-proposals/config/locales/es.yml +3 -0
- data/decidim-proposals/lib/decidim/proposals/admin_engine.rb +5 -2
- data/decidim-proposals/lib/decidim/proposals/engine.rb +1 -1
- data/decidim-proposals/lib/decidim/proposals/feature.rb +4 -0
- data/decidim-proposals/lib/decidim/proposals/proposal_serializer.rb +4 -0
- data/decidim-proposals/spec/features/proposals_spec.rb +12 -5
- data/decidim-proposals/spec/models/decidim/proposals/abilities/{admin_user_spec.rb → admin_ability_spec.rb} +1 -1
- data/decidim-proposals/spec/models/decidim/proposals/abilities/{process_admin_user_spec.rb → participatory_process_admin_ability.rb} +10 -2
- data/decidim-proposals/spec/services/decidim/proposals/proposal_serializer_spec.rb +7 -0
- data/decidim-proposals/spec/shared/manage_proposals_examples.rb +21 -0
- data/decidim-results/app/controllers/decidim/results/results_controller.rb +2 -1
- data/decidim-results/app/views/decidim/results/results/_results.html.erb +2 -0
- data/decidim-results/config/locales/ca.yml +1 -1
- data/decidim-results/spec/features/comments_spec.rb +1 -1
- data/decidim-results/spec/features/explore_results_spec.rb +11 -0
- data/decidim-surveys/app/models/decidim/surveys/abilities/admin_ability.rb +17 -0
- data/decidim-surveys/app/models/decidim/surveys/abilities/{current_user.rb → current_user_ability.rb} +1 -1
- data/decidim-surveys/app/models/decidim/surveys/abilities/participatory_process_admin_ability.rb +19 -0
- data/decidim-surveys/config/locales/ca.yml +1 -1
- data/decidim-surveys/lib/decidim/surveys/admin_engine.rb +4 -2
- data/decidim-surveys/lib/decidim/surveys/engine.rb +1 -1
- data/decidim-surveys/spec/models/decidim/surveys/abilities/{admin_user_spec.rb → admin_ability_spec.rb} +1 -1
- data/decidim-surveys/spec/models/decidim/surveys/abilities/{current_user_spec.rb → current_user_ability_spec.rb} +1 -1
- data/decidim-surveys/spec/models/decidim/surveys/abilities/{process_admin_user_spec.rb → participatory_process_admin_ability_spec.rb} +3 -2
- data/decidim-system/app/commands/decidim/system/register_organization.rb +2 -2
- data/decidim-system/spec/commands/decidim/system/register_organization_spec.rb +1 -1
- data/docs/getting_started.md +1 -1
- data/lib/generators/decidim/templates/initializer.rb +2 -2
- data/package.json +1 -3
- data/yarn.lock +21 -18
- metadata +52 -54
- data/decidim-admin/app/models/decidim/admin/abilities/collaborator_user.rb +0 -20
- data/decidim-admin/app/models/decidim/admin/participatory_process_user_role.rb +0 -15
- data/decidim-admin/app/queries/decidim/admin/manageable_participatory_processes_for_user.rb +0 -42
- data/decidim-admin/app/queries/decidim/admin/process_admin_roles_for_process.rb +0 -36
- data/decidim-admin/db/seeds.rb +0 -24
- data/decidim-admin/spec/models/abilities/collaborator_user_spec.rb +0 -67
- data/decidim-admin/spec/models/participatory_process_user_role_spec.rb +0 -39
- data/decidim-admin/spec/queries/manageable_participatory_processes_for_user_spec.rb +0 -39
- data/decidim-admin/spec/queries/process_admin_roles_for_process_spec.rb +0 -19
- data/decidim-comments/app/models/decidim/comments/abilities/process_admin_user.rb +0 -34
- data/decidim-meetings/app/views/decidim/meetings/meeting_widgets/.erb +0 -16
- data/decidim-surveys/app/models/decidim/surveys/abilities/admin_user.rb +0 -34
- data/decidim-surveys/app/models/decidim/surveys/abilities/process_admin_user.rb +0 -44
@@ -150,7 +150,7 @@ ca:
|
|
150
150
|
error: S'ha produït un error en crear aquesta categoria.
|
151
151
|
success: Categoria creada correctament.
|
152
152
|
destroy:
|
153
|
-
error: S'ha produït un error en eliminar aquesta categoria. Si us plau,
|
153
|
+
error: S'ha produït un error en eliminar aquesta categoria. Si us plau, elimina qualsevol subcategoria en primer lloc, assegura't que cap altra entitat pertany a aquesta categoria i torna a intentar-ho.
|
154
154
|
success: Categoria eliminada correctament.
|
155
155
|
edit:
|
156
156
|
title: Edita categoria
|
@@ -281,6 +281,7 @@ ca:
|
|
281
281
|
roles:
|
282
282
|
admin: Administrador
|
283
283
|
collaborator: Col·laborador
|
284
|
+
moderator: Moderador
|
284
285
|
scope:
|
285
286
|
fields:
|
286
287
|
created_at: Data de creació
|
@@ -331,13 +332,13 @@ ca:
|
|
331
332
|
form:
|
332
333
|
interpolations_hint: 'Consell: Podeu utilitzar "%{name}" en qualsevol part del cos o assumpte i serà reemplaçat pel nom del destinatari.'
|
333
334
|
index:
|
334
|
-
confirm_delete:
|
335
|
+
confirm_delete: Segur que vols suprimir aquest butlletí?
|
335
336
|
title: Butlletins
|
336
337
|
new:
|
337
338
|
save: Desar
|
338
339
|
title: Nou butlletí
|
339
340
|
show:
|
340
|
-
confirm_deliver:
|
341
|
+
confirm_deliver: Segur que vols enviar aquest butlletí? Aquesta acció no es pot desfer.
|
341
342
|
deliver: Enviar butlletí
|
342
343
|
preview: Previsualitzar
|
343
344
|
subject: Assumpte
|
@@ -281,6 +281,7 @@ es:
|
|
281
281
|
roles:
|
282
282
|
admin: Administrador
|
283
283
|
collaborator: Colaborador
|
284
|
+
moderator: Moderador
|
284
285
|
scope:
|
285
286
|
fields:
|
286
287
|
created_at: Fecha de creación
|
@@ -553,8 +554,6 @@ es:
|
|
553
554
|
participatory_processes:
|
554
555
|
participatory_process_groups:
|
555
556
|
none: Ninguno
|
556
|
-
forms:
|
557
|
-
required: Obligatorio
|
558
557
|
layouts:
|
559
558
|
decidim:
|
560
559
|
admin:
|
@@ -13,8 +13,6 @@ require "foundation_rails_helper"
|
|
13
13
|
require "autoprefixer-rails"
|
14
14
|
require "rectify"
|
15
15
|
|
16
|
-
require_dependency File.join(__dir__, "..", "..", "..", "app/models/decidim/admin/abilities/admin_user")
|
17
|
-
|
18
16
|
module Decidim
|
19
17
|
module Admin
|
20
18
|
# Decidim's core Rails Engine.
|
@@ -33,9 +31,12 @@ module Decidim
|
|
33
31
|
|
34
32
|
initializer "decidim_admin.inject_abilities_to_user" do |_app|
|
35
33
|
Decidim.configure do |config|
|
36
|
-
config.
|
37
|
-
|
38
|
-
|
34
|
+
config.admin_abilities += [
|
35
|
+
"Decidim::Admin::Abilities::AdminAbility",
|
36
|
+
"Decidim::Admin::Abilities::ParticipatoryProcessAdminAbility",
|
37
|
+
"Decidim::Admin::Abilities::ParticipatoryProcessCollaboratorAbility",
|
38
|
+
"Decidim::Admin::Abilities::ParticipatoryProcessModeratorAbility"
|
39
|
+
]
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
@@ -57,7 +58,8 @@ module Decidim
|
|
57
58
|
decidim_admin.participatory_process_groups_path,
|
58
59
|
icon_name: "layers",
|
59
60
|
position: 3,
|
60
|
-
active: :inclusive
|
61
|
+
active: :inclusive,
|
62
|
+
if: can?(:read, Decidim::ParticipatoryProcessGroup)
|
61
63
|
|
62
64
|
menu.item I18n.t("menu.static_pages", scope: "decidim.admin"),
|
63
65
|
decidim_admin.static_pages_path,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
FactoryGirl.define do
|
4
|
-
factory :participatory_process_user_role, class: Decidim::
|
4
|
+
factory :participatory_process_user_role, class: Decidim::ParticipatoryProcessUserRole do
|
5
5
|
user
|
6
6
|
participatory_process
|
7
7
|
role "admin"
|
@@ -32,7 +32,7 @@ describe Decidim::Admin::CreateParticipatoryProcessAdmin do
|
|
32
32
|
context "when everything is ok" do
|
33
33
|
it "creates the user role" do
|
34
34
|
subject.call
|
35
|
-
roles = Decidim::
|
35
|
+
roles = Decidim::ParticipatoryProcessUserRole.where(user: user)
|
36
36
|
|
37
37
|
expect(roles.count).to eq 1
|
38
38
|
expect(roles.first.role).to eq "admin"
|
@@ -40,7 +40,7 @@ describe Decidim::Admin::CreateParticipatoryProcessAdmin do
|
|
40
40
|
|
41
41
|
it "creates a new user with no application admin privileges" do
|
42
42
|
subject.call
|
43
|
-
expect(Decidim::User.last
|
43
|
+
expect(Decidim::User.last).not_to be_admin
|
44
44
|
end
|
45
45
|
|
46
46
|
context "when there is no user with the given email" do
|
@@ -53,7 +53,7 @@ describe Decidim::Admin::CreateParticipatoryProcessAdmin do
|
|
53
53
|
|
54
54
|
it "creates a new user with no application admin privileges" do
|
55
55
|
subject.call
|
56
|
-
expect(Decidim::User.last
|
56
|
+
expect(Decidim::User.last).not_to be_admin
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -65,7 +65,7 @@ describe Decidim::Admin::CreateParticipatoryProcessAdmin do
|
|
65
65
|
it "doesn't get created twice" do
|
66
66
|
expect { subject.call }.to broadcast(:ok)
|
67
67
|
|
68
|
-
roles = Decidim::
|
68
|
+
roles = Decidim::ParticipatoryProcessUserRole.where(user: user)
|
69
69
|
|
70
70
|
expect(roles.count).to eq 1
|
71
71
|
expect(roles.first.role).to eq "admin"
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
|
-
describe Decidim::Admin::Abilities::
|
5
|
+
describe Decidim::Admin::Abilities::ParticipatoryProcessAdminAbility do
|
6
6
|
let(:user) { build(:user) }
|
7
7
|
let(:user_process) { create :participatory_process, organization: user.organization }
|
8
8
|
|
9
|
-
subject { described_class.new(user,
|
9
|
+
subject { described_class.new(user, current_participatory_process: user_process) }
|
10
10
|
|
11
11
|
context "when the user does not admin any process" do
|
12
12
|
it { is_expected.not_to be_able_to(:read, :admin_dashboard) }
|
@@ -30,7 +30,7 @@ describe Decidim::Admin::Abilities::ParticipatoryProcessAdmin do
|
|
30
30
|
let(:unmanaged_process_moderation) { create(:moderation) }
|
31
31
|
|
32
32
|
before do
|
33
|
-
create :participatory_process_user_role, user: user, participatory_process: user_process
|
33
|
+
create :participatory_process_user_role, user: user, participatory_process: user_process, role: :admin
|
34
34
|
end
|
35
35
|
|
36
36
|
it { is_expected.to be_able_to(:read, :admin_dashboard) }
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
describe Decidim::Admin::Abilities::ParticipatoryProcessCollaboratorAbility do
|
6
|
+
let(:user) { build(:user) }
|
7
|
+
let(:user_process) { create :participatory_process, organization: user.organization }
|
8
|
+
let(:unmanaged_process) { create :participatory_process, organization: user.organization }
|
9
|
+
|
10
|
+
subject { described_class.new(user, current_participatory_process: user_process) }
|
11
|
+
|
12
|
+
before do
|
13
|
+
create :participatory_process_user_role, user: user, participatory_process: user_process, role: :collaborator
|
14
|
+
end
|
15
|
+
|
16
|
+
it { is_expected.to be_able_to(:preview, user_process) }
|
17
|
+
it { is_expected.not_to be_able_to(:preview, unmanaged_process) }
|
18
|
+
end
|
@@ -8,7 +8,7 @@ describe Decidim::Admin::ProcessAdmins do
|
|
8
8
|
let!(:admin) { create(:user, :admin, :confirmed, organization: organization) }
|
9
9
|
let!(:participatory_process_admin) do
|
10
10
|
user = create(:user, :confirmed, organization: organization)
|
11
|
-
Decidim::
|
11
|
+
Decidim::ParticipatoryProcessUserRole.create!(
|
12
12
|
role: :admin,
|
13
13
|
user: user,
|
14
14
|
participatory_process: participatory_process
|
@@ -12,7 +12,7 @@ ca:
|
|
12
12
|
budgets:
|
13
13
|
actions:
|
14
14
|
attachments: Adjunts
|
15
|
-
confirm_destroy:
|
15
|
+
confirm_destroy: Segur que vols eliminar aquest projecte?
|
16
16
|
destroy: Esborrar
|
17
17
|
edit: Editar
|
18
18
|
new: Nou
|
@@ -58,7 +58,7 @@ ca:
|
|
58
58
|
ok: D'acord
|
59
59
|
title: Pressupost superat
|
60
60
|
budget_summary:
|
61
|
-
are_you_sure:
|
61
|
+
are_you_sure: Segur que vols cancel·lar el teu vot?
|
62
62
|
assigned: 'Assignat:'
|
63
63
|
cancel_order: eliminar el teu vot i començar de nou
|
64
64
|
checked_out:
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Comments
|
5
|
+
module Abilities
|
6
|
+
# Defines the abilities related to comments for a logged in admin user.
|
7
|
+
# Intended to be used with `cancancan`.
|
8
|
+
class AdminAbility < Decidim::Abilities::AdminAbility
|
9
|
+
def define_abilities
|
10
|
+
super
|
11
|
+
|
12
|
+
can :manage, Comment
|
13
|
+
can :unreport, Comment
|
14
|
+
can :hide, Comment
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -3,22 +3,20 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Comments
|
5
5
|
module Abilities
|
6
|
-
# Defines the abilities related to comments for a logged in
|
6
|
+
# Defines the abilities related to comments for a logged in user.
|
7
7
|
# Intended to be used with `cancancan`.
|
8
|
-
class
|
8
|
+
class CurrentUserAbility
|
9
9
|
include CanCan::Ability
|
10
10
|
|
11
11
|
attr_reader :user, :context
|
12
12
|
|
13
13
|
def initialize(user, context)
|
14
|
-
return unless user
|
14
|
+
return unless user
|
15
15
|
|
16
16
|
@user = user
|
17
17
|
@context = context
|
18
18
|
|
19
|
-
can :
|
20
|
-
can :unreport, Comment
|
21
|
-
can :hide, Comment
|
19
|
+
can :report, Decidim::Comments::Comment
|
22
20
|
end
|
23
21
|
end
|
24
22
|
end
|
data/decidim-comments/app/models/decidim/comments/abilities/participatory_process_admin_ability.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Comments
|
5
|
+
module Abilities
|
6
|
+
# Defines the abilities related to comments for a logged in process admin user.
|
7
|
+
# Intended to be used with `cancancan`.
|
8
|
+
class ParticipatoryProcessAdminAbility < Decidim::Abilities::ParticipatoryProcessAdminAbility
|
9
|
+
def define_participatory_process_abilities
|
10
|
+
super
|
11
|
+
|
12
|
+
can [:manage, :unreport, :hide], Comment do |comment|
|
13
|
+
can_manage_process?(comment.feature.participatory_process)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Comments
|
5
|
+
module Abilities
|
6
|
+
# Defines the abilities related to comments for a logged in process moderator user.
|
7
|
+
# Intended to be used with `cancancan`.
|
8
|
+
class ParticipatoryProcessModeratorAbility < Decidim::Abilities::ParticipatoryProcessModeratorAbility
|
9
|
+
def define_participatory_process_abilities
|
10
|
+
super
|
11
|
+
|
12
|
+
can [:unreport, :hide], Comment do |comment|
|
13
|
+
can_manage_process?(comment.feature.participatory_process)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -10,8 +10,11 @@ module Decidim
|
|
10
10
|
|
11
11
|
initializer "decidim_comments.inject_abilities_to_user" do |_app|
|
12
12
|
Decidim.configure do |config|
|
13
|
-
config.admin_abilities += [
|
14
|
-
|
13
|
+
config.admin_abilities += [
|
14
|
+
"Decidim::Comments::Abilities::AdminAbility",
|
15
|
+
"Decidim::Comments::Abilities::ParticipatoryProcessAdminAbility",
|
16
|
+
"Decidim::Comments::Abilities::ParticipatoryProcessModeratorAbility"
|
17
|
+
]
|
15
18
|
end
|
16
19
|
end
|
17
20
|
|
@@ -38,6 +38,12 @@ module Decidim
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
|
+
|
42
|
+
initializer "decidim_comments.inject_abilities_to_user" do |_app|
|
43
|
+
Decidim.configure do |config|
|
44
|
+
config.abilities += ["Decidim::Comments::Abilities::CurrentUserAbility"]
|
45
|
+
end
|
46
|
+
end
|
41
47
|
end
|
42
48
|
end
|
43
49
|
end
|
@@ -2,10 +2,11 @@
|
|
2
2
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
|
-
describe Decidim::Comments::Abilities::
|
5
|
+
describe Decidim::Comments::Abilities::ParticipatoryProcessAdminAbility do
|
6
6
|
let(:user) { build(:user) }
|
7
7
|
let(:user_process) { create :participatory_process, organization: user.organization }
|
8
|
-
let(:
|
8
|
+
let!(:user_role) { create :participatory_process_user_role, user: user, participatory_process: user_process, role: :admin }
|
9
|
+
let(:context) { { current_participatory_process: user_process } }
|
9
10
|
|
10
11
|
subject { described_class.new(user, context) }
|
11
12
|
|
@@ -5,7 +5,7 @@ module Decidim
|
|
5
5
|
# Exposes the meeting resource so users can view them
|
6
6
|
class MeetingsController < Decidim::Meetings::ApplicationController
|
7
7
|
include FilterResource
|
8
|
-
|
8
|
+
include Paginable
|
9
9
|
helper Decidim::WidgetUrlsHelper
|
10
10
|
|
11
11
|
helper_method :meetings, :geocoded_meetings, :meeting
|
@@ -29,7 +29,7 @@ module Decidim
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def meetings
|
32
|
-
@meetings ||= search.results
|
32
|
+
@meetings ||= paginate(search.results)
|
33
33
|
end
|
34
34
|
|
35
35
|
def geocoded_meetings
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= content_for(:title, translated_attribute(model.title)) %>
|
2
2
|
<%= render partial: "decidim/meetings/meetings/datetime", locals: { meeting: model } %>
|
3
|
-
<%==
|
3
|
+
<%== meeting_description(model) %>
|
4
4
|
<div class="address card__extra">
|
5
5
|
<div class="address__icon">
|
6
6
|
<%= icon "meetings", remove_icon_class: true, width: 40, height: 70 %>
|