decidim-participatory_processes 0.11.2 → 0.12.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/participatory_processes/process_cell.rb +19 -0
- data/app/cells/decidim/participatory_processes/process_group_cell.rb +19 -0
- data/app/cells/decidim/participatory_processes/process_group_m/footer.erb +9 -0
- data/app/cells/decidim/participatory_processes/process_group_m_cell.rb +46 -0
- data/app/cells/decidim/participatory_processes/process_m/data.erb +21 -0
- data/app/cells/decidim/participatory_processes/process_m/footer.erb +15 -0
- data/app/cells/decidim/participatory_processes/process_m/tags.erb +6 -0
- data/app/cells/decidim/participatory_processes/process_m_cell.rb +64 -0
- data/app/controllers/decidim/participatory_processes/admin/application_controller.rb +14 -0
- data/app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb +11 -0
- data/app/controllers/decidim/participatory_processes/admin/moderations_controller.rb +4 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_attachment_collections_controller.rb +0 -4
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_attachments_controller.rb +0 -4
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb +2 -2
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb +8 -8
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_publications_controller.rb +2 -2
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_step_activations_controller.rb +1 -1
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_step_ordering_controller.rb +1 -1
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_steps_controller.rb +7 -7
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_user_roles_controller.rb +7 -7
- data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb +8 -12
- data/app/controllers/decidim/participatory_processes/admin/participatory_space_private_users_controller.rb +1 -1
- data/app/controllers/decidim/participatory_processes/application_controller.rb +16 -0
- data/app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb +5 -1
- data/app/controllers/decidim/participatory_processes/participatory_processes_controller.rb +2 -2
- data/app/models/decidim/participatory_process.rb +11 -0
- data/app/models/decidim/participatory_process_group.rb +2 -0
- data/app/permissions/decidim/participatory_processes/permissions.rb +261 -0
- data/app/types/decidim/participatory_processes/participatory_process_type.rb +2 -2
- data/app/views/decidim/participatory_process_groups/_participatory_process_group.html.erb +1 -22
- data/app/views/decidim/participatory_processes/_participatory_process.html.erb +1 -28
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/edit.html.erb +1 -1
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/index.html.erb +4 -4
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/index.html.erb +4 -4
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/show.html.erb +2 -2
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/index.html.erb +4 -4
- data/app/views/decidim/participatory_processes/admin/participatory_processes/edit.html.erb +2 -2
- data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +7 -7
- data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +0 -1
- data/app/views/layouts/decidim/admin/participatory_process.html.erb +15 -12
- data/app/views/layouts/decidim/admin/participatory_process_groups.html.erb +1 -1
- data/app/views/layouts/decidim/admin/participatory_processes.html.erb +7 -10
- data/config/locales/ca.yml +16 -0
- data/config/locales/en.yml +16 -0
- data/config/locales/es.yml +16 -0
- data/config/locales/eu.yml +16 -0
- data/config/locales/fi.yml +16 -0
- data/config/locales/fr.yml +16 -0
- data/config/locales/gl.yml +16 -0
- data/config/locales/it.yml +16 -0
- data/config/locales/nl.yml +16 -0
- data/config/locales/pl.yml +22 -0
- data/config/locales/pt-BR.yml +16 -0
- data/config/locales/pt.yml +16 -0
- data/config/locales/ru.yml +51 -14
- data/config/locales/sv.yml +16 -0
- data/config/locales/uk.yml +24 -2
- data/lib/decidim/participatory_processes/admin_engine.rb +2 -10
- data/lib/decidim/participatory_processes/engine.rb +3 -7
- data/lib/decidim/participatory_processes/participatory_space.rb +13 -1
- data/lib/decidim/participatory_processes/version.rb +1 -1
- metadata +19 -13
- data/app/models/decidim/participatory_processes/abilities/admin/admin_ability.rb +0 -22
- data/app/models/decidim/participatory_processes/abilities/admin_ability.rb +0 -16
- data/app/models/decidim/participatory_processes/abilities/everyone_ability.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b572b360266d1f7002929a9e0e5b978f95cf9b5aa47637ffeae6401e5c8cf9fb
|
4
|
+
data.tar.gz: c2e595283bd2e4047468df2e03e5288fc62007f22cd7f2168be9651ec1b82c9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68b035e70da9d95ce8ad4f08714841ba0c03a33c209b488bfcd3ee4c76a2bcce6b7f6852aa49e332f01ba42dc41cf633f64864d5bdbe609efeef1105fa2b0465
|
7
|
+
data.tar.gz: c2e1af8fb6d987a771129ff652875122fece4470f6b0554d89f9a6dd9bde72ee39b2592df4b17e4fc145ecc1cd9def1ef0d49ed3b149d6991944b7bf3881715a
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
# This cell renders the process card for an instance of a Process
|
6
|
+
# the default size is the Medium Card (:m)
|
7
|
+
class ProcessCell < Decidim::ViewModel
|
8
|
+
def show
|
9
|
+
cell card_size, model
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def card_size
|
15
|
+
"decidim/participatory_processes/process_m"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
# This cell renders the process card for an instance of a ProcessGroup
|
6
|
+
# the default size is the Medium Card (:m)
|
7
|
+
class ProcessGroupCell < Decidim::ViewModel
|
8
|
+
def show
|
9
|
+
cell card_size, model
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def card_size
|
15
|
+
"decidim/participatory_processes/process_group_m"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<div class="card__footer card__footer--spaces">
|
2
|
+
<div class="card__support">
|
3
|
+
<%= link_to(
|
4
|
+
t("layouts.decidim.participatory_process_groups.participatory_process_group.browse"),
|
5
|
+
resource_path,
|
6
|
+
class: "card__button button button--sc secondary light small"
|
7
|
+
) %>
|
8
|
+
</div>
|
9
|
+
</div>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
# This cell renders the Medium (:m) process group card
|
6
|
+
# for an given instance of a ProcessGroup
|
7
|
+
class ProcessGroupMCell < Decidim::CardMCell
|
8
|
+
private
|
9
|
+
|
10
|
+
def has_image?
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
def resource_image_path
|
15
|
+
model.hero_image.url
|
16
|
+
end
|
17
|
+
|
18
|
+
def title
|
19
|
+
translated_attribute model.name
|
20
|
+
end
|
21
|
+
|
22
|
+
def resource_path
|
23
|
+
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers.participatory_process_group_path(model)
|
24
|
+
end
|
25
|
+
|
26
|
+
def step_title
|
27
|
+
translated_attribute model.active_step.title
|
28
|
+
end
|
29
|
+
|
30
|
+
def card_classes
|
31
|
+
["card--process", "card--stack"].join(" ")
|
32
|
+
end
|
33
|
+
|
34
|
+
def statuses
|
35
|
+
super << :processes_count
|
36
|
+
end
|
37
|
+
|
38
|
+
def processes_count_status
|
39
|
+
content_tag(
|
40
|
+
:strong,
|
41
|
+
t("layouts.decidim.participatory_process_groups.participatory_process_group.processes_count")
|
42
|
+
) + " " + model.participatory_processes.count.to_s
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<div class="card__icondata">
|
2
|
+
<ul class="card-data">
|
3
|
+
<li class="card-data__item">
|
4
|
+
<%= icon "datetime", class: "icon--big" %>
|
5
|
+
</li>
|
6
|
+
<li class="card-data__item">
|
7
|
+
<div class="card-data__item--centerblock">
|
8
|
+
<strong><%= t("activemodel.attributes.participatory_process.start_date") %></strong>
|
9
|
+
<br />
|
10
|
+
<%= start_date ? l(start_date, format: :decidim_short) : t("decidim.participatory_processes.show.unspecified") %>
|
11
|
+
</div>
|
12
|
+
</li>
|
13
|
+
<li class="card-data__item">
|
14
|
+
<div class="card-data__item--centerblock">
|
15
|
+
<strong><%= t("activemodel.attributes.participatory_process.end_date") %></strong>
|
16
|
+
<br />
|
17
|
+
<%= end_date ? l(end_date, format: :decidim_short) : t("decidim.participatory_processes.show.unspecified") %>
|
18
|
+
</div>
|
19
|
+
</li>
|
20
|
+
</ul>
|
21
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class="card__footer card__footer--spaces">
|
2
|
+
<div class="card__support">
|
3
|
+
<% if has_step? %>
|
4
|
+
<div class="card__support__data--left">
|
5
|
+
<div class="text-uppercase"><%= t("layouts.decidim.participatory_processes.participatory_process.active_step") %></div>
|
6
|
+
<div class="text-ellipsis"><strong><%= step_title %></strong></div>
|
7
|
+
</div>
|
8
|
+
<% end %>
|
9
|
+
<%= link_to(
|
10
|
+
t("layouts.decidim.participatory_processes.participatory_process.take_part"),
|
11
|
+
resource_path,
|
12
|
+
class: "card__button button button--sc secondary light small"
|
13
|
+
) %>
|
14
|
+
</div>
|
15
|
+
</div>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
# This cell renders the Medium (:m) process card
|
6
|
+
# for an given instance of a Process
|
7
|
+
class ProcessMCell < Decidim::CardMCell
|
8
|
+
private
|
9
|
+
|
10
|
+
def has_image?
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
def has_state?
|
15
|
+
model.past?
|
16
|
+
end
|
17
|
+
|
18
|
+
def has_badge?
|
19
|
+
false
|
20
|
+
end
|
21
|
+
|
22
|
+
def has_step?
|
23
|
+
model.active_step.present?
|
24
|
+
end
|
25
|
+
|
26
|
+
def state_classes
|
27
|
+
return unless model.past?
|
28
|
+
["alert"]
|
29
|
+
end
|
30
|
+
|
31
|
+
def resource_path
|
32
|
+
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers.participatory_process_path(model)
|
33
|
+
end
|
34
|
+
|
35
|
+
def resource_image_path
|
36
|
+
model.hero_image.url
|
37
|
+
end
|
38
|
+
|
39
|
+
def step_title
|
40
|
+
translated_attribute model.active_step.title
|
41
|
+
end
|
42
|
+
|
43
|
+
def base_card_class
|
44
|
+
"card--process"
|
45
|
+
end
|
46
|
+
|
47
|
+
def statuses
|
48
|
+
[:creation_date, :follow]
|
49
|
+
end
|
50
|
+
|
51
|
+
def resource_icon
|
52
|
+
icon "processes", class: "icon--big"
|
53
|
+
end
|
54
|
+
|
55
|
+
def start_date
|
56
|
+
model.start_date
|
57
|
+
end
|
58
|
+
|
59
|
+
def end_date
|
60
|
+
model.end_date
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -5,6 +5,20 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# The main admin application controller for participatory processes
|
7
7
|
class ApplicationController < Decidim::Admin::ApplicationController
|
8
|
+
private
|
9
|
+
|
10
|
+
def permissions_context
|
11
|
+
super.merge(
|
12
|
+
current_participatory_space: try(:current_participatory_space)
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def permission_class_chain
|
17
|
+
[
|
18
|
+
Decidim::ParticipatoryProcesses::Permissions,
|
19
|
+
Decidim::Admin::Permissions
|
20
|
+
]
|
21
|
+
end
|
8
22
|
end
|
9
23
|
end
|
10
24
|
end
|
data/app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb
CHANGED
@@ -26,7 +26,18 @@ module Decidim
|
|
26
26
|
organization_processes.find_by!(slug: params[:participatory_process_slug] || params[:slug])
|
27
27
|
end
|
28
28
|
|
29
|
+
def permissions_context
|
30
|
+
super.merge(current_participatory_space: current_participatory_space)
|
31
|
+
end
|
32
|
+
|
29
33
|
alias_method :current_participatory_process, :current_participatory_space
|
34
|
+
|
35
|
+
def permission_class_chain
|
36
|
+
[
|
37
|
+
Decidim::ParticipatoryProcesses::Permissions,
|
38
|
+
Decidim::Admin::Permissions
|
39
|
+
]
|
40
|
+
end
|
30
41
|
end
|
31
42
|
end
|
32
43
|
end
|
@@ -6,6 +6,10 @@ module Decidim
|
|
6
6
|
# This controller allows admins to manage moderations in a participatory process.
|
7
7
|
class ModerationsController < Decidim::Admin::ModerationsController
|
8
8
|
include Concerns::ParticipatoryProcessAdmin
|
9
|
+
|
10
|
+
def permissions_context
|
11
|
+
super.merge(current_participatory_space: current_participatory_space)
|
12
|
+
end
|
9
13
|
end
|
10
14
|
end
|
11
15
|
end
|
@@ -9,12 +9,12 @@ module Decidim
|
|
9
9
|
include Concerns::ParticipatoryProcessAdmin
|
10
10
|
|
11
11
|
def new
|
12
|
-
|
12
|
+
enforce_permission_to :create, :process
|
13
13
|
@form = form(ParticipatoryProcessCopyForm).from_model(current_participatory_process)
|
14
14
|
end
|
15
15
|
|
16
16
|
def create
|
17
|
-
|
17
|
+
enforce_permission_to :create, :process
|
18
18
|
@form = form(ParticipatoryProcessCopyForm).from_params(params)
|
19
19
|
|
20
20
|
CopyParticipatoryProcess.call(@form, current_participatory_process) do
|
@@ -5,26 +5,26 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# Controller that allows managing participatory process groups.
|
7
7
|
#
|
8
|
-
class ParticipatoryProcessGroupsController < Decidim::Admin::ApplicationController
|
8
|
+
class ParticipatoryProcessGroupsController < Decidim::ParticipatoryProcesses::Admin::ApplicationController
|
9
9
|
helper ProcessesForSelectHelper
|
10
10
|
|
11
11
|
helper_method :collection, :participatory_process_group
|
12
12
|
|
13
13
|
def index
|
14
|
-
|
14
|
+
enforce_permission_to :read, :process_group
|
15
15
|
end
|
16
16
|
|
17
17
|
def show
|
18
|
-
|
18
|
+
enforce_permission_to :read, :process_group, process_group: participatory_process_group
|
19
19
|
end
|
20
20
|
|
21
21
|
def new
|
22
|
-
|
22
|
+
enforce_permission_to :create, :process_group
|
23
23
|
@form = form(ParticipatoryProcessGroupForm).instance
|
24
24
|
end
|
25
25
|
|
26
26
|
def create
|
27
|
-
|
27
|
+
enforce_permission_to :create, :process_group
|
28
28
|
@form = form(ParticipatoryProcessGroupForm).from_params(params)
|
29
29
|
|
30
30
|
CreateParticipatoryProcessGroup.call(@form) do
|
@@ -42,13 +42,13 @@ module Decidim
|
|
42
42
|
|
43
43
|
def edit
|
44
44
|
@participatory_process_group = collection.find(params[:id])
|
45
|
-
|
45
|
+
enforce_permission_to :update, :process_group, process_group: @participatory_process_group
|
46
46
|
@form = form(ParticipatoryProcessGroupForm).from_model(@participatory_process_group)
|
47
47
|
end
|
48
48
|
|
49
49
|
def update
|
50
50
|
@participatory_process_group = collection.find(params[:id])
|
51
|
-
|
51
|
+
enforce_permission_to :update, :process_group, process_group: @participatory_process_group
|
52
52
|
@form = form(ParticipatoryProcessGroupForm).from_params(params)
|
53
53
|
|
54
54
|
UpdateParticipatoryProcessGroup.call(@participatory_process_group, @form) do
|
@@ -66,7 +66,7 @@ module Decidim
|
|
66
66
|
|
67
67
|
def destroy
|
68
68
|
@participatory_process_group = collection.find(params[:id])
|
69
|
-
|
69
|
+
enforce_permission_to :destroy, :process_group, process_group: @participatory_process_group
|
70
70
|
@participatory_process_group.destroy!
|
71
71
|
|
72
72
|
flash[:notice] = I18n.t("participatory_process_groups.destroy.success", scope: "decidim.admin")
|
@@ -9,7 +9,7 @@ module Decidim
|
|
9
9
|
include Concerns::ParticipatoryProcessAdmin
|
10
10
|
|
11
11
|
def create
|
12
|
-
|
12
|
+
enforce_permission_to :publish, :process, process: current_participatory_process
|
13
13
|
|
14
14
|
PublishParticipatoryProcess.call(current_participatory_process, current_user) do
|
15
15
|
on(:ok) do
|
@@ -25,7 +25,7 @@ module Decidim
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def destroy
|
28
|
-
|
28
|
+
enforce_permission_to :publish, :process, process: current_participatory_process
|
29
29
|
|
30
30
|
UnpublishParticipatoryProcess.call(current_participatory_process, current_user) do
|
31
31
|
on(:ok) do
|
@@ -9,7 +9,7 @@ module Decidim
|
|
9
9
|
include Concerns::ParticipatoryProcessAdmin
|
10
10
|
|
11
11
|
def create
|
12
|
-
|
12
|
+
enforce_permission_to :activate, :process_step, process_step: process_step
|
13
13
|
|
14
14
|
ActivateParticipatoryProcessStep.call(process_step, current_user) do
|
15
15
|
on(:ok) do
|
@@ -9,7 +9,7 @@ module Decidim
|
|
9
9
|
include Concerns::ParticipatoryProcessAdmin
|
10
10
|
|
11
11
|
def create
|
12
|
-
|
12
|
+
enforce_permission_to :reorder, :process_step
|
13
13
|
ReorderParticipatoryProcessSteps.call(collection, params[:items_ids]) do
|
14
14
|
on(:invalid) do
|
15
15
|
flash.now[:alert] = I18n.t("participatory_process_steps.ordering.error", scope: "decidim.admin")
|
data/app/controllers/decidim/participatory_processes/admin/participatory_process_steps_controller.rb
CHANGED
@@ -9,16 +9,16 @@ module Decidim
|
|
9
9
|
include Concerns::ParticipatoryProcessAdmin
|
10
10
|
|
11
11
|
def index
|
12
|
-
|
12
|
+
enforce_permission_to :read, :process_step
|
13
13
|
end
|
14
14
|
|
15
15
|
def new
|
16
|
-
|
16
|
+
enforce_permission_to :create, :process_step
|
17
17
|
@form = form(ParticipatoryProcessStepForm).instance
|
18
18
|
end
|
19
19
|
|
20
20
|
def create
|
21
|
-
|
21
|
+
enforce_permission_to :create, :process_step
|
22
22
|
@form = form(ParticipatoryProcessStepForm).from_params(params)
|
23
23
|
|
24
24
|
CreateParticipatoryProcessStep.call(@form, current_participatory_process) do
|
@@ -36,13 +36,13 @@ module Decidim
|
|
36
36
|
|
37
37
|
def edit
|
38
38
|
@participatory_process_step = collection.find(params[:id])
|
39
|
-
|
39
|
+
enforce_permission_to :update, :process_step, process_step: @participatory_process_step
|
40
40
|
@form = form(ParticipatoryProcessStepForm).from_model(@participatory_process_step)
|
41
41
|
end
|
42
42
|
|
43
43
|
def update
|
44
44
|
@participatory_process_step = collection.find(params[:id])
|
45
|
-
|
45
|
+
enforce_permission_to :update, :process_step, process_step: @participatory_process_step
|
46
46
|
@form = form(ParticipatoryProcessStepForm).from_params(params)
|
47
47
|
|
48
48
|
UpdateParticipatoryProcessStep.call(@participatory_process_step, @form) do
|
@@ -60,12 +60,12 @@ module Decidim
|
|
60
60
|
|
61
61
|
def show
|
62
62
|
@participatory_process_step = collection.find(params[:id])
|
63
|
-
|
63
|
+
enforce_permission_to :read, :process_step, process_step: @participatory_process_step
|
64
64
|
end
|
65
65
|
|
66
66
|
def destroy
|
67
67
|
@participatory_process_step = collection.find(params[:id])
|
68
|
-
|
68
|
+
enforce_permission_to :destroy, :process_step, process_step: @participatory_process_step
|
69
69
|
|
70
70
|
DestroyParticipatoryProcessStep.call(@participatory_process_step, current_user) do
|
71
71
|
on(:ok) do
|