decidim-admin 0.28.4 → 0.29.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/app/cells/decidim/admin/content_block_cell.rb +0 -1
- data/app/cells/decidim/admin/results_per_page/show.erb +2 -2
- data/app/cells/decidim/admin/results_per_page_cell.rb +0 -2
- data/app/commands/decidim/admin/create_area.rb +4 -32
- data/app/commands/decidim/admin/create_area_type.rb +4 -33
- data/app/commands/decidim/admin/create_attachment.rb +5 -4
- data/app/commands/decidim/admin/create_attachment_collection.rb +3 -3
- data/app/commands/decidim/admin/create_category.rb +4 -37
- data/app/commands/decidim/admin/create_component.rb +7 -40
- data/app/commands/decidim/admin/create_newsletter.rb +11 -29
- data/app/commands/decidim/admin/create_participatory_space_private_user.rb +4 -4
- data/app/commands/decidim/admin/create_scope.rb +15 -32
- data/app/commands/decidim/admin/create_scope_type.rb +3 -32
- data/app/commands/decidim/admin/create_static_page.rb +6 -47
- data/app/commands/decidim/admin/create_static_page_topic.rb +4 -26
- data/app/commands/decidim/admin/deliver_newsletter.rb +4 -5
- data/app/commands/decidim/admin/destroy_area.rb +2 -25
- data/app/commands/decidim/admin/destroy_category.rb +4 -29
- data/app/commands/decidim/admin/destroy_component.rb +5 -43
- data/app/commands/decidim/admin/destroy_newsletter.rb +2 -30
- data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +5 -32
- data/app/commands/decidim/admin/destroy_scope.rb +6 -33
- data/app/commands/decidim/admin/officialize_user.rb +1 -1
- data/app/commands/decidim/admin/participatory_space/create_admin.rb +4 -4
- data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +5 -4
- data/app/commands/decidim/admin/promote_managed_user.rb +4 -5
- data/app/commands/decidim/admin/unofficialize_user.rb +1 -1
- data/app/commands/decidim/admin/update_area.rb +2 -41
- data/app/commands/decidim/admin/update_area_type.rb +2 -42
- data/app/commands/decidim/admin/update_attachment.rb +10 -7
- data/app/commands/decidim/admin/update_attachment_collection.rb +3 -3
- data/app/commands/decidim/admin/update_category.rb +2 -45
- data/app/commands/decidim/admin/update_component.rb +4 -5
- data/app/commands/decidim/admin/update_component_permissions.rb +3 -3
- data/app/commands/decidim/admin/{update_external_domain_whitelist.rb → update_external_domain_allowlist.rb} +6 -5
- data/app/commands/decidim/admin/update_help_sections.rb +6 -3
- data/app/commands/decidim/admin/update_newsletter.rb +8 -8
- data/app/commands/decidim/admin/update_organization.rb +9 -53
- data/app/commands/decidim/admin/update_organization_appearance.rb +10 -81
- data/app/commands/decidim/admin/update_scope.rb +7 -40
- data/app/commands/decidim/admin/update_scope_type.rb +2 -42
- data/app/commands/decidim/admin/update_static_page.rb +5 -46
- data/app/commands/decidim/admin/update_static_page_topic.rb +2 -43
- data/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
- data/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb +2 -2
- data/app/controllers/concerns/decidim/admin/filterable.rb +79 -4
- data/app/controllers/concerns/decidim/admin/global_moderation_context.rb +1 -1
- data/app/controllers/concerns/decidim/admin/needs_admin_tos_accepted.rb +0 -7
- data/app/controllers/concerns/decidim/admin/paginable.rb +20 -0
- data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +1 -1
- data/app/controllers/decidim/admin/application_controller.rb +2 -1
- data/app/controllers/decidim/admin/area_types_controller.rb +8 -9
- data/app/controllers/decidim/admin/areas_controller.rb +1 -1
- data/app/controllers/decidim/admin/authorization_workflows_controller.rb +1 -1
- data/app/controllers/decidim/admin/categories_controller.rb +2 -2
- data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
- data/app/controllers/decidim/admin/components_controller.rb +2 -2
- data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +2 -2
- data/app/controllers/decidim/admin/concerns/has_attachments.rb +2 -2
- data/app/controllers/decidim/admin/concerns/has_private_users.rb +1 -1
- data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +1 -1
- data/app/controllers/decidim/admin/conflicts_controller.rb +5 -13
- data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
- data/app/controllers/decidim/admin/managed_users/promotions_controller.rb +1 -1
- data/app/controllers/decidim/admin/moderations/reports_controller.rb +4 -4
- data/app/controllers/decidim/admin/moderations_controller.rb +7 -7
- data/app/controllers/decidim/admin/newsletter_templates_controller.rb +1 -1
- data/app/controllers/decidim/admin/newsletters_controller.rb +5 -5
- data/app/controllers/decidim/admin/organization_appearance_controller.rb +1 -1
- data/app/controllers/decidim/admin/organization_controller.rb +1 -1
- data/app/controllers/decidim/admin/{organization_external_domain_whitelist_controller.rb → organization_external_domain_allowlist_controller.rb} +7 -7
- data/app/controllers/decidim/admin/scope_types_controller.rb +7 -8
- data/app/controllers/decidim/admin/scopes_controller.rb +1 -1
- data/app/controllers/decidim/admin/share_tokens_controller.rb +1 -1
- data/app/controllers/decidim/admin/static_page_topics_controller.rb +2 -2
- data/app/controllers/decidim/admin/static_pages_controller.rb +2 -2
- data/app/forms/decidim/admin/attachment_form.rb +7 -1
- data/app/forms/decidim/admin/organization_appearance_form.rb +0 -3
- data/app/forms/decidim/admin/{organization_external_domain_whitelist_form.rb → organization_external_domain_allowlist_form.rb} +3 -3
- data/app/forms/decidim/admin/organization_form.rb +2 -2
- data/app/forms/decidim/admin/static_page_form.rb +0 -1
- data/app/helpers/decidim/admin/application_helper.rb +0 -13
- data/app/helpers/decidim/admin/filterable_helper.rb +19 -3
- data/app/helpers/decidim/admin/moderations/reports_helper.rb +3 -1
- data/app/helpers/decidim/admin/newsletters_helper.rb +3 -3
- data/app/helpers/decidim/admin/paginable/per_page_helper.rb +22 -0
- data/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb +2 -2
- data/app/packs/entrypoints/decidim_admin.js +4 -1
- data/app/packs/src/decidim/admin/application.js +19 -15
- data/app/packs/src/decidim/admin/css_preview.js +39 -0
- data/app/packs/src/decidim/admin/form.js +18 -1
- data/app/packs/src/decidim/admin/participatory_space_search.js +1 -1
- data/app/packs/src/decidim/admin/proposal_infinite_edit.js +2 -2
- data/app/packs/src/decidim/admin/sync_radio_buttons.js +27 -0
- data/app/packs/src/decidim/admin/text_copy.js +19 -0
- data/app/packs/stylesheets/decidim/admin/_cards.scss +1 -1
- data/app/packs/stylesheets/decidim/admin/_datepicker.scss +62 -0
- data/app/packs/stylesheets/decidim/admin/_item_edit.scss +1 -1
- data/app/packs/stylesheets/decidim/admin/_item_show.scss +8 -0
- data/app/packs/stylesheets/decidim/admin/_proposal_status.scss +5 -0
- data/app/packs/stylesheets/decidim/admin/application.scss +2 -0
- data/app/permissions/decidim/admin/permissions.rb +2 -2
- data/app/queries/decidim/admin/user_filter.rb +4 -4
- data/app/queries/decidim/admin/user_groups_evaluation.rb +1 -1
- data/app/views/decidim/admin/attachment_collections/index.html.erb +1 -1
- data/app/views/decidim/admin/attachments/_form.html.erb +21 -2
- data/app/views/decidim/admin/attachments/index.html.erb +2 -2
- data/app/views/decidim/admin/authorization_workflows/index.html.erb +26 -8
- data/app/views/decidim/admin/block_user/new.html.erb +1 -1
- data/app/views/decidim/admin/categories/index.html.erb +2 -2
- data/app/views/decidim/admin/components/_form.html.erb +1 -1
- data/app/views/decidim/admin/components/index.html.erb +1 -5
- data/app/views/decidim/admin/conflicts/index.html.erb +6 -29
- data/app/views/decidim/admin/dashboard/_pending_moderations.html.erb +1 -1
- data/app/views/decidim/admin/dashboard/show.html.erb +1 -1
- data/app/views/decidim/admin/exports/_dropdown.html.erb +6 -6
- data/app/views/decidim/admin/impersonatable_users/index.html.erb +3 -3
- data/app/views/decidim/admin/imports/_dropdown.html.erb +5 -7
- data/app/views/decidim/admin/imports/new.html.erb +6 -7
- data/app/views/decidim/admin/logs/_filters.html.erb +3 -3
- data/app/views/decidim/admin/managed_users/promotions/new.html.erb +1 -1
- data/app/views/decidim/admin/moderated_users/index.html.erb +2 -2
- data/app/views/decidim/admin/moderations/index.html.erb +5 -5
- data/app/views/decidim/admin/moderations/reports/index.html.erb +6 -6
- data/app/views/decidim/admin/moderations/reports/show.html.erb +4 -4
- data/app/views/decidim/admin/newsletter_templates/index.html.erb +2 -2
- data/app/views/decidim/admin/newsletter_templates/show.html.erb +7 -7
- data/app/views/decidim/admin/newsletters/index.html.erb +1 -1
- data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +6 -7
- data/app/views/decidim/admin/newsletters/show.html.erb +1 -1
- data/app/views/decidim/admin/organization/_form.html.erb +3 -3
- data/app/views/decidim/admin/organization_appearance/form/_colors.html.erb +0 -3
- data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -5
- data/app/views/decidim/admin/organization_appearance/form/_minimap.html.erb +3 -3
- data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/_external_domain.html.erb +4 -4
- data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/_form.html.erb +2 -2
- data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/edit.html.erb +2 -2
- data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +1 -1
- data/app/views/decidim/admin/participatory_space_private_users_csv_imports/new.html.erb +1 -1
- data/app/views/decidim/admin/share_tokens/_share_tokens.html.erb +1 -1
- data/app/views/decidim/admin/shared/_adjacent_navigation.html.erb +30 -0
- data/app/views/decidim/admin/shared/_admin_confirm_modal.html.erb +7 -7
- data/app/views/decidim/admin/shared/_filters.html.erb +1 -1
- data/app/views/decidim/admin/shared/_gallery.html.erb +1 -1
- data/app/views/decidim/admin/shared/landing_page/_content_blocks.html.erb +2 -2
- data/app/views/decidim/admin/static_page_topics/index.html.erb +1 -1
- data/app/views/decidim/admin/static_pages/_form.html.erb +0 -4
- data/app/views/decidim/admin/users_statistics/_users_count.html.erb +2 -2
- data/app/views/layouts/decidim/admin/_admin_timeout_modal.html.erb +2 -2
- data/app/views/layouts/decidim/admin/_application.html.erb +4 -4
- data/app/views/layouts/decidim/admin/_callouts_full.html.erb +1 -1
- data/app/views/layouts/decidim/admin/_js_configuration.html.erb +3 -1
- data/app/views/layouts/decidim/admin/_title_bar.html.erb +2 -2
- data/app/views/layouts/decidim/admin/_title_bar_responsive.html.erb +2 -2
- data/config/locales/ar.yml +0 -7
- data/config/locales/bg.yml +15 -12
- data/config/locales/ca.yml +18 -15
- data/config/locales/cs.yml +15 -17
- data/config/locales/de.yml +15 -12
- data/config/locales/el.yml +0 -12
- data/config/locales/en.yml +16 -13
- data/config/locales/es-MX.yml +16 -13
- data/config/locales/es-PY.yml +16 -13
- data/config/locales/es.yml +18 -15
- data/config/locales/eu.yml +16 -13
- data/config/locales/fi-plain.yml +15 -12
- data/config/locales/fi.yml +19 -16
- data/config/locales/fr-CA.yml +14 -11
- data/config/locales/fr.yml +13 -10
- data/config/locales/ga-IE.yml +0 -3
- data/config/locales/gl.yml +0 -5
- data/config/locales/hu.yml +9 -10
- data/config/locales/id-ID.yml +0 -3
- data/config/locales/is-IS.yml +0 -3
- data/config/locales/it.yml +0 -8
- data/config/locales/ja.yml +18 -15
- data/config/locales/kaa.yml +0 -3
- data/config/locales/ko.yml +0 -6
- data/config/locales/lb.yml +0 -8
- data/config/locales/lt.yml +0 -13
- data/config/locales/lv.yml +0 -3
- data/config/locales/nl.yml +0 -8
- data/config/locales/no.yml +0 -8
- data/config/locales/pl.yml +14 -9
- data/config/locales/pt-BR.yml +8 -13
- data/config/locales/pt.yml +0 -8
- data/config/locales/ro-RO.yml +3 -21
- data/config/locales/ru.yml +0 -3
- data/config/locales/sk.yml +0 -3
- data/config/locales/sq-AL.yml +0 -3
- data/config/locales/sr-CS.yml +0 -3
- data/config/locales/sv.yml +207 -355
- data/config/locales/th-TH.yml +0 -3
- data/config/locales/tr-TR.yml +0 -5
- data/config/locales/uk.yml +0 -3
- data/config/locales/zh-CN.yml +0 -3
- data/config/locales/zh-TW.yml +0 -12
- data/config/routes.rb +1 -1
- data/decidim-admin.gemspec +1 -1
- data/lib/decidim/admin/import/creator.rb +1 -1
- data/lib/decidim/admin/import/importer_factory.rb +2 -2
- data/lib/decidim/admin/menu.rb +4 -4
- data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +3 -2
- data/lib/decidim/admin/test/commands/create_category_examples.rb +4 -2
- data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +3 -2
- data/lib/decidim/admin/test/commands/update_category_examples.rb +3 -2
- data/lib/decidim/admin/test/filterable_examples.rb +5 -3
- data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +5 -5
- data/lib/decidim/admin/test/invite_participatory_space_admins_shared_examples.rb +1 -1
- data/lib/decidim/admin/test/invite_participatory_space_users_shared_context.rb +0 -1
- data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +12 -12
- data/lib/decidim/admin/test/manage_attachments_examples.rb +52 -28
- data/lib/decidim/admin/test/manage_categories_examples.rb +13 -13
- data/lib/decidim/admin/test/manage_component_permissions_examples.rb +5 -5
- data/lib/decidim/admin/test/manage_hide_content_examples.rb +4 -4
- data/lib/decidim/admin/test/manage_moderations_examples.rb +21 -21
- data/lib/decidim/admin/test/manage_paginated_collection_examples.rb +5 -5
- data/lib/decidim/admin/test/manage_participatory_space_publications_examples.rb +2 -2
- data/lib/decidim/admin/version.rb +1 -1
- data/lib/decidim/admin.rb +15 -0
- metadata +27 -24
- data/app/commands/decidim/admin/destroy_share_token.rb +0 -46
- data/app/commands/decidim/admin/destroy_static_page.rb +0 -40
- data/app/commands/decidim/admin/destroy_static_page_topic.rb +0 -40
- data/app/controllers/concerns/decidim/admin/verification_conflicts/filterable.rb +0 -31
- data/app/views/layouts/decidim/admin/login.html.erb +0 -19
- /data/app/packs/src/decidim/admin/{external_domain_whitelist.js → external_domain_allowlist.js} +0 -0
@@ -26,7 +26,7 @@ module Decidim
|
|
26
26
|
enforce_permission_to :create, :scope_type
|
27
27
|
@form = form(ScopeTypeForm).from_params(params)
|
28
28
|
|
29
|
-
CreateScopeType.call(@form
|
29
|
+
CreateScopeType.call(@form) do
|
30
30
|
on(:ok) do
|
31
31
|
flash[:notice] = I18n.t("scope_types.create.success", scope: "decidim.admin")
|
32
32
|
redirect_to scope_types_path
|
@@ -48,7 +48,7 @@ module Decidim
|
|
48
48
|
enforce_permission_to(:update, :scope_type, scope_type:)
|
49
49
|
@form = form(ScopeTypeForm).from_params(params)
|
50
50
|
|
51
|
-
UpdateScopeType.call(
|
51
|
+
UpdateScopeType.call(@form, scope_type) do
|
52
52
|
on(:ok) do
|
53
53
|
flash[:notice] = I18n.t("scope_types.update.success", scope: "decidim.admin")
|
54
54
|
redirect_to scope_types_path
|
@@ -64,13 +64,12 @@ module Decidim
|
|
64
64
|
def destroy
|
65
65
|
enforce_permission_to(:destroy, :scope_type, scope_type:)
|
66
66
|
|
67
|
-
Decidim.
|
68
|
-
|
67
|
+
Decidim::Commands::DestroyResource.call(scope_type, current_user) do
|
68
|
+
on(:ok) do
|
69
|
+
flash[:notice] = I18n.t("scope_types.destroy.success", scope: "decidim.admin")
|
70
|
+
redirect_to scope_types_path
|
71
|
+
end
|
69
72
|
end
|
70
|
-
|
71
|
-
flash[:notice] = I18n.t("scope_types.destroy.success", scope: "decidim.admin")
|
72
|
-
|
73
|
-
redirect_to scope_types_path
|
74
73
|
end
|
75
74
|
|
76
75
|
private
|
@@ -49,7 +49,7 @@ module Decidim
|
|
49
49
|
enforce_permission_to(:update, :scope, scope:)
|
50
50
|
@form = form(ScopeForm).from_params(params)
|
51
51
|
|
52
|
-
UpdateScope.call(
|
52
|
+
UpdateScope.call(@form, scope) do
|
53
53
|
on(:ok) do
|
54
54
|
flash[:notice] = I18n.t("scopes.update.success", scope: "decidim.admin")
|
55
55
|
redirect_to current_scopes_path
|
@@ -6,7 +6,7 @@ module Decidim
|
|
6
6
|
def destroy
|
7
7
|
enforce_permission_to(:destroy, :share_token, share_token:)
|
8
8
|
|
9
|
-
|
9
|
+
Decidim::Commands::DestroyResource.call(share_token, current_user) do
|
10
10
|
on(:ok) do
|
11
11
|
flash[:notice] = I18n.t("share_tokens.destroy.success", scope: "decidim.admin")
|
12
12
|
end
|
@@ -44,7 +44,7 @@ module Decidim
|
|
44
44
|
enforce_permission_to :update, :static_page_topic, static_page_topic: topic
|
45
45
|
@form = form(StaticPageTopicForm).from_params(params["static_page_topic"])
|
46
46
|
|
47
|
-
UpdateStaticPageTopic.call(
|
47
|
+
UpdateStaticPageTopic.call(@form, topic) do
|
48
48
|
on(:ok) do
|
49
49
|
flash[:notice] = I18n.t("static_page_topics.update.success", scope: "decidim.admin")
|
50
50
|
redirect_to static_page_topics_path
|
@@ -60,7 +60,7 @@ module Decidim
|
|
60
60
|
def destroy
|
61
61
|
enforce_permission_to :destroy, :static_page_topic, static_page_topic: topic
|
62
62
|
|
63
|
-
|
63
|
+
Decidim::Commands::DestroyResource.call(topic, current_user) do
|
64
64
|
on(:ok) do
|
65
65
|
flash[:notice] = I18n.t("static_page_topics.destroy.success", scope: "decidim.admin")
|
66
66
|
redirect_to static_page_topics_path
|
@@ -77,7 +77,7 @@ module Decidim
|
|
77
77
|
enforce_permission_to :update, :static_page, static_page: page
|
78
78
|
@form = form(StaticPageForm).from_params(form_params)
|
79
79
|
|
80
|
-
UpdateStaticPage.call(
|
80
|
+
UpdateStaticPage.call(@form, page) do
|
81
81
|
on(:ok) do
|
82
82
|
flash[:notice] = I18n.t("static_pages.update.success", scope: "decidim.admin")
|
83
83
|
redirect_to static_pages_path
|
@@ -93,7 +93,7 @@ module Decidim
|
|
93
93
|
def destroy
|
94
94
|
enforce_permission_to :destroy, :static_page, static_page: page
|
95
95
|
|
96
|
-
|
96
|
+
Decidim::Commands::DestroyResource.call(page, current_user) do
|
97
97
|
on(:ok) do
|
98
98
|
flash[:notice] = I18n.t("static_pages.destroy.success", scope: "decidim.admin")
|
99
99
|
redirect_to static_pages_path
|
@@ -12,10 +12,12 @@ module Decidim
|
|
12
12
|
translatable_attribute :description, String
|
13
13
|
attribute :weight, Integer, default: 0
|
14
14
|
attribute :attachment_collection_id, Integer
|
15
|
+
attribute :link, String
|
15
16
|
|
16
17
|
mimic :attachment
|
17
18
|
|
18
|
-
validates :file, presence: true, unless: :
|
19
|
+
validates :file, presence: true, unless: :persisted_or_link?
|
20
|
+
validates :link, url: true
|
19
21
|
validates :file, passthru: { to: Decidim::Attachment }
|
20
22
|
validates :title, :description, translatable_presence: true
|
21
23
|
validates :attachment_collection, presence: true, if: ->(form) { form.attachment_collection_id.present? }
|
@@ -25,6 +27,10 @@ module Decidim
|
|
25
27
|
|
26
28
|
alias organization current_organization
|
27
29
|
|
30
|
+
def persisted_or_link?
|
31
|
+
persisted? || link.present?
|
32
|
+
end
|
33
|
+
|
28
34
|
def attachment_collections
|
29
35
|
@attachment_collections ||= attached_to.attachment_collections
|
30
36
|
end
|
@@ -30,9 +30,6 @@ module Decidim
|
|
30
30
|
attribute :primary_color, String
|
31
31
|
attribute :secondary_color, String
|
32
32
|
attribute :tertiary_color, String
|
33
|
-
attribute :success_color, String
|
34
|
-
attribute :warning_color, String
|
35
|
-
attribute :alert_color, String
|
36
33
|
|
37
34
|
translatable_attribute :cta_button_text, String
|
38
35
|
translatable_attribute :description, String
|
@@ -2,20 +2,20 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
|
-
class
|
5
|
+
class OrganizationExternalDomainAllowlistForm < Form
|
6
6
|
attribute :external_domains, Array[Decidim::Admin::ExternalDomainForm]
|
7
7
|
|
8
8
|
validate :external_domains_validator
|
9
9
|
|
10
10
|
def map_model(model)
|
11
|
-
self.external_domains = model.
|
11
|
+
self.external_domains = model.external_domain_allowlist.map do |external_domain|
|
12
12
|
ExternalDomainForm.new(value: external_domain)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
def external_domains_validator
|
17
17
|
@external_domains_validator ||= external_domains.reject(&:deleted).each do |domain|
|
18
|
-
errors.add(:external_domains, I18n.t("decidim.admin.
|
18
|
+
errors.add(:external_domains, I18n.t("decidim.admin.domain_allowlist.form.domain_too_short")) if domain.value.length <= 3
|
19
19
|
end.map(&:value).uniq
|
20
20
|
end
|
21
21
|
end
|
@@ -10,7 +10,7 @@ module Decidim
|
|
10
10
|
|
11
11
|
mimic :organization
|
12
12
|
|
13
|
-
|
13
|
+
translatable_attribute :name, String
|
14
14
|
attribute :reference_prefix, String
|
15
15
|
attribute :time_zone, String
|
16
16
|
attribute :twitter_handler, String
|
@@ -37,7 +37,7 @@ module Decidim
|
|
37
37
|
|
38
38
|
validates :welcome_notification_subject, :welcome_notification_body, translatable_presence: true, if: proc { |form| form.customize_welcome_notification }
|
39
39
|
|
40
|
-
validates :name,
|
40
|
+
validates :name, translatable_presence: true
|
41
41
|
validates :time_zone, presence: true
|
42
42
|
validates :time_zone, time_zone: true
|
43
43
|
validates :default_locale, :reference_prefix, presence: true
|
@@ -11,7 +11,6 @@ module Decidim
|
|
11
11
|
translatable_attribute :title, String
|
12
12
|
translatable_attribute :content, String
|
13
13
|
attribute :changed_notably, Boolean
|
14
|
-
attribute :show_in_footer, Boolean
|
15
14
|
attribute :allow_public_access, Boolean
|
16
15
|
attribute :weight, Integer
|
17
16
|
attribute :topic_id, Integer
|
@@ -16,19 +16,6 @@ module Decidim
|
|
16
16
|
include Decidim::Admin::ResourceScopeHelper
|
17
17
|
include Decidim::Admin::SearchFormHelper
|
18
18
|
|
19
|
-
# Public: Overwrites the `cell` helper method to automatically set some
|
20
|
-
# common context.
|
21
|
-
#
|
22
|
-
# name - the name of the cell to render
|
23
|
-
# model - the cell model
|
24
|
-
# options - a Hash with options
|
25
|
-
#
|
26
|
-
# Renders the cell contents.
|
27
|
-
def cell(name, model, options = {}, &)
|
28
|
-
options = { context: { view_context: self, current_user: } }.deep_merge(options)
|
29
|
-
super
|
30
|
-
end
|
31
|
-
|
32
19
|
def participatory_space_active_link?(component)
|
33
20
|
endpoints = component.manifest.admin_engine.try(:participatory_space_endpoints)
|
34
21
|
endpoints && is_active_link?(decidim_admin_participatory_processes.components_path(current_participatory_space), %r{/\d+/manage/(#{endpoints.join("|")})\b})
|
@@ -32,7 +32,7 @@ module Decidim
|
|
32
32
|
links.index_with { nil }
|
33
33
|
end
|
34
34
|
|
35
|
-
# To be
|
35
|
+
# To be overridden. Useful for adding links that do not match with the filter.
|
36
36
|
# Must return an Array.
|
37
37
|
def extra_dropdown_submenu_options_items(_filter, _i18n_scope)
|
38
38
|
[]
|
@@ -98,9 +98,14 @@ module Decidim
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def applied_filters_tags(i18n_ctx)
|
101
|
-
ransack_params.slice(*filters).map do |filter, value|
|
101
|
+
tags = ransack_params.slice(*filters).map do |filter, value|
|
102
102
|
applied_filter_tag(filter, value, filterable_i18n_scope_from_ctx(i18n_ctx))
|
103
|
-
end
|
103
|
+
end
|
104
|
+
return if tags.blank?
|
105
|
+
|
106
|
+
tags << remove_all_filters_tag if tags.count > 1
|
107
|
+
|
108
|
+
tags.join.html_safe
|
104
109
|
end
|
105
110
|
|
106
111
|
def applied_filter_tag(filter, value, i18n_scope)
|
@@ -111,6 +116,13 @@ module Decidim
|
|
111
116
|
end
|
112
117
|
end
|
113
118
|
|
119
|
+
def remove_all_filters_tag
|
120
|
+
link_to(url_for(blank_query_params), class: "label bg-transparent") do
|
121
|
+
concat t("decidim.admin.filters.remove_all")
|
122
|
+
concat icon("delete-bin-line", aria_label: t("decidim.admin.filters.remove_all"), role: "img")
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
114
126
|
def remove_filter_icon_link(filter)
|
115
127
|
icon_link_to(
|
116
128
|
"delete-bin-line",
|
@@ -125,6 +137,10 @@ module Decidim
|
|
125
137
|
i18n_scope += ".#{i18n_ctx}" if i18n_ctx
|
126
138
|
i18n_scope
|
127
139
|
end
|
140
|
+
|
141
|
+
def filtered_adjacent_paths(item, path_method)
|
142
|
+
adjacent_items(item).transform_values(&method(path_method))
|
143
|
+
end
|
128
144
|
end
|
129
145
|
end
|
130
146
|
end
|
@@ -25,9 +25,11 @@ module Decidim
|
|
25
25
|
when Decidim::Meetings::Meeting
|
26
26
|
content_tag :li do
|
27
27
|
link_to resource_locator(author).path, target: "_blank", rel: "noopener" do
|
28
|
-
|
28
|
+
decidim_sanitize_translated(author.title)
|
29
29
|
end
|
30
30
|
end
|
31
|
+
when Decidim::Organization
|
32
|
+
content_tag :li, organization_name(author)
|
31
33
|
else
|
32
34
|
content_tag(:li, author.name)
|
33
35
|
end
|
@@ -65,7 +65,7 @@ module Decidim
|
|
65
65
|
|
66
66
|
def sent_to_spaces(newsletter)
|
67
67
|
html = "<p style='margin-bottom:0;'> "
|
68
|
-
newsletter.
|
68
|
+
newsletter.sent_to_participatory_spaces.try(:each) do |type|
|
69
69
|
next if type["ids"].blank?
|
70
70
|
|
71
71
|
html += t("index.segmented_to", scope: "decidim.admin.newsletters", subject: t("activerecord.models.decidim/#{type["manifest_name"].singularize}.other"))
|
@@ -74,7 +74,7 @@ module Decidim
|
|
74
74
|
else
|
75
75
|
Decidim.find_participatory_space_manifest(type["manifest_name"].to_sym)
|
76
76
|
.participatory_spaces.call(current_organization).where(id: type["ids"]).each do |space|
|
77
|
-
html += "<strong>#{
|
77
|
+
html += "<strong>#{decidim_escape_translated(space.title)}</strong>"
|
78
78
|
end
|
79
79
|
end
|
80
80
|
html += "<br/>"
|
@@ -88,7 +88,7 @@ module Decidim
|
|
88
88
|
concat t("index.segmented_to", scope: "decidim.admin.newsletters", subject: nil)
|
89
89
|
if newsletter.sent_scopes.any?
|
90
90
|
newsletter.sent_scopes.each do |scope|
|
91
|
-
concat content_tag(:strong,
|
91
|
+
concat content_tag(:strong, decidim_escape_translated(scope.name).to_s)
|
92
92
|
end
|
93
93
|
else
|
94
94
|
concat content_tag(:strong, t("index.no_scopes", scope: "decidim.admin.newsletters"))
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
module Paginable
|
6
|
+
# This module includes helpers the :per_page cell's option
|
7
|
+
module PerPageHelper
|
8
|
+
def per_page_options
|
9
|
+
OpenStruct.new(
|
10
|
+
per_page:,
|
11
|
+
per_page_range: Decidim::Admin.per_page_range
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Renders the pagination dropdown menu in the admin panel.
|
16
|
+
def admin_filters_pagination
|
17
|
+
cell("decidim/admin/results_per_page", per_page_options)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -17,10 +17,10 @@ module Decidim
|
|
17
17
|
private_user_form = ParticipatorySpacePrivateUserForm.from_params(params, privatable_to:)
|
18
18
|
.with_context(
|
19
19
|
current_user:,
|
20
|
-
|
20
|
+
current_participatory_space: privatable_to
|
21
21
|
)
|
22
22
|
|
23
|
-
Decidim::Admin::CreateParticipatorySpacePrivateUser.call(private_user_form,
|
23
|
+
Decidim::Admin::CreateParticipatorySpacePrivateUser.call(private_user_form, privatable_to, via_csv: true)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -8,7 +8,7 @@ import "src/decidim/admin/resources_permissions"
|
|
8
8
|
import "src/decidim/admin/welcome_notification"
|
9
9
|
import "src/decidim/admin/newsletters"
|
10
10
|
import "src/decidim/admin/form"
|
11
|
-
import "src/decidim/admin/
|
11
|
+
import "src/decidim/admin/external_domain_allowlist"
|
12
12
|
import "src/decidim/admin/draggable-list"
|
13
13
|
import "src/decidim/admin/sortable"
|
14
14
|
import "src/decidim/admin/moderations"
|
@@ -17,6 +17,9 @@ import "src/decidim/slug_form"
|
|
17
17
|
import "src/decidim/admin/admin_autocomplete"
|
18
18
|
import "src/decidim/admin/triadic_color_picker"
|
19
19
|
import "src/decidim/admin/participatory_space_search"
|
20
|
+
import "src/decidim/admin/css_preview"
|
21
|
+
import "src/decidim/admin/sync_radio_buttons"
|
22
|
+
import "src/decidim/admin/text_copy"
|
20
23
|
|
21
24
|
// CSS
|
22
25
|
import "entrypoints/decidim_admin.scss";
|
@@ -1,15 +1,15 @@
|
|
1
1
|
/* eslint-disable no-invalid-this */
|
2
2
|
|
3
|
-
import toggleNav from "src/decidim/admin/toggle_nav"
|
4
|
-
import createSortList from "src/decidim/admin/sort_list.component"
|
5
|
-
import FormFilterComponent from "src/decidim/form_filter"
|
6
|
-
import Configuration from "src/decidim/configuration"
|
7
|
-
import InputCharacterCounter from "src/decidim/input_character_counter"
|
8
|
-
import managedUsersForm from "src/decidim/admin/managed_users"
|
3
|
+
import toggleNav from "src/decidim/admin/toggle_nav";
|
4
|
+
import createSortList from "src/decidim/admin/sort_list.component";
|
5
|
+
import FormFilterComponent from "src/decidim/form_filter";
|
6
|
+
import Configuration from "src/decidim/configuration";
|
7
|
+
import InputCharacterCounter from "src/decidim/input_character_counter";
|
8
|
+
import managedUsersForm from "src/decidim/admin/managed_users";
|
9
9
|
|
10
10
|
window.Decidim = window.Decidim || {};
|
11
|
-
window.Decidim.managedUsersForm = managedUsersForm
|
12
|
-
window.Decidim.config = new Configuration()
|
11
|
+
window.Decidim.managedUsersForm = managedUsersForm;
|
12
|
+
window.Decidim.config = new Configuration();
|
13
13
|
window.Decidim.InputCharacterCounter = InputCharacterCounter;
|
14
14
|
|
15
15
|
// REDESIGN_PENDING: deprecated
|
@@ -31,23 +31,27 @@ $(() => {
|
|
31
31
|
toggleNav();
|
32
32
|
|
33
33
|
createSortList("#steps tbody", {
|
34
|
-
placeholder: $(
|
34
|
+
placeholder: $(
|
35
|
+
'<tr style="border-style: dashed; border-color: #000"><td colspan="4"> </td></tr>'
|
36
|
+
)[0],
|
35
37
|
onSortUpdate: ($children) => {
|
36
|
-
const sortUrl = $("#steps tbody").data("sort-url")
|
37
|
-
const order = $children.
|
38
|
+
const sortUrl = $("#steps tbody").data("sort-url");
|
39
|
+
const order = $children.
|
40
|
+
map((index, child) => $(child).data("id")).
|
41
|
+
toArray();
|
38
42
|
|
39
43
|
$.ajax({
|
40
44
|
method: "POST",
|
41
45
|
url: sortUrl,
|
42
46
|
contentType: "application/json",
|
43
|
-
data: JSON.stringify({ items_ids: order })
|
44
|
-
);
|
47
|
+
data: JSON.stringify({ items_ids: order }) // eslint-disable-line camelcase
|
48
|
+
});
|
45
49
|
}
|
46
|
-
})
|
50
|
+
});
|
47
51
|
|
48
52
|
$("form.new_filter").each(function () {
|
49
53
|
const formFilter = new FormFilterComponent($(this));
|
50
54
|
|
51
55
|
formFilter.mountComponent();
|
52
|
-
})
|
56
|
+
});
|
53
57
|
});
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// Preview CSS changes in real time through data attributes when the change event is dispatched.
|
2
|
+
//
|
3
|
+
// @example
|
4
|
+
// ```erb
|
5
|
+
// <%= form.radio_button :text_color, "Blue"
|
6
|
+
// data: {
|
7
|
+
// "css-preview" => true,
|
8
|
+
// "css-preview-updates" => "[data-css-example]:color:blue;"
|
9
|
+
// } %>
|
10
|
+
//
|
11
|
+
// <%= form.radio_button :text_color, "Red"
|
12
|
+
// data: {
|
13
|
+
// "css-preview" => true,
|
14
|
+
// "css-preview-updates" => "[data-css-example]:color:red;"
|
15
|
+
// } %>
|
16
|
+
//
|
17
|
+
// <div data-css-example>This is an example</div>
|
18
|
+
// ```
|
19
|
+
//
|
20
|
+
// It supports multiple rules separated by semicolons:
|
21
|
+
// selector:property:value; selector:property:value;
|
22
|
+
//
|
23
|
+
// for example:
|
24
|
+
// strong[data-css-example]:color:#0000ff; strong[data-css-example]:backgroundColor:#eeeeee;
|
25
|
+
//
|
26
|
+
window.addEventListener("DOMContentLoaded", () => {
|
27
|
+
document.querySelectorAll("input[data-css-preview=true]").forEach((element) => {
|
28
|
+
element.addEventListener("change", (event) => {
|
29
|
+
const updateRules = event.target.dataset.cssPreviewUpdates.split(";");
|
30
|
+
|
31
|
+
updateRules.forEach((rule) => {
|
32
|
+
const [target, property, value] = rule.split(":");
|
33
|
+
if (target !== "") {
|
34
|
+
document.querySelector(target).style[property.trim()] = value.trim();
|
35
|
+
}
|
36
|
+
});
|
37
|
+
})
|
38
|
+
})
|
39
|
+
})
|
@@ -28,7 +28,7 @@ $(() => {
|
|
28
28
|
// - amendment_promotion_enabled
|
29
29
|
|
30
30
|
// (1) Hides target fields if amendments_enabled component setting is NOT checked.
|
31
|
-
// (2) Toggles
|
31
|
+
// (2) Toggles visibility of target fields when amendments_enabled component setting is clicked.
|
32
32
|
const $amendmentsEnabled = $("input#component_settings_amendments_enabled");
|
33
33
|
|
34
34
|
if ($amendmentsEnabled.length > 0) {
|
@@ -42,4 +42,21 @@ $(() => {
|
|
42
42
|
$amendmentStepSettings.toggle();
|
43
43
|
});
|
44
44
|
}
|
45
|
+
|
46
|
+
// Toggles visibility of the attachments_allowed help text when the checkbox is clicked.
|
47
|
+
// Show the help text if the checkbox is checked.
|
48
|
+
const $attachmentsAllowedCheckbox = $("#component_settings_attachments_allowed");
|
49
|
+
const $attachmentsHelpText = $(".attachments_allowed_container .help-text");
|
50
|
+
|
51
|
+
if (!$attachmentsAllowedCheckbox.is(":checked")) {
|
52
|
+
$attachmentsHelpText.hide();
|
53
|
+
}
|
54
|
+
|
55
|
+
$attachmentsAllowedCheckbox.on("change", () => {
|
56
|
+
if ($attachmentsAllowedCheckbox.is(":checked")) {
|
57
|
+
$attachmentsHelpText.show();
|
58
|
+
} else {
|
59
|
+
$attachmentsHelpText.hide();
|
60
|
+
}
|
61
|
+
});
|
45
62
|
});
|
@@ -25,7 +25,7 @@ const apiRequest = (query) => {
|
|
25
25
|
/**
|
26
26
|
* Resolves the different root fields for listing different participatory spaces
|
27
27
|
* available in the instance. Returns all LIST kind root fields that list
|
28
|
-
* records
|
28
|
+
* records implementing the ParticipatorySpaceInterface.
|
29
29
|
*
|
30
30
|
* @returns {Promise} A promise resolving the root fields for querying different
|
31
31
|
* participatory spaces.
|
@@ -1,10 +1,10 @@
|
|
1
1
|
$(() => {
|
2
|
-
const $
|
2
|
+
const $limitedTimeLabel = $("label[for='component_settings_proposal_edit_time_limited']")
|
3
3
|
const $limitedTimeRadioButton = $("#component_settings_proposal_edit_time_limited")
|
4
4
|
const $infiniteTimeRadioButton = $("#component_settings_proposal_edit_time_infinite")
|
5
5
|
const $editTimeContainer = $(".proposal_edit_before_minutes_container")
|
6
6
|
|
7
|
-
$editTimeContainer.detach().appendTo($
|
7
|
+
$editTimeContainer.detach().appendTo($limitedTimeLabel)
|
8
8
|
|
9
9
|
if ($infiniteTimeRadioButton.is(":checked")) {
|
10
10
|
$editTimeContainer.hide();
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// Check one radio button when another is checked
|
2
|
+
//
|
3
|
+
// @example
|
4
|
+
// ```erb
|
5
|
+
// <%= form.radio_button :text_color, "Blue",
|
6
|
+
// data: {
|
7
|
+
// "sync-radio-buttons" => true,
|
8
|
+
// "sync-radio-buttons-value" => "unique-key"
|
9
|
+
// } %>
|
10
|
+
//
|
11
|
+
// <%= form.radio_button :bg_color, "Blue,"
|
12
|
+
// data: {
|
13
|
+
// "sync-radio-buttons-value-target" => "unique-key"
|
14
|
+
// } %>
|
15
|
+
// ```
|
16
|
+
//
|
17
|
+
window.addEventListener("DOMContentLoaded", () => {
|
18
|
+
document.querySelectorAll("input[data-sync-radio-buttons=true]").forEach((element) => {
|
19
|
+
element.addEventListener("change", (event) => {
|
20
|
+
const value = event.target.dataset.syncRadioButtonsValue;
|
21
|
+
const radio = document.querySelector(`input[data-sync-radio-buttons-value-target=${value}]`);
|
22
|
+
|
23
|
+
radio.checked = true;
|
24
|
+
radio.dispatchEvent(new Event("change"));
|
25
|
+
})
|
26
|
+
})
|
27
|
+
})
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// Copy the value of a text input or textarea to another element.
|
2
|
+
//
|
3
|
+
// @example
|
4
|
+
// ```erb
|
5
|
+
// <%= form.translated :text_field, :example, data: { "text-copy" => true, "target" => "strong[data-copy-example]" } %>
|
6
|
+
//
|
7
|
+
// <div data-copy-example>
|
8
|
+
// <%= t(".preview") %>
|
9
|
+
// </div>
|
10
|
+
// ```
|
11
|
+
//
|
12
|
+
window.addEventListener("DOMContentLoaded", () => {
|
13
|
+
document.querySelectorAll("input[data-text-copy=true], textarea[data-text-copy=true]").forEach((element) => {
|
14
|
+
element.addEventListener("change", (event) => {
|
15
|
+
const target = document.querySelector(event.target.dataset.target);
|
16
|
+
target.innerText = event.target.value;
|
17
|
+
})
|
18
|
+
});
|
19
|
+
})
|
@@ -0,0 +1,62 @@
|
|
1
|
+
.wc-datepicker {
|
2
|
+
@apply z-[2];
|
3
|
+
|
4
|
+
&__current-month {
|
5
|
+
@apply mt-4;
|
6
|
+
}
|
7
|
+
|
8
|
+
&__next-month-button,
|
9
|
+
&__previous-month-button {
|
10
|
+
> svg {
|
11
|
+
@apply fill-none w-16 h-16;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
.datepicker {
|
17
|
+
&__clock-button {
|
18
|
+
@apply top-0;
|
19
|
+
}
|
20
|
+
|
21
|
+
&__calendar-button {
|
22
|
+
@apply top-0;
|
23
|
+
}
|
24
|
+
|
25
|
+
&__pick-calendar {
|
26
|
+
@apply z-[3];
|
27
|
+
}
|
28
|
+
|
29
|
+
&__close-calendar {
|
30
|
+
@apply z-[3];
|
31
|
+
}
|
32
|
+
|
33
|
+
&__time-frame {
|
34
|
+
@apply z-[1];
|
35
|
+
}
|
36
|
+
|
37
|
+
&__hour-picker,
|
38
|
+
&__minute-picker {
|
39
|
+
@apply left-2 ml-px;
|
40
|
+
}
|
41
|
+
|
42
|
+
&__hour-down,
|
43
|
+
&__hour-up,
|
44
|
+
&__minute-up,
|
45
|
+
&__minute-down {
|
46
|
+
@apply h-6 w-full;
|
47
|
+
|
48
|
+
> svg {
|
49
|
+
@apply w-10 h-6 pr-1;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
.item__edit {
|
55
|
+
&-form {
|
56
|
+
.form {
|
57
|
+
[type="number"].wc-datepicker__year-select {
|
58
|
+
@apply text-sm;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|