decidim-admin 0.1.0 → 0.2.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-admin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Rakefile +1 -0
- data/app/assets/stylesheets/decidim/admin/application.scss.erb +6 -0
- data/app/assets/stylesheets/decidim/admin/extra/_action-icon.scss +1 -0
- data/app/assets/stylesheets/decidim/admin/extra/_dropdown_inverted.scss +38 -0
- data/app/commands/decidim/admin/activate_participatory_process_step.rb +1 -0
- data/app/commands/decidim/admin/copy_participatory_process.rb +113 -0
- data/app/commands/decidim/admin/create_attachment.rb +1 -0
- data/app/commands/decidim/admin/create_category.rb +1 -0
- data/app/commands/decidim/admin/create_feature.rb +1 -0
- data/app/commands/decidim/admin/create_newsletter.rb +1 -0
- data/app/commands/decidim/admin/create_participatory_process.rb +1 -0
- data/app/commands/decidim/admin/create_participatory_process_admin.rb +1 -0
- data/app/commands/decidim/admin/create_participatory_process_group.rb +1 -0
- data/app/commands/decidim/admin/create_participatory_process_step.rb +1 -0
- data/app/commands/decidim/admin/create_scope.rb +1 -0
- data/app/commands/decidim/admin/create_static_page.rb +1 -0
- data/app/commands/decidim/admin/deactivate_participatory_process_step.rb +1 -0
- data/app/commands/decidim/admin/deliver_newsletter.rb +1 -0
- data/app/commands/decidim/admin/destroy_category.rb +1 -0
- data/app/commands/decidim/admin/destroy_feature.rb +1 -0
- data/app/commands/decidim/admin/destroy_participatory_process_step.rb +1 -0
- data/app/commands/decidim/admin/hide_resource.rb +1 -0
- data/app/commands/decidim/admin/publish_participatory_process.rb +1 -0
- data/app/commands/decidim/admin/reject_user_group.rb +33 -0
- data/app/commands/decidim/admin/reorder_participatory_process_steps.rb +1 -0
- data/app/commands/decidim/admin/unpublish_participatory_process.rb +1 -0
- data/app/commands/decidim/admin/unreport_resource.rb +1 -0
- data/app/commands/decidim/admin/update_attachment.rb +1 -0
- data/app/commands/decidim/admin/update_category.rb +1 -0
- data/app/commands/decidim/admin/update_feature.rb +1 -0
- data/app/commands/decidim/admin/update_feature_permissions.rb +1 -0
- data/app/commands/decidim/admin/update_newsletter.rb +1 -0
- data/app/commands/decidim/admin/update_organization.rb +1 -0
- data/app/commands/decidim/admin/update_participatory_process.rb +1 -0
- data/app/commands/decidim/admin/update_participatory_process_admin.rb +1 -0
- data/app/commands/decidim/admin/update_participatory_process_group.rb +1 -0
- data/app/commands/decidim/admin/update_participatory_process_step.rb +1 -0
- data/app/commands/decidim/admin/update_scope.rb +1 -0
- data/app/commands/decidim/admin/update_static_page.rb +1 -0
- data/app/commands/decidim/admin/update_user_groups.rb +44 -0
- data/app/commands/decidim/admin/verify_user_group.rb +32 -0
- data/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -0
- data/app/controllers/decidim/admin/application_controller.rb +2 -2
- data/app/controllers/decidim/admin/categories_controller.rb +1 -0
- data/app/controllers/decidim/admin/concerns/has_attachments.rb +1 -0
- data/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +1 -0
- data/app/controllers/decidim/admin/dashboard_controller.rb +1 -0
- data/app/controllers/decidim/admin/exports_controller.rb +39 -0
- data/app/controllers/decidim/admin/feature_permissions_controller.rb +1 -0
- data/app/controllers/decidim/admin/features/base_controller.rb +3 -0
- data/app/controllers/decidim/admin/features_controller.rb +1 -0
- data/app/controllers/decidim/admin/moderations_controller.rb +1 -0
- data/app/controllers/decidim/admin/organization_controller.rb +1 -0
- data/app/controllers/decidim/admin/participatory_process_attachments_controller.rb +1 -0
- data/app/controllers/decidim/admin/participatory_process_copies_controller.rb +47 -0
- data/app/controllers/decidim/admin/participatory_process_groups_controller.rb +1 -0
- data/app/controllers/decidim/admin/participatory_process_publications_controller.rb +1 -0
- data/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb +1 -0
- data/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb +1 -0
- data/app/controllers/decidim/admin/participatory_process_steps_controller.rb +1 -0
- data/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +1 -0
- data/app/controllers/decidim/admin/participatory_processes_controller.rb +5 -0
- data/app/controllers/decidim/admin/scopes_controller.rb +1 -0
- data/app/controllers/decidim/admin/static_pages_controller.rb +1 -0
- data/app/controllers/decidim/admin/user_groups_controller.rb +32 -4
- data/app/controllers/decidim/admin/users_controller.rb +1 -0
- data/app/forms/decidim/admin/attachment_form.rb +1 -0
- data/app/forms/decidim/admin/category_form.rb +1 -0
- data/app/forms/decidim/admin/feature_form.rb +1 -0
- data/app/forms/decidim/admin/newsletter_form.rb +1 -0
- data/app/forms/decidim/admin/organization_form.rb +1 -0
- data/app/forms/decidim/admin/participatory_process_copy_form.rb +34 -0
- data/app/forms/decidim/admin/participatory_process_form.rb +1 -0
- data/app/forms/decidim/admin/participatory_process_group_form.rb +1 -0
- data/app/forms/decidim/admin/participatory_process_step_form.rb +1 -0
- data/app/forms/decidim/admin/participatory_process_user_role_form.rb +1 -0
- data/app/forms/decidim/admin/permission_form.rb +1 -0
- data/app/forms/decidim/admin/permissions_form.rb +1 -0
- data/app/forms/decidim/admin/scope_form.rb +1 -0
- data/app/forms/decidim/admin/static_page_form.rb +1 -0
- data/app/helpers/decidim/admin/application_helper.rb +1 -8
- data/app/helpers/decidim/admin/attributes_display_helper.rb +1 -0
- data/app/helpers/decidim/admin/exports_helper.rb +18 -0
- data/app/helpers/decidim/admin/feature_settings_helper.rb +1 -0
- data/app/helpers/decidim/admin/icon_link_helper.rb +1 -0
- data/app/helpers/decidim/admin/menu_helper.rb +18 -0
- data/app/helpers/decidim/admin/process_groups_for_select_helper.rb +1 -0
- data/app/helpers/decidim/admin/processes_for_select_helper.rb +1 -0
- data/app/jobs/decidim/admin/application_job.rb +1 -0
- data/app/jobs/decidim/admin/newsletter_delivery_job.rb +1 -0
- data/app/jobs/decidim/admin/newsletter_job.rb +1 -0
- data/app/mailers/decidim/admin/application_mailer.rb +1 -0
- data/app/models/decidim/admin/abilities/admin_user.rb +2 -1
- data/app/models/decidim/admin/abilities/base.rb +1 -0
- data/app/models/decidim/admin/abilities/collaborator_user.rb +1 -0
- data/app/models/decidim/admin/abilities/participatory_process_admin.rb +1 -0
- data/app/models/decidim/admin/application_record.rb +1 -0
- data/app/models/decidim/admin/participatory_process_user_role.rb +3 -2
- data/app/queries/decidim/admin/manageable_participatory_processes_for_user.rb +1 -0
- data/app/queries/decidim/admin/process_admin_roles_for_process.rb +1 -0
- data/app/queries/decidim/admin/process_admins.rb +1 -0
- data/app/queries/decidim/admin/user_groups_evaluation.rb +54 -0
- data/app/views/decidim/admin/exports/_dropdown.html.erb +10 -0
- data/app/views/decidim/admin/participatory_process_copies/_form.html.erb +38 -0
- data/app/views/decidim/admin/participatory_process_copies/new.html.erb +7 -0
- data/app/views/decidim/admin/participatory_processes/index.html.erb +2 -0
- data/app/views/decidim/admin/scopes/new.html.erb +0 -1
- data/app/views/decidim/admin/user_groups/index.html.erb +67 -5
- data/app/views/layouts/decidim/admin/_application.html.erb +1 -1
- data/app/views/layouts/decidim/admin/_title_bar.html.erb +1 -1
- data/config/i18n-tasks.yml +6 -6
- data/config/locales/ca.yml +36 -2
- data/config/locales/en.yml +36 -2
- data/config/locales/es.yml +37 -3
- data/config/locales/eu.yml +41 -3
- data/config/locales/fi.yml +0 -3
- data/config/locales/fr.yml +0 -3
- data/config/routes.rb +4 -0
- data/db/seeds.rb +1 -0
- data/lib/decidim/admin.rb +1 -0
- data/lib/decidim/admin/engine.rb +51 -0
- data/lib/decidim/admin/features.rb +1 -0
- data/lib/decidim/admin/test/factories.rb +1 -0
- data/lib/decidim/admin/test/manage_attachments_examples.rb +1 -0
- metadata +21 -24
- data/app/assets/stylesheets/decidim/admin/application.scss +0 -2
- data/app/assets/stylesheets/decidim/admin/extra/_sidebar.scss +0 -102
- data/app/views/layouts/decidim/admin/_language_chooser.html.erb +0 -14
- data/app/views/layouts/decidim/admin/_main_nav.html.erb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b83e8184e9d2b739b4bce06c9963abfd2f48d268
|
4
|
+
data.tar.gz: 681e05c9d10f6a135e6a6a662278f83ed82fe6d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8e4b42f285b8b69e6c0e8c2952fe36d25e9b2002a21a6a69144e5735c2e0afa934c73d87a37c4f632c1577c8caabf0986811605dcfc010ba3207c6eb952a408
|
7
|
+
data.tar.gz: a9c3366c041628fa6f0cc3788ddba94800eb5d9deff2e7aacc8dba8c79cbdafaf7b83a11bcecced7b792f0d0a05a064b57ca3578281d2e5ce650178f3dfd408a
|
data/Rakefile
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
.dropdown-inverted{
|
2
|
+
display: inline-block;
|
3
|
+
vertical-align: middle;
|
4
|
+
padding: 2px 10px 2px 2px;
|
5
|
+
text-align: right;
|
6
|
+
.dropdown > li > a{
|
7
|
+
padding-left: 0;
|
8
|
+
}
|
9
|
+
.dropdown{
|
10
|
+
display: inline-block;
|
11
|
+
vertical-align: middle;
|
12
|
+
}
|
13
|
+
.is-dropdown-submenu{
|
14
|
+
z-index: 2;
|
15
|
+
text-align: left;
|
16
|
+
background-color: $white !important;
|
17
|
+
border: 1px solid $light-gray !important;
|
18
|
+
box-shadow: 0 3px 5px rgba(0, 0, 0, .3);
|
19
|
+
min-width: 100px;
|
20
|
+
li{
|
21
|
+
padding: 8px 8px 0
|
22
|
+
}
|
23
|
+
li:hover{
|
24
|
+
background-color: darken($white, 5%) !important;
|
25
|
+
}
|
26
|
+
a{
|
27
|
+
color: $body-font-color;
|
28
|
+
padding: .5rem;
|
29
|
+
}
|
30
|
+
a:hover{
|
31
|
+
color: lighten($body-font-color, 20);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
.dropdown-menu-inverted_label{
|
37
|
+
vertical-align: middle;
|
38
|
+
}
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
# A command with all the business logic when copying a new participatory
|
6
|
+
# process in the system.
|
7
|
+
class CopyParticipatoryProcess < Rectify::Command
|
8
|
+
# Public: Initializes the command.
|
9
|
+
#
|
10
|
+
# form - A form object with the params.
|
11
|
+
# participatory_process - A participatory_process we want to duplicate
|
12
|
+
def initialize(form, participatory_process)
|
13
|
+
@form = form
|
14
|
+
@participatory_process = participatory_process
|
15
|
+
end
|
16
|
+
|
17
|
+
# Executes the command. Broadcasts these events:
|
18
|
+
#
|
19
|
+
# - :ok when everything is valid.
|
20
|
+
# - :invalid if the form wasn't valid and we couldn't proceed.
|
21
|
+
#
|
22
|
+
# Returns nothing.
|
23
|
+
def call
|
24
|
+
return broadcast(:invalid) if form.invalid?
|
25
|
+
|
26
|
+
ParticipatoryProcess.transaction do
|
27
|
+
copy_participatory_process
|
28
|
+
copy_participatory_process_steps if @form.copy_steps?
|
29
|
+
copy_participatory_process_categories if @form.copy_categories?
|
30
|
+
copy_participatory_process_features if @form.copy_features?
|
31
|
+
end
|
32
|
+
|
33
|
+
broadcast(:ok, @copied_process)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
attr_reader :form
|
39
|
+
|
40
|
+
def copy_participatory_process
|
41
|
+
@copied_process = ParticipatoryProcess.create!(
|
42
|
+
organization: @participatory_process.organization,
|
43
|
+
title: form.title,
|
44
|
+
subtitle: @participatory_process.subtitle,
|
45
|
+
slug: form.slug,
|
46
|
+
hashtag: @participatory_process.hashtag,
|
47
|
+
description: @participatory_process.description,
|
48
|
+
short_description: @participatory_process.short_description,
|
49
|
+
hero_image: @participatory_process.hero_image,
|
50
|
+
banner_image: @participatory_process.banner_image,
|
51
|
+
promoted: @participatory_process.promoted,
|
52
|
+
scope: @participatory_process.scope,
|
53
|
+
developer_group: @participatory_process.developer_group,
|
54
|
+
local_area: @participatory_process.local_area,
|
55
|
+
target: @participatory_process.target,
|
56
|
+
participatory_scope: @participatory_process.participatory_scope,
|
57
|
+
participatory_structure: @participatory_process.participatory_structure,
|
58
|
+
meta_scope: @participatory_process.meta_scope,
|
59
|
+
end_date: @participatory_process.end_date,
|
60
|
+
participatory_process_group: @participatory_process.participatory_process_group
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def copy_participatory_process_steps
|
65
|
+
@steps_relationship = {}
|
66
|
+
|
67
|
+
@participatory_process.steps.each do |step|
|
68
|
+
new_step = ParticipatoryProcessStep.create!(
|
69
|
+
title: step.title,
|
70
|
+
description: step.description,
|
71
|
+
start_date: step.start_date,
|
72
|
+
end_date: step.end_date,
|
73
|
+
participatory_process: @copied_process,
|
74
|
+
position: step.position,
|
75
|
+
active: step.active
|
76
|
+
)
|
77
|
+
@steps_relationship[step.id.to_s] = new_step.id.to_s
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def copy_participatory_process_categories
|
82
|
+
@participatory_process.categories.each do |category|
|
83
|
+
Category.create!(
|
84
|
+
name: category.name,
|
85
|
+
description: category.description,
|
86
|
+
parent_id: category.parent_id,
|
87
|
+
participatory_process: @copied_process
|
88
|
+
)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def copy_participatory_process_features
|
93
|
+
@participatory_process.features.each do |feature|
|
94
|
+
copied_step_settings = @form.copy_steps? ? map_step_settings(feature.step_settings) : {}
|
95
|
+
new_feature = Feature.create!(
|
96
|
+
manifest_name: feature.manifest_name,
|
97
|
+
name: feature.name,
|
98
|
+
participatory_process: @copied_process,
|
99
|
+
settings: feature.settings,
|
100
|
+
step_settings: copied_step_settings
|
101
|
+
)
|
102
|
+
feature.manifest.run_hooks(:copy, new_feature: new_feature, old_feature: feature)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def map_step_settings(step_settings)
|
107
|
+
step_settings.each_with_object({}) do |(step_id, settings), acc|
|
108
|
+
acc.update(@steps_relationship[step_id.to_s] => settings)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
# A command with all the business logic when rejecting a user_group.
|
6
|
+
class RejectUserGroup < Rectify::Command
|
7
|
+
# Public: Initializes the command.
|
8
|
+
#
|
9
|
+
# user_group - The user_group to reject
|
10
|
+
def initialize(user_group)
|
11
|
+
@user_group = user_group
|
12
|
+
end
|
13
|
+
|
14
|
+
# Executes the command. Broadcasts these events:
|
15
|
+
#
|
16
|
+
# - :ok when everything is valid.
|
17
|
+
# - :invalid if the form wasn't valid and we couldn't proceed.
|
18
|
+
#
|
19
|
+
# Returns nothing.
|
20
|
+
def call
|
21
|
+
return broadcast(:invalid) unless @user_group.valid?
|
22
|
+
reject_user_group
|
23
|
+
broadcast(:ok)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def reject_user_group
|
29
|
+
@user_group.update_attributes(rejected_at: Time.current, verified_at: nil)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|