decidim-admin 0.32.1 → 0.32.2
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 +2 -0
- data/app/controllers/decidim/admin/components_controller.rb +3 -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/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/participatory_space/concerns/has_members.rb +4 -0
- data/app/controllers/decidim/admin/participatory_space/concerns/has_members_csv_import.rb +2 -0
- 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/entrypoints/decidim_admin.js +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 +7 -3
- data/config/locales/cs.yml +5 -0
- data/config/locales/de.yml +37 -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 +55 -51
- data/config/locales/fi-plain.yml +4 -0
- data/config/locales/fi.yml +4 -0
- data/config/locales/fr-CA.yml +4 -0
- data/config/locales/fr.yml +4 -0
- data/config/locales/gl.yml +691 -48
- data/config/locales/ja.yml +4 -0
- data/config/locales/sv.yml +72 -2
- data/decidim-admin.gemspec +1 -1
- data/lib/decidim/admin/version.rb +1 -1
- metadata +7 -8
- data/app/packs/src/decidim/admin/tab_focus.js +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f7e4aa0b61296192c830ed2690b872cfe4d17a82cf9d4269fc151166d8953d16
|
|
4
|
+
data.tar.gz: bc62d61beb3506a34e90f3f9c286ec0f4f9230c8e9cacb1fbdd31e0449485510
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 327ac89d92b53e8e85e08018609fe9541d98af5fc2ade1515a49f25471dfde2fda77882537a7a03a6dddd501338591459a90c2140de67695dd01a94021b105e9
|
|
7
|
+
data.tar.gz: 3b008b454c45287c00555c08a47ee0f57481841fab52c43f21ac7fe6c08a36aba270c74fdde2e5c8943d00e1e47674e07a1e2f89d93e11005c83489442a1881e
|
|
@@ -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
|
|
@@ -10,7 +10,7 @@ module Decidim
|
|
|
10
10
|
helper_method :active_blocks, :active_content_blocks_title, :add_content_block_text, :available_manifests,
|
|
11
11
|
:content_block_destroy_confirmation_text, :content_blocks_title, :inactive_blocks,
|
|
12
12
|
:inactive_content_blocks_title, :resource_content_block_cell, :resource_create_url,
|
|
13
|
-
:resource_sort_url
|
|
13
|
+
:resource_sort_url, :scoped_resource
|
|
14
14
|
def edit
|
|
15
15
|
enforce_permission_to_update_resource
|
|
16
16
|
|
|
@@ -30,10 +30,6 @@ module Decidim
|
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
# Method that specifies the i18n scope for this controller. This can be overwritten in your controller.
|
|
34
|
-
# so that you can pass a different scope to the i18n methods.
|
|
35
|
-
def i18n_scope = "decidim.admin.content_blocks"
|
|
36
|
-
|
|
37
33
|
# Method to be implemented at the controller. Returns a string
|
|
38
34
|
# with the text for the title of content blocks
|
|
39
35
|
#
|
|
@@ -71,6 +67,10 @@ module Decidim
|
|
|
71
67
|
|
|
72
68
|
private
|
|
73
69
|
|
|
70
|
+
# Method that specifies the i18n scope for this controller. This can be overwritten in your controller.
|
|
71
|
+
# so that you can pass a different scope to the i18n methods.
|
|
72
|
+
def i18n_scope = "decidim.admin.content_blocks"
|
|
73
|
+
|
|
74
74
|
# Method to be implemented at the controller. You need to
|
|
75
75
|
# return a symbol that defines the content block scope.
|
|
76
76
|
# 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")
|
|
@@ -87,7 +87,7 @@ module Decidim
|
|
|
87
87
|
|
|
88
88
|
Decidim::Commands::SoftDeleteResource.call(trashable_deleted_resource, current_user) do
|
|
89
89
|
on(:ok) do
|
|
90
|
-
Decidim::Reminder.where(component: resource).destroy_all
|
|
90
|
+
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
|
|
91
91
|
flash[:notice] = I18n.t("soft_delete.success", scope: trashable_i18n_scope, resource_name: human_readable_resource_name.capitalize)
|
|
92
92
|
redirect_to_resource_index
|
|
93
93
|
end
|
|
@@ -136,7 +136,8 @@ module Decidim
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
def share
|
|
139
|
-
|
|
139
|
+
enforce_permission_to :share, :component
|
|
140
|
+
@component = query_scope.find(params.expect(:id))
|
|
140
141
|
share_token = @component.share_tokens.create!(user: current_user, organization: current_organization)
|
|
141
142
|
|
|
142
143
|
redirect_to share_token.url
|
|
@@ -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
|
|
@@ -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.expect(: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
|
|
@@ -114,6 +114,7 @@ module Decidim
|
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
def recipients_count
|
|
117
|
+
enforce_permission_to :read, :newsletter, newsletter:
|
|
117
118
|
@form = form(SelectiveNewsletterForm).from_params(newsletter_params)
|
|
118
119
|
render plain: recipients_count_query
|
|
119
120
|
end
|
|
@@ -183,6 +184,8 @@ module Decidim
|
|
|
183
184
|
end
|
|
184
185
|
end
|
|
185
186
|
|
|
187
|
+
protected
|
|
188
|
+
|
|
186
189
|
def collection
|
|
187
190
|
@collection ||= Newsletter.where(organization: current_organization)
|
|
188
191
|
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
|
|
@@ -107,6 +107,7 @@ module Decidim
|
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
def publish_all
|
|
110
|
+
enforce_permission_to :publish_all, :space_member
|
|
110
111
|
PublishAllMembers.call(current_participatory_space, current_user) do
|
|
111
112
|
on(:ok) do
|
|
112
113
|
flash[:notice] = I18n.t("members.publish_all.success", scope: "decidim.admin")
|
|
@@ -121,6 +122,7 @@ module Decidim
|
|
|
121
122
|
end
|
|
122
123
|
|
|
123
124
|
def unpublish_all
|
|
125
|
+
enforce_permission_to :unpublish_all, :space_member
|
|
124
126
|
UnpublishAllMembers.call(current_participatory_space, current_user) do
|
|
125
127
|
on(:ok) do
|
|
126
128
|
flash[:notice] = I18n.t("members.unpublish_all.success", scope: "decidim.admin")
|
|
@@ -134,6 +136,8 @@ module Decidim
|
|
|
134
136
|
end
|
|
135
137
|
end
|
|
136
138
|
|
|
139
|
+
protected
|
|
140
|
+
|
|
137
141
|
# Public: Returns a String or Object that will be passed to `redirect_to` after
|
|
138
142
|
# destroying a member. By default it redirects to the participatory_space.
|
|
139
143
|
#
|
|
@@ -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.expect(: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
|
|
@@ -18,8 +18,24 @@
|
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
20
|
<div class="row column">
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
<fieldset class="row column" id="machine_translation_display_priority">
|
|
22
|
+
<legend>
|
|
23
|
+
<%= t("activemodel.attributes.organization.machine_translation_display_priority") %>
|
|
24
|
+
</legend>
|
|
25
|
+
<div class="radio-group">
|
|
26
|
+
<%# i18n-tasks-use t("decidim.admin.organization.form.machine_translation_display_priority.options.original") %>
|
|
27
|
+
<%# i18n-tasks-use t("decidim.admin.organization.form.machine_translation_display_priority.options.translation") %>
|
|
28
|
+
<%= form.collection_radio_buttons :machine_translation_display_priority, form.object.machine_translation_priorities, :first, :last do |builder| %>
|
|
29
|
+
<%= builder.label(for: nil, class: "form__wrapper-checkbox-label") do %>
|
|
30
|
+
<%= builder.radio_button(id: nil, label: false) %>
|
|
31
|
+
<span>
|
|
32
|
+
<strong class="font-semibold"><%= builder.text %></strong>
|
|
33
|
+
<%= t(builder.value, scope: "decidim.admin.organization.form.machine_translation_display_priority.options") %>
|
|
34
|
+
</span>
|
|
35
|
+
<% end %>
|
|
36
|
+
<% end %>
|
|
37
|
+
</div>
|
|
38
|
+
</fieldset>
|
|
23
39
|
</div>
|
|
24
40
|
<% end %>
|
|
25
41
|
|