decidim-admin 0.28.1 → 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/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 +3 -3
- 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 -42
- 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 +78 -3
- 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/participatory_space_export.rb +1 -1
- data/app/controllers/decidim/admin/application_controller.rb +1 -0
- 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 +3 -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/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 +8 -5
- 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/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/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 +25 -16
- data/app/packs/src/decidim/admin/choose_language.js +2 -0
- data/app/packs/src/decidim/admin/css_preview.js +39 -0
- data/app/packs/src/decidim/admin/dynamic_fields.component.js +2 -1
- 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/categories/index.html.erb +2 -2
- data/app/views/decidim/admin/components/_form.html.erb +1 -1
- 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 +1 -1
- data/app/views/decidim/admin/impersonatable_users/index.html.erb +3 -3
- data/app/views/decidim/admin/imports/_dropdown.html.erb +1 -1
- data/app/views/decidim/admin/imports/new.html.erb +2 -2
- 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 +3 -3
- 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_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/_js-callout.html.erb +2 -2
- 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/_sidebar_menu.html.erb +2 -2
- 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 +1 -7
- data/config/locales/bg.yml +1013 -11
- data/config/locales/ca.yml +18 -11
- data/config/locales/cs.yml +17 -10
- data/config/locales/de.yml +25 -18
- data/config/locales/el.yml +1 -12
- data/config/locales/en.yml +18 -11
- data/config/locales/es-MX.yml +25 -18
- data/config/locales/es-PY.yml +25 -18
- data/config/locales/es.yml +34 -27
- data/config/locales/eu.yml +18 -11
- data/config/locales/fi-plain.yml +16 -9
- data/config/locales/fi.yml +16 -9
- data/config/locales/fr-CA.yml +16 -9
- data/config/locales/fr.yml +15 -8
- data/config/locales/ga-IE.yml +1 -3
- data/config/locales/gl.yml +1 -5
- data/config/locales/hu.yml +10 -10
- data/config/locales/id-ID.yml +1 -3
- data/config/locales/is-IS.yml +1 -3
- data/config/locales/it.yml +2 -8
- data/config/locales/ja.yml +18 -11
- data/config/locales/kaa.yml +0 -3
- data/config/locales/ko.yml +0 -6
- data/config/locales/lb.yml +1 -8
- data/config/locales/lt.yml +2 -13
- data/config/locales/lv.yml +1 -3
- data/config/locales/nl.yml +1 -8
- data/config/locales/no.yml +1 -8
- data/config/locales/pl.yml +17 -9
- data/config/locales/pt-BR.yml +9 -10
- data/config/locales/pt.yml +1 -8
- data/config/locales/ro-RO.yml +1 -12
- data/config/locales/ru.yml +1 -3
- data/config/locales/sk.yml +1 -3
- data/config/locales/sl.yml +1 -0
- data/config/locales/sq-AL.yml +410 -0
- data/config/locales/sr-CS.yml +1 -3
- data/config/locales/sv.yml +1 -8
- data/config/locales/th-TH.yml +98 -0
- data/config/locales/tr-TR.yml +1 -5
- data/config/locales/uk.yml +1 -3
- data/config/locales/zh-CN.yml +1 -3
- data/config/locales/zh-TW.yml +2 -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/admin_participatory_space_access_examples.rb +27 -0
- 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 +180 -0
- data/lib/decidim/admin/test/invite_participatory_space_collaborators_shared_examples.rb +67 -0
- data/lib/decidim/admin/test/invite_participatory_space_moderators_shared_examples.rb +77 -0
- data/lib/decidim/admin/test/invite_participatory_space_users_shared_context.rb +33 -0
- data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +24 -23
- data/lib/decidim/admin/test/manage_attachments_examples.rb +51 -15
- data/lib/decidim/admin/test/manage_categories_examples.rb +24 -21
- data/lib/decidim/admin/test/manage_component_permissions_examples.rb +5 -5
- data/lib/decidim/admin/test/manage_hide_content_examples.rb +8 -4
- data/lib/decidim/admin/test/manage_moderations_examples.rb +21 -21
- data/lib/decidim/admin/test/manage_paginated_collection_examples.rb +3 -3
- data/lib/decidim/admin/test/manage_participatory_space_publications_examples.rb +2 -2
- data/lib/decidim/admin/test.rb +1 -0
- data/lib/decidim/admin/version.rb +1 -1
- metadata +32 -27
- 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/mailers/decidim/admin/application_mailer.rb +0 -12
- 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
@@ -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
|
@@ -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"))
|
@@ -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,19 +1,24 @@
|
|
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
|
+
// REDESIGN_PENDING: deprecated
|
16
|
+
window.initFoundation = (element) => {
|
17
|
+
$(element).foundation();
|
18
|
+
};
|
19
|
+
|
15
20
|
$(() => {
|
16
|
-
|
21
|
+
window.initFoundation(document);
|
17
22
|
|
18
23
|
$(document).on("show.zf.dropdownMenu", function(event, $element) {
|
19
24
|
$element.attr("aria-hidden", "false");
|
@@ -26,23 +31,27 @@ $(() => {
|
|
26
31
|
toggleNav();
|
27
32
|
|
28
33
|
createSortList("#steps tbody", {
|
29
|
-
placeholder: $(
|
34
|
+
placeholder: $(
|
35
|
+
'<tr style="border-style: dashed; border-color: #000"><td colspan="4"> </td></tr>'
|
36
|
+
)[0],
|
30
37
|
onSortUpdate: ($children) => {
|
31
|
-
const sortUrl = $("#steps tbody").data("sort-url")
|
32
|
-
const order = $children.
|
38
|
+
const sortUrl = $("#steps tbody").data("sort-url");
|
39
|
+
const order = $children.
|
40
|
+
map((index, child) => $(child).data("id")).
|
41
|
+
toArray();
|
33
42
|
|
34
43
|
$.ajax({
|
35
44
|
method: "POST",
|
36
45
|
url: sortUrl,
|
37
46
|
contentType: "application/json",
|
38
|
-
data: JSON.stringify({ items_ids: order })
|
39
|
-
);
|
47
|
+
data: JSON.stringify({ items_ids: order }) // eslint-disable-line camelcase
|
48
|
+
});
|
40
49
|
}
|
41
|
-
})
|
50
|
+
});
|
42
51
|
|
43
52
|
$("form.new_filter").each(function () {
|
44
53
|
const formFilter = new FormFilterComponent($(this));
|
45
54
|
|
46
55
|
formFilter.mountComponent();
|
47
|
-
})
|
56
|
+
});
|
48
57
|
});
|
@@ -7,7 +7,9 @@ export default function initLanguageChangeSelect(elements) {
|
|
7
7
|
let targetTabPaneSelector = select.value;
|
8
8
|
let tabsContent = select.parentElement.parentElement.nextElementSibling;
|
9
9
|
|
10
|
+
tabsContent.querySelector(".is-active").ariaHidden = "true";
|
10
11
|
tabsContent.querySelector(".is-active").classList.remove("is-active");
|
12
|
+
tabsContent.querySelector(targetTabPaneSelector).ariaHidden = "false";
|
11
13
|
tabsContent.querySelector(targetTabPaneSelector).classList.add("is-active");
|
12
14
|
})
|
13
15
|
});
|
@@ -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
|
+
}
|
@@ -35,4 +35,6 @@
|
|
35
35
|
@import "stylesheets/decidim/admin/_data_picker.scss";
|
36
36
|
@import "stylesheets/decidim/admin/_legacy_foundation.scss";
|
37
37
|
@import "stylesheets/decidim/admin/_sidebar-menu.scss";
|
38
|
+
@import "stylesheets/decidim/admin/_datepicker.scss";
|
38
39
|
@import "stylesheets/decidim/admin/_minimap.scss";
|
40
|
+
@import "stylesheets/decidim/admin/_proposal_status.scss";
|
@@ -218,11 +218,11 @@ module Decidim
|
|
218
218
|
@organization ||= context.fetch(:organization, nil) || context.fetch(:current_organization, nil)
|
219
219
|
end
|
220
220
|
|
221
|
-
def user_can_enter_space_area?(**
|
221
|
+
def user_can_enter_space_area?(**)
|
222
222
|
return unless permission_action.action == :enter &&
|
223
223
|
permission_action.subject == :space_area
|
224
224
|
|
225
|
-
space_allows_admin_access_to_current_action?(**
|
225
|
+
space_allows_admin_access_to_current_action?(**)
|
226
226
|
end
|
227
227
|
|
228
228
|
def space_allows_admin_access_to_current_action?(require_admin_terms_accepted: false)
|
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Admin
|
5
|
-
# A class used to filter users by
|
5
|
+
# A class used to filter users by allowed scope or searches on their
|
6
6
|
# name
|
7
7
|
class UserFilter < Decidim::Query
|
8
|
-
|
8
|
+
ALLOWED_STATE_SCOPES = %w(
|
9
9
|
officialized
|
10
10
|
not_officialized
|
11
11
|
managed
|
@@ -32,7 +32,7 @@ module Decidim
|
|
32
32
|
@state = state
|
33
33
|
end
|
34
34
|
|
35
|
-
# List the User groups by the
|
35
|
+
# List the User groups by the different filters.
|
36
36
|
def query
|
37
37
|
users = scope
|
38
38
|
users = filter_by_search(users)
|
@@ -50,7 +50,7 @@ module Decidim
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def filter_by_state(users)
|
53
|
-
return users unless
|
53
|
+
return users unless ALLOWED_STATE_SCOPES.include?(state)
|
54
54
|
|
55
55
|
users.public_send(state)
|
56
56
|
end
|