decidim-admin 0.31.6 → 0.31.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/concerns/decidim/admin/component_taxonomies_helper.rb +1 -1
- data/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb +5 -5
- data/app/controllers/concerns/decidim/admin/global_moderation_context.rb +2 -0
- data/app/controllers/concerns/decidim/admin/participatory_space_admin_context.rb +2 -0
- data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +2 -0
- data/app/controllers/decidim/admin/admin_terms_controller.rb +1 -0
- data/app/controllers/decidim/admin/application_controller.rb +2 -0
- data/app/controllers/decidim/admin/block_user_controller.rb +2 -0
- data/app/controllers/decidim/admin/components/base_controller.rb +12 -7
- data/app/controllers/decidim/admin/components_controller.rb +2 -2
- data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +2 -0
- data/app/controllers/decidim/admin/concerns/has_attachments.rb +2 -0
- data/app/controllers/decidim/admin/concerns/has_breadcrumb_items.rb +4 -0
- data/app/controllers/decidim/admin/concerns/has_private_users.rb +4 -0
- data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +2 -0
- data/app/controllers/decidim/admin/conflicts_controller.rb +5 -5
- data/app/controllers/decidim/admin/global_moderations/reports_controller.rb +2 -0
- data/app/controllers/decidim/admin/global_moderations_controller.rb +2 -0
- data/app/controllers/decidim/admin/help_sections_controller.rb +3 -3
- data/app/controllers/decidim/admin/impersonations_controller.rb +2 -1
- data/app/controllers/decidim/admin/managed_users/impersonation_logs_controller.rb +1 -1
- data/app/controllers/decidim/admin/moderated_users_controller.rb +3 -0
- data/app/controllers/decidim/admin/moderations_controller.rb +4 -0
- data/app/controllers/decidim/admin/newsletter_templates_controller.rb +4 -1
- data/app/controllers/decidim/admin/newsletters_controller.rb +3 -0
- data/app/controllers/decidim/admin/organization_homepage_controller.rb +7 -3
- data/app/controllers/decidim/admin/resource_permissions_controller.rb +4 -0
- data/app/controllers/decidim/admin/static_pages_controller.rb +27 -25
- data/app/controllers/decidim/admin/taxonomy_filters_controller.rb +2 -2
- data/app/controllers/decidim/admin/taxonomy_filters_selector_controller.rb +1 -1
- data/app/jobs/decidim/admin/newsletter_job.rb +0 -1
- data/app/packs/stylesheets/decidim/admin/_sidebar-menu.scss +3 -1
- data/app/permissions/decidim/admin/permissions.rb +16 -0
- data/app/views/decidim/admin/organization/form/_extra_features.html.erb +18 -2
- data/config/locales/bg.yml +2 -0
- data/config/locales/ca-IT.yml +4 -0
- data/config/locales/ca.yml +6 -2
- data/config/locales/cs.yml +9 -0
- data/config/locales/de.yml +26 -1
- data/config/locales/en.yml +4 -0
- data/config/locales/es-MX.yml +4 -0
- data/config/locales/es-PY.yml +4 -0
- data/config/locales/es.yml +4 -0
- data/config/locales/eu.yml +57 -53
- data/config/locales/fi-plain.yml +4 -0
- data/config/locales/fi.yml +4 -0
- data/config/locales/fr-CA.yml +7 -0
- data/config/locales/fr.yml +7 -0
- data/config/locales/gl.yml +611 -50
- data/config/locales/ja.yml +4 -0
- data/config/locales/sv.yml +32 -1
- data/config/locales/tr-TR.yml +28 -0
- data/lib/decidim/admin/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b09d289923eeba25084f2ef02203d589e66d9f9112ab0c07663f5cabcc27fa6
|
|
4
|
+
data.tar.gz: ac243685d31770727448e905d9cd8d92afc6681c2418f26c92336075d9c91df2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 988427f2e29e0dc9d8ea2284421e014a690f65b90f0374a4c6acafaf5cbf0a566ea09c3678d420b0d24f6f2ac475f145f7a28dd84011bcf649f158c1527beec1
|
|
7
|
+
data.tar.gz: ca646ce7ca7f693b7c37f164504c2c076cfcf1cf231ec8450c675b82b94c058a856cd76659c020cf74ebf10ffecde940448111c138fe5d2974663eb696114079
|
|
@@ -10,7 +10,7 @@ module Decidim
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def current_component_taxonomy_filters
|
|
13
|
-
@current_component_taxonomy_filters ||= TaxonomyFilter.for(current_organization)
|
|
13
|
+
@current_component_taxonomy_filters ||= TaxonomyFilter.for(current_organization) # rubocop:disable Decidim/OrganizationScopedFinder -- .for scopes by decidim_organization_id internally
|
|
14
14
|
.for_manifest(current_participatory_space.manifest.name)
|
|
15
15
|
.where(id: current_component.settings.taxonomy_filters)
|
|
16
16
|
end
|
|
@@ -9,7 +9,7 @@ module Decidim
|
|
|
9
9
|
helper_method :active_blocks, :active_content_blocks_title, :add_content_block_text, :available_manifests,
|
|
10
10
|
:content_block_destroy_confirmation_text, :content_blocks_title, :inactive_blocks,
|
|
11
11
|
:inactive_content_blocks_title, :resource_content_block_cell, :resource_create_url,
|
|
12
|
-
:resource_sort_url
|
|
12
|
+
:resource_sort_url, :scoped_resource
|
|
13
13
|
def edit
|
|
14
14
|
enforce_permission_to_update_resource
|
|
15
15
|
|
|
@@ -29,10 +29,6 @@ module Decidim
|
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
# Method that specifies the i18n scope for this controller. This can be overwritten in your controller.
|
|
33
|
-
# so that you can pass a different scope to the i18n methods.
|
|
34
|
-
def i18n_scope = "decidim.admin.content_blocks"
|
|
35
|
-
|
|
36
32
|
# Method to be implemented at the controller. Returns a string
|
|
37
33
|
# with the text for the title of content blocks
|
|
38
34
|
#
|
|
@@ -70,6 +66,10 @@ module Decidim
|
|
|
70
66
|
|
|
71
67
|
private
|
|
72
68
|
|
|
69
|
+
# Method that specifies the i18n scope for this controller. This can be overwritten in your controller.
|
|
70
|
+
# so that you can pass a different scope to the i18n methods.
|
|
71
|
+
def i18n_scope = "decidim.admin.content_blocks"
|
|
72
|
+
|
|
73
73
|
# Method to be implemented at the controller. You need to
|
|
74
74
|
# return a symbol that defines the content block scope.
|
|
75
75
|
# Examples of scopes could be `:homepage` or `:landing_page`.
|
|
@@ -8,6 +8,8 @@ module Decidim
|
|
|
8
8
|
extend ActiveSupport::Concern
|
|
9
9
|
|
|
10
10
|
class_methods do
|
|
11
|
+
protected
|
|
12
|
+
|
|
11
13
|
# Public: Called on a controller, it sets up all the surrounding methods to render a
|
|
12
14
|
# participatory space's admin template. It expects the method `current_participatory_space`
|
|
13
15
|
# to be defined, from which it will extract the participatory manifest.
|
|
@@ -6,6 +6,7 @@ module Decidim
|
|
|
6
6
|
# Terms of service agreement.
|
|
7
7
|
class AdminTermsController < Decidim::Admin::ApplicationController
|
|
8
8
|
def accept
|
|
9
|
+
enforce_permission_to :accept, :admin_terms
|
|
9
10
|
current_user.admin_terms_accepted_at = Time.current
|
|
10
11
|
if current_user.save!
|
|
11
12
|
flash[:notice] = t("accept.success", scope: "decidim.admin.admin_terms_of_service")
|
|
@@ -57,6 +57,7 @@ module Decidim
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def bulk_create
|
|
60
|
+
enforce_permission_to :block, :admin_user
|
|
60
61
|
@form = form(BlockUsersForm).from_params(params)
|
|
61
62
|
|
|
62
63
|
Admin::BulkBlockUsers.call(@form) do
|
|
@@ -73,6 +74,7 @@ module Decidim
|
|
|
73
74
|
end
|
|
74
75
|
|
|
75
76
|
def bulk_destroy
|
|
77
|
+
enforce_permission_to :block, :admin_user
|
|
76
78
|
Admin::BulkUnblockUsers.call(blocked_users, current_user) do
|
|
77
79
|
on(:ok) do
|
|
78
80
|
flash[:notice] = I18n.t("officializations.bulk_action.unblock.success", scope: "decidim.admin")
|
|
@@ -23,13 +23,7 @@ module Decidim
|
|
|
23
23
|
:current_participatory_space,
|
|
24
24
|
:parent_path
|
|
25
25
|
|
|
26
|
-
before_action
|
|
27
|
-
enforce_permission_to :manage, :component, component: current_component unless skip_manage_component_permission
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
before_action on: [:index, :show] do
|
|
31
|
-
enforce_permission_to :read, :component, component: current_component
|
|
32
|
-
end
|
|
26
|
+
before_action :enforce_component_permissions
|
|
33
27
|
|
|
34
28
|
before_action :set_component_breadcrumb_item
|
|
35
29
|
|
|
@@ -68,6 +62,17 @@ module Decidim
|
|
|
68
62
|
false
|
|
69
63
|
end
|
|
70
64
|
|
|
65
|
+
def enforce_component_permissions
|
|
66
|
+
case action_name.to_sym
|
|
67
|
+
when :index, :show
|
|
68
|
+
enforce_permission_to :read, :component, component: current_component
|
|
69
|
+
else
|
|
70
|
+
enforce_permission_to :manage, :component, component: current_component unless skip_manage_component_permission
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
protected
|
|
75
|
+
|
|
71
76
|
def set_component_breadcrumb_item
|
|
72
77
|
context_breadcrumb_items << {
|
|
73
78
|
label: t("components", scope: "decidim.admin.menu"),
|
|
@@ -86,7 +86,7 @@ module Decidim
|
|
|
86
86
|
|
|
87
87
|
Decidim::Commands::SoftDeleteResource.call(trashable_deleted_resource, current_user) do
|
|
88
88
|
on(:ok) do
|
|
89
|
-
Decidim::Reminder.where(component: resource).destroy_all
|
|
89
|
+
Decidim::Reminder.where(component: resource).destroy_all # rubocop:disable Decidim/OrganizationScopedFinder -- resource is the soft-deleted component, already scoped to current_participatory_space via query_scope
|
|
90
90
|
flash[:notice] = I18n.t("soft_delete.success", scope: trashable_i18n_scope, resource_name: human_readable_resource_name.capitalize)
|
|
91
91
|
redirect_to_resource_index
|
|
92
92
|
end
|
|
@@ -135,9 +135,9 @@ module Decidim
|
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
def share
|
|
138
|
+
enforce_permission_to :share, :component
|
|
138
139
|
@component = query_scope.find(params[:id])
|
|
139
140
|
share_token = @component.share_tokens.create!(user: current_user, organization: current_organization)
|
|
140
|
-
|
|
141
141
|
redirect_to share_token.url
|
|
142
142
|
end
|
|
143
143
|
|
|
@@ -82,6 +82,8 @@ module Decidim
|
|
|
82
82
|
redirect_to after_destroy_path
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
+
protected
|
|
86
|
+
|
|
85
87
|
# Public: Returns a String or Object that will be passed to `redirect_to` after
|
|
86
88
|
# destroying an attachment collection. By default it redirects to the object
|
|
87
89
|
# that holds the attachment collection.
|
|
@@ -7,12 +7,16 @@ module Decidim
|
|
|
7
7
|
extend ActiveSupport::Concern
|
|
8
8
|
|
|
9
9
|
class_methods do
|
|
10
|
+
protected
|
|
11
|
+
|
|
10
12
|
def add_breadcrumb_item_from_menu(target_menu, opts = {})
|
|
11
13
|
before_action -> { secondary_breadcrumb_menus << target_menu }, opts
|
|
12
14
|
end
|
|
13
15
|
end
|
|
14
16
|
|
|
15
17
|
included do
|
|
18
|
+
protected
|
|
19
|
+
|
|
16
20
|
def secondary_breadcrumb_menus
|
|
17
21
|
@secondary_breadcrumb_menus ||= []
|
|
18
22
|
end
|
|
@@ -105,6 +105,7 @@ module Decidim
|
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
def publish_all
|
|
108
|
+
enforce_permission_to :publish_all, :space_private_user
|
|
108
109
|
PublishAllParticipatorySpacePrivateUsers.call(current_participatory_space, current_user) do
|
|
109
110
|
on(:ok) do
|
|
110
111
|
flash[:notice] = I18n.t("participatory_space_private_users.publish_all.success", scope: "decidim.admin")
|
|
@@ -119,6 +120,7 @@ module Decidim
|
|
|
119
120
|
end
|
|
120
121
|
|
|
121
122
|
def unpublish_all
|
|
123
|
+
enforce_permission_to :unpublish_all, :space_private_user
|
|
122
124
|
UnpublishAllParticipatorySpacePrivateUsers.call(current_participatory_space, current_user) do
|
|
123
125
|
on(:ok) do
|
|
124
126
|
flash[:notice] = I18n.t("participatory_space_private_users.unpublish_all.success", scope: "decidim.admin")
|
|
@@ -132,6 +134,8 @@ module Decidim
|
|
|
132
134
|
end
|
|
133
135
|
end
|
|
134
136
|
|
|
137
|
+
protected
|
|
138
|
+
|
|
135
139
|
# Public: Returns a String or Object that will be passed to `redirect_to` after
|
|
136
140
|
# destroying a private user. By default it redirects to the privatable_to.
|
|
137
141
|
#
|
|
@@ -45,6 +45,8 @@ module Decidim
|
|
|
45
45
|
redirect_to new_participatory_space_private_users_csv_imports_path
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
protected
|
|
49
|
+
|
|
48
50
|
# Public: Returns a String or Object that will be passed to `redirect_to` after
|
|
49
51
|
# importing private users. By default it redirects to the privatable_to.
|
|
50
52
|
#
|
|
@@ -18,8 +18,6 @@ module Decidim
|
|
|
18
18
|
def edit
|
|
19
19
|
enforce_permission_to :index, :impersonatable_user
|
|
20
20
|
|
|
21
|
-
conflict = Decidim::Verifications::Conflict.find(params[:id])
|
|
22
|
-
|
|
23
21
|
@form = form(TransferUserForm).from_params(
|
|
24
22
|
user: conflict.current_user,
|
|
25
23
|
managed_user: conflict.managed_user,
|
|
@@ -30,8 +28,6 @@ module Decidim
|
|
|
30
28
|
def update
|
|
31
29
|
enforce_permission_to :index, :impersonatable_user
|
|
32
30
|
|
|
33
|
-
conflict = Decidim::Verifications::Conflict.find(params[:id])
|
|
34
|
-
|
|
35
31
|
@form = form(TransferUserForm).from_params(
|
|
36
32
|
current_user:,
|
|
37
33
|
conflict:,
|
|
@@ -54,6 +50,10 @@ module Decidim
|
|
|
54
50
|
|
|
55
51
|
private
|
|
56
52
|
|
|
53
|
+
def conflict
|
|
54
|
+
@conflict ||= collection.find(params.require(:id))
|
|
55
|
+
end
|
|
56
|
+
|
|
57
57
|
def context_breadcrumb_items
|
|
58
58
|
@context_breadcrumb_items ||= [impersonations_breadcrumb_item]
|
|
59
59
|
end
|
|
@@ -67,7 +67,7 @@ module Decidim
|
|
|
67
67
|
|
|
68
68
|
def collection
|
|
69
69
|
@collection ||= Decidim::Verifications::Conflict.joins(:current_user).where(
|
|
70
|
-
decidim_users: {
|
|
70
|
+
decidim_users: { organization: current_organization }
|
|
71
71
|
)
|
|
72
72
|
end
|
|
73
73
|
|
|
@@ -12,17 +12,17 @@ module Decidim
|
|
|
12
12
|
|
|
13
13
|
helper_method :sections
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
def show
|
|
16
16
|
enforce_permission_to :update, :help_sections
|
|
17
|
-
end
|
|
18
17
|
|
|
19
|
-
def show
|
|
20
18
|
@form = form(HelpSectionsForm).from_model(
|
|
21
19
|
OpenStruct.new(sections:)
|
|
22
20
|
)
|
|
23
21
|
end
|
|
24
22
|
|
|
25
23
|
def update
|
|
24
|
+
enforce_permission_to :update, :help_sections
|
|
25
|
+
|
|
26
26
|
@form = form(HelpSectionsForm).from_params(
|
|
27
27
|
params[:help_sections]
|
|
28
28
|
)
|
|
@@ -52,6 +52,7 @@ module Decidim
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def close_session
|
|
55
|
+
enforce_permission_to :close_session, :managed_user
|
|
55
56
|
CloseSessionManagedUser.call(user, current_user) do
|
|
56
57
|
on(:ok) do
|
|
57
58
|
flash[:notice] = I18n.t("impersonations.close_session.success", scope: "decidim.admin")
|
|
@@ -82,7 +83,7 @@ module Decidim
|
|
|
82
83
|
)
|
|
83
84
|
return nil unless handler.unique_id
|
|
84
85
|
|
|
85
|
-
existing_authorization = Authorization.find_by(
|
|
86
|
+
existing_authorization = Authorization.find_by( # rubocop:disable Decidim/OrganizationScopedFinder -- user: subquery scopes to current_organization
|
|
86
87
|
user: User.where(organization: current_organization),
|
|
87
88
|
name: handler_name,
|
|
88
89
|
unique_id: handler.unique_id
|
|
@@ -11,7 +11,7 @@ module Decidim
|
|
|
11
11
|
def index
|
|
12
12
|
enforce_permission_to :index, :impersonatable_user
|
|
13
13
|
|
|
14
|
-
@impersonation_logs =
|
|
14
|
+
@impersonation_logs = user.impersonation_logs.order(started_at: :desc).page(params[:page]).per(15)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
private
|
|
@@ -34,6 +34,7 @@ module Decidim
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def bulk_unreport
|
|
37
|
+
enforce_permission_to :unreport, :moderate_users
|
|
37
38
|
Admin::BulkUnreportUsers.call(current_user, reportables) do
|
|
38
39
|
on(:ok) do
|
|
39
40
|
flash[:notice] = I18n.t("reportable.bulk_action.ignore.success", scope: "decidim.moderations.admin")
|
|
@@ -67,6 +68,8 @@ module Decidim
|
|
|
67
68
|
Decidim::Admin::ModerationStats.new(current_user).user_reports
|
|
68
69
|
end
|
|
69
70
|
|
|
71
|
+
protected
|
|
72
|
+
|
|
70
73
|
def collection
|
|
71
74
|
@collection ||= if params[:blocked]
|
|
72
75
|
base_query_finder.blocked
|
|
@@ -73,6 +73,8 @@ module Decidim
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def bulk_action
|
|
76
|
+
enforce_permission_to :bulk_action, authorization_scope
|
|
77
|
+
|
|
76
78
|
Admin::BulkAction.call(current_user, params[:bulk_action], selected_moderations) do
|
|
77
79
|
on(:ok) do |ok, ko|
|
|
78
80
|
flash[:notice] = I18n.t("reportable.bulk_action.#{params[:bulk_action]}.success", scope: "decidim.moderations.admin", count_ok: ok.count) if ok.count.positive?
|
|
@@ -92,6 +94,8 @@ module Decidim
|
|
|
92
94
|
query_params[:q] || { s: "created_at desc" }
|
|
93
95
|
end
|
|
94
96
|
|
|
97
|
+
protected
|
|
98
|
+
|
|
95
99
|
# Private: This method is used by the `Filterable` concern as the base query
|
|
96
100
|
# without applying filtering and/or sorting options.
|
|
97
101
|
def collection
|
|
@@ -12,9 +12,12 @@ module Decidim
|
|
|
12
12
|
enforce_permission_to :index, :newsletter
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def show
|
|
15
|
+
def show
|
|
16
|
+
enforce_permission_to :index, :newsletter
|
|
17
|
+
end
|
|
16
18
|
|
|
17
19
|
def preview
|
|
20
|
+
enforce_permission_to :index, :newsletter
|
|
18
21
|
email = NewsletterMailer.newsletter(current_user, fake_newsletter, true)
|
|
19
22
|
Premailer::Rails::Hook.perform(email)
|
|
20
23
|
render html: email.html_part.body.decoded.html_safe
|
|
@@ -113,6 +113,7 @@ module Decidim
|
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
def recipients_count
|
|
116
|
+
enforce_permission_to :read, :newsletter, newsletter:
|
|
116
117
|
@form = form(SelectiveNewsletterForm).from_params(newsletter_params)
|
|
117
118
|
render plain: recipients_count_query
|
|
118
119
|
end
|
|
@@ -182,6 +183,8 @@ module Decidim
|
|
|
182
183
|
end
|
|
183
184
|
end
|
|
184
185
|
|
|
186
|
+
protected
|
|
187
|
+
|
|
185
188
|
def collection
|
|
186
189
|
@collection ||= Newsletter.where(organization: current_organization)
|
|
187
190
|
end
|
|
@@ -10,14 +10,18 @@ module Decidim
|
|
|
10
10
|
|
|
11
11
|
add_breadcrumb_item_from_menu :admin_settings_menu
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
:homepage
|
|
15
|
-
end
|
|
13
|
+
helper_method :scoped_resource
|
|
16
14
|
|
|
17
15
|
def scoped_resource
|
|
18
16
|
nil
|
|
19
17
|
end
|
|
20
18
|
|
|
19
|
+
protected
|
|
20
|
+
|
|
21
|
+
def content_block_scope
|
|
22
|
+
:homepage
|
|
23
|
+
end
|
|
24
|
+
|
|
21
25
|
def enforce_permission_to_update_resource
|
|
22
26
|
enforce_permission_to :update, :organization, organization: current_organization
|
|
23
27
|
end
|
|
@@ -10,12 +10,16 @@ module Decidim
|
|
|
10
10
|
helper_method :authorizations, :other_authorizations_for, :resource_params, :resource
|
|
11
11
|
|
|
12
12
|
def edit
|
|
13
|
+
enforce_permission_to :update, :resource_permission, resource:
|
|
14
|
+
|
|
13
15
|
@permissions_form = PermissionsForm.new(
|
|
14
16
|
permissions: permission_forms
|
|
15
17
|
)
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
def update
|
|
21
|
+
enforce_permission_to :update, :resource_permission, resource:
|
|
22
|
+
|
|
19
23
|
@permissions_form = PermissionsForm.from_params(params).with_context(current_organization:)
|
|
20
24
|
|
|
21
25
|
UpdateResourcePermissions.call(@permissions_form, resource) do
|
|
@@ -11,34 +11,10 @@ module Decidim
|
|
|
11
11
|
|
|
12
12
|
before_action :tos_version_formatted, only: [:index, :edit]
|
|
13
13
|
|
|
14
|
-
helper_method :topics
|
|
14
|
+
helper_method :topics, :scoped_resource
|
|
15
15
|
|
|
16
16
|
alias update_content_blocks update
|
|
17
17
|
|
|
18
|
-
def content_block_scope
|
|
19
|
-
:static_page
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def scoped_resource
|
|
23
|
-
@scoped_resource ||= collection.find_by(slug: params[:id])
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def enforce_permission_to_update_resource
|
|
27
|
-
enforce_permission_to :update, :static_page, static_page: scoped_resource
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def resource_sort_url
|
|
31
|
-
update_content_blocks_static_page_path(scoped_resource)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def resource_create_url(manifest_name)
|
|
35
|
-
static_page_content_blocks_path(scoped_resource, manifest_name:)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def resource_content_block_cell
|
|
39
|
-
"decidim/admin/static_page_content_block"
|
|
40
|
-
end
|
|
41
|
-
|
|
42
18
|
def index
|
|
43
19
|
enforce_permission_to :read, :static_page
|
|
44
20
|
@topics = Decidim::StaticPageTopic.where(organization: current_organization)
|
|
@@ -101,8 +77,32 @@ module Decidim
|
|
|
101
77
|
end
|
|
102
78
|
end
|
|
103
79
|
|
|
80
|
+
def scoped_resource
|
|
81
|
+
@scoped_resource ||= collection.find_by(slug: params[:id])
|
|
82
|
+
end
|
|
83
|
+
|
|
104
84
|
private
|
|
105
85
|
|
|
86
|
+
def content_block_scope
|
|
87
|
+
:static_page
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def enforce_permission_to_update_resource
|
|
91
|
+
enforce_permission_to :update, :static_page, static_page: scoped_resource
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def resource_sort_url
|
|
95
|
+
update_content_blocks_static_page_path(scoped_resource)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def resource_create_url(manifest_name)
|
|
99
|
+
static_page_content_blocks_path(scoped_resource, manifest_name:)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def resource_content_block_cell
|
|
103
|
+
"decidim/admin/static_page_content_block"
|
|
104
|
+
end
|
|
105
|
+
|
|
106
106
|
def tab_menu_name = :admin_static_pages_menu
|
|
107
107
|
|
|
108
108
|
def form_params
|
|
@@ -121,6 +121,8 @@ module Decidim
|
|
|
121
121
|
@page ||= scoped_resource
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
+
protected
|
|
125
|
+
|
|
124
126
|
def collection
|
|
125
127
|
current_organization.static_pages
|
|
126
128
|
end
|
|
@@ -88,11 +88,11 @@ module Decidim
|
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
def root_taxonomy
|
|
91
|
-
@root_taxonomy ||= Taxonomy.roots.find(params
|
|
91
|
+
@root_taxonomy ||= Taxonomy.for(current_organization).roots.find(params.require(:taxonomy_id)) # rubocop:disable Decidim/OrganizationScopedFinder -- .for(current_organization) scopes to current org
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def taxonomy_filter
|
|
95
|
-
@taxonomy_filter ||=
|
|
95
|
+
@taxonomy_filter ||= collection.find_by(id: params[:id])
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
def set_taxonomies_breadcrumb_item
|
|
@@ -66,7 +66,7 @@ module Decidim
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def component
|
|
69
|
-
@component ||= Component.find_by(id: params[:component_id])
|
|
69
|
+
@component ||= Component.find_by(id: params[:component_id]) # rubocop:disable Decidim/OrganizationScopedFinder -- validated by before_action: component.organization == current_organization
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def root_taxonomy
|
|
@@ -26,6 +26,7 @@ module Decidim
|
|
|
26
26
|
|
|
27
27
|
allow! if user_can_enter_space_area?(require_admin_terms_accepted: true)
|
|
28
28
|
|
|
29
|
+
accept_admin_terms_action?
|
|
29
30
|
read_admin_dashboard_action?
|
|
30
31
|
apply_newsletter_permissions_for_admin!
|
|
31
32
|
|
|
@@ -43,6 +44,7 @@ module Decidim
|
|
|
43
44
|
allow! if user_action?
|
|
44
45
|
allow! if admin_user_action?
|
|
45
46
|
allow! if moderate_user_action?
|
|
47
|
+
allow! if resource_permission_action?
|
|
46
48
|
|
|
47
49
|
allow! if permission_action.subject == :component
|
|
48
50
|
allow! if permission_action.subject == :attachment
|
|
@@ -90,6 +92,13 @@ module Decidim
|
|
|
90
92
|
user && !user.admin? && user.role?("user_manager")
|
|
91
93
|
end
|
|
92
94
|
|
|
95
|
+
def accept_admin_terms_action?
|
|
96
|
+
return unless permission_action.subject == :admin_terms &&
|
|
97
|
+
permission_action.action == :accept
|
|
98
|
+
|
|
99
|
+
allow! if user.admin? || user_has_any_role?(user, nil, broad_check: true)
|
|
100
|
+
end
|
|
101
|
+
|
|
93
102
|
def read_admin_dashboard_action?
|
|
94
103
|
return unless permission_action.subject == :admin_dashboard &&
|
|
95
104
|
permission_action.action == :read
|
|
@@ -247,6 +256,13 @@ module Decidim
|
|
|
247
256
|
end
|
|
248
257
|
end
|
|
249
258
|
|
|
259
|
+
def resource_permission_action?
|
|
260
|
+
return unless permission_action.subject == :resource_permission &&
|
|
261
|
+
permission_action.action == :update
|
|
262
|
+
|
|
263
|
+
true
|
|
264
|
+
end
|
|
265
|
+
|
|
250
266
|
def organization
|
|
251
267
|
@organization ||= context.fetch(:organization, nil) || context.fetch(:current_organization, nil)
|
|
252
268
|
end
|
|
@@ -22,8 +22,24 @@
|
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
24
|
<div class="row column">
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
<fieldset class="row column" id="machine_translation_display_priority">
|
|
26
|
+
<legend>
|
|
27
|
+
<%= t("activemodel.attributes.organization.machine_translation_display_priority") %>
|
|
28
|
+
</legend>
|
|
29
|
+
<div class="radio-group">
|
|
30
|
+
<%# i18n-tasks-use t("decidim.admin.organization.form.machine_translation_display_priority.options.original") %>
|
|
31
|
+
<%# i18n-tasks-use t("decidim.admin.organization.form.machine_translation_display_priority.options.translation") %>
|
|
32
|
+
<%= form.collection_radio_buttons :machine_translation_display_priority, form.object.machine_translation_priorities, :first, :last do |builder| %>
|
|
33
|
+
<%= builder.label(for: nil, class: "form__wrapper-checkbox-label") do %>
|
|
34
|
+
<%= builder.radio_button(id: nil, label: false) %>
|
|
35
|
+
<span>
|
|
36
|
+
<strong class="font-semibold"><%= builder.text %></strong>
|
|
37
|
+
<%= t(builder.value, scope: "decidim.admin.organization.form.machine_translation_display_priority.options") %>
|
|
38
|
+
</span>
|
|
39
|
+
<% end %>
|
|
40
|
+
<% end %>
|
|
41
|
+
</div>
|
|
42
|
+
</fieldset>
|
|
27
43
|
</div>
|
|
28
44
|
<% end %>
|
|
29
45
|
|