decidim-admin 0.26.5 → 0.27.0.rc1
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/cells/decidim/admin/attachments_privacy_warning/show.erb +3 -0
- data/app/cells/decidim/admin/attachments_privacy_warning_cell.rb +19 -0
- data/app/commands/decidim/admin/block_user.rb +1 -1
- data/app/commands/decidim/admin/close_session_managed_user.rb +1 -1
- data/app/commands/decidim/admin/create_area.rb +1 -1
- data/app/commands/decidim/admin/create_area_type.rb +6 -3
- data/app/commands/decidim/admin/create_attachment.rb +14 -6
- data/app/commands/decidim/admin/create_attachment_collection.rb +13 -4
- data/app/commands/decidim/admin/create_category.rb +6 -4
- data/app/commands/decidim/admin/create_component.rb +1 -1
- data/app/commands/decidim/admin/create_import.rb +4 -5
- data/app/commands/decidim/admin/create_import_example.rb +1 -1
- data/app/commands/decidim/admin/create_newsletter.rb +1 -1
- data/app/commands/decidim/admin/create_participatory_space_private_user.rb +1 -1
- data/app/commands/decidim/admin/create_scope.rb +1 -1
- data/app/commands/decidim/admin/create_scope_type.rb +6 -3
- data/app/commands/decidim/admin/create_static_page.rb +1 -1
- data/app/commands/decidim/admin/create_static_page_topic.rb +1 -1
- data/app/commands/decidim/admin/deliver_newsletter.rb +6 -6
- data/app/commands/decidim/admin/destroy_area.rb +1 -1
- data/app/commands/decidim/admin/destroy_category.rb +6 -3
- data/app/commands/decidim/admin/destroy_component.rb +1 -1
- data/app/commands/decidim/admin/destroy_newsletter.rb +1 -1
- data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +1 -1
- data/app/commands/decidim/admin/destroy_scope.rb +1 -1
- data/app/commands/decidim/admin/destroy_share_token.rb +1 -1
- data/app/commands/decidim/admin/destroy_static_page.rb +1 -1
- data/app/commands/decidim/admin/destroy_static_page_topic.rb +1 -1
- data/app/commands/decidim/admin/hide_resource.rb +2 -2
- data/app/commands/decidim/admin/impersonate_user.rb +1 -1
- data/app/commands/decidim/admin/invite_admin.rb +1 -1
- data/app/commands/decidim/admin/officialize_user.rb +1 -1
- data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +7 -3
- data/app/commands/decidim/admin/process_user_group_verification_csv.rb +8 -4
- data/app/commands/decidim/admin/promote_managed_user.rb +1 -1
- data/app/commands/decidim/admin/publish_component.rb +1 -1
- data/app/commands/decidim/admin/reject_user_group.rb +1 -1
- data/app/commands/decidim/admin/remove_admin.rb +1 -1
- data/app/commands/decidim/admin/reorder_content_blocks.rb +1 -1
- data/app/commands/decidim/admin/transfer_user.rb +1 -1
- data/app/commands/decidim/admin/unblock_user.rb +2 -2
- data/app/commands/decidim/admin/unhide_resource.rb +1 -1
- data/app/commands/decidim/admin/unofficialize_user.rb +1 -1
- data/app/commands/decidim/admin/unpublish_component.rb +1 -1
- data/app/commands/decidim/admin/unreport_resource.rb +1 -1
- data/app/commands/decidim/admin/unreport_user.rb +1 -1
- data/app/commands/decidim/admin/update_area.rb +1 -1
- data/app/commands/decidim/admin/update_area_type.rb +8 -3
- data/app/commands/decidim/admin/update_attachment.rb +4 -3
- data/app/commands/decidim/admin/update_attachment_collection.rb +8 -3
- data/app/commands/decidim/admin/update_category.rb +9 -5
- data/app/commands/decidim/admin/update_component.rb +8 -5
- data/app/commands/decidim/admin/update_component_permissions.rb +9 -6
- data/app/commands/decidim/admin/update_content_block.rb +1 -1
- data/app/commands/decidim/admin/update_external_domain_whitelist.rb +6 -3
- data/app/commands/decidim/admin/update_help_sections.rb +17 -3
- data/app/commands/decidim/admin/update_newsletter.rb +1 -1
- data/app/commands/decidim/admin/update_organization.rb +1 -1
- data/app/commands/decidim/admin/update_organization_appearance.rb +1 -1
- data/app/commands/decidim/admin/update_organization_tos_version.rb +1 -1
- data/app/commands/decidim/admin/update_resource_permissions.rb +2 -2
- data/app/commands/decidim/admin/update_scope.rb +1 -1
- data/app/commands/decidim/admin/update_scope_type.rb +8 -3
- data/app/commands/decidim/admin/update_static_page.rb +1 -1
- data/app/commands/decidim/admin/update_static_page_topic.rb +1 -1
- data/app/commands/decidim/admin/update_user_groups.rb +1 -1
- data/app/commands/decidim/admin/verify_user_group.rb +1 -1
- data/app/controllers/concerns/decidim/admin/filterable.rb +1 -1
- data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +3 -1
- data/app/controllers/decidim/admin/application_controller.rb +1 -0
- data/app/controllers/decidim/admin/area_types_controller.rb +6 -3
- data/app/controllers/decidim/admin/block_user_controller.rb +3 -3
- data/app/controllers/decidim/admin/categories_controller.rb +3 -3
- data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
- data/app/controllers/decidim/admin/components/base_controller.rb +1 -0
- data/app/controllers/decidim/admin/components_controller.rb +1 -1
- data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +6 -3
- data/app/controllers/decidim/admin/concerns/has_attachments.rb +6 -3
- data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +7 -0
- data/app/controllers/decidim/admin/dashboard_controller.rb +4 -3
- data/app/controllers/decidim/admin/exports_controller.rb +4 -1
- data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
- data/app/controllers/decidim/admin/metrics_controller.rb +2 -1
- data/app/controllers/decidim/admin/moderations_controller.rb +9 -7
- data/app/controllers/decidim/admin/newsletter_templates_controller.rb +1 -1
- data/app/controllers/decidim/admin/newsletters_controller.rb +1 -1
- data/app/controllers/decidim/admin/organization_controller.rb +3 -4
- data/app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb +1 -1
- data/app/controllers/decidim/admin/reminders_controller.rb +61 -0
- data/app/controllers/decidim/admin/resource_permissions_controller.rb +3 -3
- data/app/controllers/decidim/admin/scope_types_controller.rb +6 -3
- data/app/controllers/decidim/admin/static_pages_controller.rb +1 -7
- data/app/forms/decidim/admin/block_user_form.rb +2 -2
- data/app/forms/decidim/admin/category_form.rb +1 -2
- data/app/forms/decidim/admin/component_form.rb +16 -7
- data/app/forms/decidim/admin/import_example_form.rb +1 -5
- data/app/forms/decidim/admin/import_form.rb +7 -10
- data/app/forms/decidim/admin/managed_user_promotion_form.rb +1 -1
- data/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb +7 -4
- data/app/forms/decidim/admin/permission_form.rb +9 -8
- data/app/forms/decidim/admin/permissions_form.rb +1 -10
- data/app/forms/decidim/admin/user_group_csv_verification_form.rb +2 -2
- data/app/helpers/decidim/admin/bulk_actions_helper.rb +6 -5
- data/app/helpers/decidim/admin/moderations/reports_helper.rb +11 -2
- data/app/helpers/decidim/admin/reminders_helper.rb +12 -0
- data/app/helpers/decidim/admin/settings_helper.rb +11 -57
- data/app/models/decidim/admin/fake_newsletter.rb +0 -20
- data/app/packs/entrypoints/decidim_admin.js +3 -6
- data/app/packs/src/decidim/admin/admin_autocomplete.js +82 -0
- data/app/packs/src/decidim/admin/application.js +0 -16
- data/app/packs/src/decidim/admin/choose_language.js +9 -11
- data/app/packs/src/decidim/admin/dynamic_fields.component.js +0 -1
- data/app/packs/stylesheets/decidim/admin/_decidim.scss +0 -1
- data/app/packs/stylesheets/decidim/admin/modules/_autocomplete.scss +5 -0
- data/app/packs/stylesheets/decidim/admin/modules/_forms.scss +0 -6
- data/app/packs/stylesheets/decidim/admin/modules/_import_result.scss +10 -0
- data/app/packs/stylesheets/decidim/admin/modules/_modules.scss +3 -0
- data/app/packs/stylesheets/decidim/admin/modules/_upload_modal.scss +42 -0
- data/app/permissions/decidim/admin/permissions.rb +3 -32
- data/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb +3 -1
- data/app/queries/decidim/admin/active_users_counter.rb +1 -1
- data/app/queries/decidim/admin/newsletter_recipients.rb +2 -2
- data/app/queries/decidim/admin/user_filter.rb +1 -1
- data/app/queries/decidim/admin/user_groups_evaluation.rb +1 -1
- data/app/views/decidim/admin/attachments/index.html.erb +1 -0
- data/app/views/decidim/admin/categories/_form.html.erb +0 -4
- data/app/views/decidim/admin/categories/show.html.erb +1 -2
- data/app/views/decidim/admin/dashboard/show.html.erb +1 -1
- data/app/views/decidim/admin/imports/new.html.erb +1 -1
- data/app/views/decidim/admin/moderated_users/index.html.erb +1 -1
- data/app/views/decidim/admin/moderations/index.html.erb +4 -8
- data/app/views/decidim/admin/moderations/reports/index.html.erb +1 -5
- data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -4
- 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 +20 -1
- data/app/views/decidim/admin/reminders/new.html.erb +21 -0
- data/app/views/decidim/admin/resource_permissions/edit.html.erb +1 -1
- data/app/views/decidim/admin/shared/_gallery.html.erb +6 -1
- data/app/views/decidim/admin/shared/_js-callout.html.erb +6 -0
- data/app/views/decidim/admin/users_statistics/_users_count.html.erb +2 -2
- data/app/views/layouts/decidim/admin/_application.html.erb +2 -0
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +28 -21
- data/config/locales/bg.yml +1 -0
- data/config/locales/ca.yml +27 -21
- data/config/locales/cs.yml +41 -33
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +23 -18
- data/config/locales/el.yml +2 -5
- data/config/locales/en.yml +22 -17
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +25 -19
- data/config/locales/es-PY.yml +25 -19
- data/config/locales/es.yml +27 -21
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +12 -35
- data/config/locales/fi-plain.yml +26 -20
- data/config/locales/fi.yml +28 -22
- data/config/locales/fr-CA.yml +25 -19
- data/config/locales/fr.yml +39 -33
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +17 -4
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +16 -188
- data/config/locales/id-ID.yml +2 -7
- data/config/locales/is-IS.yml +3 -8
- data/config/locales/it.yml +8 -6
- data/config/locales/ja.yml +23 -18
- data/config/locales/ko.yml +1 -0
- data/config/locales/lb.yml +2 -5
- data/config/locales/lt.yml +13 -141
- data/config/locales/lv.yml +2 -4
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +4 -67
- data/config/locales/no.yml +13 -10
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +21 -6
- data/config/locales/pt-BR.yml +4 -7
- data/config/locales/pt.yml +2 -5
- data/config/locales/ro-RO.yml +12 -27
- data/config/locales/ru.yml +2 -7
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +2 -4
- data/config/locales/sl.yml +1 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +1 -10
- data/config/locales/sv.yml +24 -18
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +2 -5
- data/config/locales/uk.yml +2 -6
- data/config/locales/val-ES.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +2 -4
- data/config/locales/zh-TW.yml +1 -0
- data/lib/decidim/admin/engine.rb +1 -12
- data/lib/decidim/admin/import/importer.rb +9 -7
- data/lib/decidim/admin/import/readers/json.rb +1 -1
- data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +15 -2
- data/lib/decidim/admin/test/commands/create_category_examples.rb +16 -6
- data/lib/decidim/admin/test/commands/destroy_category_examples.rb +29 -1
- data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +15 -2
- data/lib/decidim/admin/test/commands/update_category_examples.rb +16 -6
- data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +4 -4
- data/lib/decidim/admin/test/filters_participatory_space_users_examples.rb +4 -4
- data/lib/decidim/admin/test/forms/category_form_examples.rb +1 -21
- data/lib/decidim/admin/test/manage_attachments_examples.rb +9 -2
- data/lib/decidim/admin/test/manage_categories_examples.rb +0 -10
- data/lib/decidim/admin/test/manage_component_permissions_examples.rb +0 -2
- data/lib/decidim/admin/test/manage_moderations_examples.rb +27 -79
- data/lib/decidim/admin/version.rb +1 -1
- metadata +22 -19
- data/app/packs/src/decidim/admin/autocomplete.component.js +0 -146
- data/app/packs/src/decidim/admin/autocomplete.component.test.js +0 -19
- data/app/packs/stylesheets/decidim/admin/components/_autocomplete_select.component.scss +0 -19
- data/config/locales/gn-PY.yml +0 -1
- data/config/locales/ka-GE.yml +0 -1
- data/config/locales/lo-LA.yml +0 -1
- data/config/locales/oc-FR.yml +0 -1
|
@@ -6,22 +6,31 @@ module Decidim
|
|
|
6
6
|
# This module includes helpers to show moderation reports in admin
|
|
7
7
|
module ReportsHelper
|
|
8
8
|
include Decidim::Messaging::ConversationHelper
|
|
9
|
+
include Decidim::ResourceHelper
|
|
10
|
+
include Decidim::TranslationsHelper
|
|
9
11
|
|
|
10
12
|
# Public: Returns the reportable's author names separated by commas.
|
|
11
13
|
def reportable_author_name(reportable)
|
|
12
14
|
reportable_authors = reportable.try(:authors) || [reportable.try(:normalized_author)]
|
|
13
15
|
content_tag :ul, class: "reportable-authors" do
|
|
14
16
|
reportable_authors.select(&:present?).map do |author|
|
|
15
|
-
|
|
17
|
+
case author
|
|
18
|
+
when User
|
|
16
19
|
content_tag :li do
|
|
17
20
|
link_to current_or_new_conversation_path_with(author), target: "_blank", rel: "noopener" do
|
|
18
21
|
"#{author.name} #{icon "envelope-closed"}".html_safe
|
|
19
22
|
end
|
|
20
23
|
end
|
|
24
|
+
when Decidim::Meetings::Meeting
|
|
25
|
+
content_tag :li do
|
|
26
|
+
link_to resource_locator(author).path, target: "_blank", rel: "noopener" do
|
|
27
|
+
translated_attribute(author.title)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
21
30
|
else
|
|
22
31
|
content_tag(:li, author.name)
|
|
23
32
|
end
|
|
24
|
-
end.join
|
|
33
|
+
end.join.html_safe
|
|
25
34
|
end
|
|
26
35
|
end
|
|
27
36
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module Admin
|
|
5
|
+
module RemindersHelper
|
|
6
|
+
# Route to the correct reminder for a component.
|
|
7
|
+
def admin_reminders_path(component, options = {})
|
|
8
|
+
EngineRouter.admin_proxy(component.participatory_space).new_component_reminder_path(options.merge(component_id: component))
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -18,19 +18,16 @@ module Decidim
|
|
|
18
18
|
time: :datetime_field
|
|
19
19
|
}.freeze
|
|
20
20
|
|
|
21
|
-
# Renders a form field that matches a settings attribute's
|
|
22
|
-
#
|
|
21
|
+
# Public: Renders a form field that matches a settings attribute's
|
|
22
|
+
# type.
|
|
23
23
|
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
# It can be "global-settings" or "step-N-settings", where N is the number of the step.
|
|
32
|
-
# @option options [nil, Boolean] :readonly True if the input is readonly.
|
|
33
|
-
# @return [ActiveSupport::SafeBuffer] Rendered form field.
|
|
24
|
+
# form - The form in which to render the field.
|
|
25
|
+
# attribute - The Settings::Attribute instance with the
|
|
26
|
+
# description of the attribute.
|
|
27
|
+
# name - The name of the field.
|
|
28
|
+
# options - Extra options to be passed to the field helper.
|
|
29
|
+
#
|
|
30
|
+
# Returns a rendered form field.
|
|
34
31
|
def settings_attribute_input(form, attribute, name, i18n_scope, options = {})
|
|
35
32
|
form_method = form_method_for_attribute(attribute)
|
|
36
33
|
|
|
@@ -65,18 +62,6 @@ module Decidim
|
|
|
65
62
|
|
|
66
63
|
private
|
|
67
64
|
|
|
68
|
-
# Renders a select field collection input for the given attribute
|
|
69
|
-
#
|
|
70
|
-
# @param form (see #settings_attribute_input)
|
|
71
|
-
# @param attribute (see #settings_attribute_input)
|
|
72
|
-
# @param name (see #settings_attribute_input)
|
|
73
|
-
# @param i18n_scope (see #settings_attribute_input)
|
|
74
|
-
# @param options (see #settings_attribute_input)
|
|
75
|
-
# @option :tabs_prefix (see #settings_attribute_input)
|
|
76
|
-
# @option :readonly (see #settings_attribute_input)
|
|
77
|
-
# @option options [String] :label The label that this field has
|
|
78
|
-
# @option options [String] :help_text The help text shown after the input field
|
|
79
|
-
# @return (see #settings_attribute_input)
|
|
80
65
|
def render_select_form_field(form, attribute, name, i18n_scope, options)
|
|
81
66
|
html = form.select(
|
|
82
67
|
name,
|
|
@@ -88,17 +73,6 @@ module Decidim
|
|
|
88
73
|
end
|
|
89
74
|
|
|
90
75
|
# Returns a radio buttons collection input for the given attribute
|
|
91
|
-
#
|
|
92
|
-
# @param form (see #settings_attribute_input)
|
|
93
|
-
# @param attribute (see #settings_attribute_input)
|
|
94
|
-
# @param name (see #settings_attribute_input)
|
|
95
|
-
# @param i18n_scope (see #settings_attribute_input)
|
|
96
|
-
# @param options (see #settings_attribute_input)
|
|
97
|
-
# @option :tabs_prefix (see #settings_attribute_input)
|
|
98
|
-
# @option :readonly (see #settings_attribute_input)
|
|
99
|
-
# @option :label (see #render_select_form_field)
|
|
100
|
-
# @option :help_text (see #render_select_form_field)
|
|
101
|
-
# @return (see #settings_attribute_input)
|
|
102
76
|
def render_enum_form_field(form, attribute, name, i18n_scope, options)
|
|
103
77
|
html = label_tag(name) do
|
|
104
78
|
concat options[:label]
|
|
@@ -114,25 +88,13 @@ module Decidim
|
|
|
114
88
|
html
|
|
115
89
|
end
|
|
116
90
|
|
|
117
|
-
# Get the translation for a given attribute
|
|
118
91
|
# Returns a translation or nil. If nil, ZURB Foundation won't add the help_text.
|
|
119
|
-
#
|
|
120
|
-
# @param name (see #settings_attribute_input)
|
|
121
|
-
# @param suffix [String] What suffix the i18n key has
|
|
122
|
-
# @param i18n_scope (see #settings_attribute_input)
|
|
123
|
-
# @return [String, nil]
|
|
124
92
|
def text_for_setting(name, suffix, i18n_scope)
|
|
125
|
-
html_key = "#{i18n_scope}.#{name}_#{suffix}_html"
|
|
126
|
-
return t(html_key) if I18n.exists?(html_key)
|
|
127
|
-
|
|
128
93
|
key = "#{i18n_scope}.#{name}_#{suffix}"
|
|
129
94
|
return t(key) if I18n.exists?(key)
|
|
130
95
|
end
|
|
131
96
|
|
|
132
|
-
#
|
|
133
|
-
#
|
|
134
|
-
# @param attribute [Decidim::SettingsManifest::Attribute]
|
|
135
|
-
# @return [Symbol] The FormBuilder's method used to render
|
|
97
|
+
# Returns the FormBuilder's method used to render
|
|
136
98
|
def form_method_for_attribute(attribute)
|
|
137
99
|
return :editor if attribute.type.to_sym == :text && attribute.editor?
|
|
138
100
|
|
|
@@ -140,9 +102,7 @@ module Decidim
|
|
|
140
102
|
end
|
|
141
103
|
|
|
142
104
|
# Handles special cases.
|
|
143
|
-
#
|
|
144
|
-
# @param input_type [Symbol]
|
|
145
|
-
# @return [Hash] Empty Hash or a Hash with extra HTML options.
|
|
105
|
+
# Returns an empty Hash or a Hash with extra HTML options.
|
|
146
106
|
def extra_options_for_type(input_type)
|
|
147
107
|
case input_type
|
|
148
108
|
when :text_area
|
|
@@ -153,12 +113,6 @@ module Decidim
|
|
|
153
113
|
end
|
|
154
114
|
|
|
155
115
|
# Build options for enum attributes
|
|
156
|
-
# Get the translation for a given attribute of type choice
|
|
157
|
-
#
|
|
158
|
-
# @param name (see #settings_attribute_input)
|
|
159
|
-
# @param i18n_scope (see #settings_attribute_input)
|
|
160
|
-
# @param choices [Array<Symbol>]
|
|
161
|
-
# @return [Array<Array<String>>]
|
|
162
116
|
def build_enum_choices(name, i18n_scope, choices)
|
|
163
117
|
choices.map do |choice|
|
|
164
118
|
[t("#{name}_choices.#{choice}", scope: i18n_scope), choice]
|
|
@@ -41,26 +41,6 @@ module Decidim
|
|
|
41
41
|
nil
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
def draft?
|
|
45
|
-
true
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def url(**_)
|
|
49
|
-
"#"
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def notifications_settings_url(**_)
|
|
53
|
-
"#"
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def unsubscribe_newsletters_url(**_)
|
|
57
|
-
"#"
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def organization_official_url
|
|
61
|
-
"#"
|
|
62
|
-
end
|
|
63
|
-
|
|
64
44
|
private
|
|
65
45
|
|
|
66
46
|
attr_reader :organization, :manifest
|
|
@@ -10,11 +10,10 @@ import Rails from "@rails/ujs"
|
|
|
10
10
|
import "foundation-sites"
|
|
11
11
|
import "src/decidim/vendor/foundation-datepicker"
|
|
12
12
|
import "src/decidim/foundation_datepicker_locales"
|
|
13
|
-
import "jquery.autocomplete"
|
|
14
13
|
import "jquery-serializejson"
|
|
15
14
|
|
|
16
15
|
import "src/decidim/admin/tab_focus"
|
|
17
|
-
import
|
|
16
|
+
import "src/decidim/admin/choose_language"
|
|
18
17
|
import "src/decidim/admin/application"
|
|
19
18
|
import "src/decidim/admin/resources_permissions"
|
|
20
19
|
import "src/decidim/admin/welcome_notification"
|
|
@@ -34,13 +33,11 @@ import "src/decidim/ajax_modals"
|
|
|
34
33
|
import "src/decidim/admin/officializations"
|
|
35
34
|
import "src/decidim/session_timeouter"
|
|
36
35
|
import "src/decidim/slug_form"
|
|
36
|
+
import "src/decidim/direct_uploads/upload_field"
|
|
37
|
+
import "src/decidim/admin/admin_autocomplete"
|
|
37
38
|
|
|
38
39
|
// CSS
|
|
39
40
|
import "entrypoints/decidim_admin.scss";
|
|
40
41
|
|
|
41
42
|
// This needs to be loaded after confirm dialog to bind properly
|
|
42
43
|
Rails.start()
|
|
43
|
-
|
|
44
|
-
window.addEventListener("DOMContentLoaded", () => {
|
|
45
|
-
initLanguageChangeSelect(document.querySelectorAll("select.language-change"));
|
|
46
|
-
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import AutoComplete from "src/decidim/autocomplete";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This function can be used to create an autocomplete input automatically
|
|
5
|
+
* from the following kind of div:
|
|
6
|
+
* <div data-autocomplete="{...}"></div>
|
|
7
|
+
*
|
|
8
|
+
* The data-autocomplete attribute should contain the following configuration
|
|
9
|
+
* as an encoded JSON, which is used to generate the AutoComplete options:
|
|
10
|
+
* - name: assembly_member[user_id],
|
|
11
|
+
* - options: [],
|
|
12
|
+
* - placeholder: "Select a participant",
|
|
13
|
+
* - searchURL: "http://..."
|
|
14
|
+
* - selected: "",
|
|
15
|
+
*
|
|
16
|
+
* @param {HTMLElement} el The element to generate the autocomplete for.
|
|
17
|
+
* @returns {AutoComplete} An instance of the AutoComplete class.
|
|
18
|
+
*/
|
|
19
|
+
const autoConfigure = (el) => {
|
|
20
|
+
const config = JSON.parse(el.dataset.autocomplete);
|
|
21
|
+
const textInput = document.createElement("input");
|
|
22
|
+
textInput.type = "text";
|
|
23
|
+
textInput.className = "autocomplete-input";
|
|
24
|
+
el.appendChild(textInput);
|
|
25
|
+
let mode = config.mode || "sticky"
|
|
26
|
+
let selected = null;
|
|
27
|
+
if (config.selected) {
|
|
28
|
+
switch (mode) {
|
|
29
|
+
case "multi":
|
|
30
|
+
selected = config.selected.map((item) => (
|
|
31
|
+
{
|
|
32
|
+
key: "label",
|
|
33
|
+
value: {
|
|
34
|
+
value: item.value,
|
|
35
|
+
label: item.label
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
));
|
|
39
|
+
break;
|
|
40
|
+
case "sticky":
|
|
41
|
+
selected = { key: "label", value: config.options[config.options.length - 1] };
|
|
42
|
+
break;
|
|
43
|
+
default:
|
|
44
|
+
selected = config.selected;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const dataSource = (query, callback) => {
|
|
49
|
+
const params = new URLSearchParams({ term: query });
|
|
50
|
+
fetch(`${config.searchURL}?${params.toString()}`, {
|
|
51
|
+
method: "GET",
|
|
52
|
+
headers: { "Content-Type": "application/json" }
|
|
53
|
+
}).then((response) => response.json()).then((data) => {
|
|
54
|
+
callback(data)
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const ac = new AutoComplete(textInput, {
|
|
59
|
+
name: config.name,
|
|
60
|
+
placeholder: config.placeholder,
|
|
61
|
+
selected: selected,
|
|
62
|
+
mode: mode,
|
|
63
|
+
searchPrompt: true,
|
|
64
|
+
searchPromptText: config.searchPromptText,
|
|
65
|
+
threshold: 3,
|
|
66
|
+
dataMatchKeys: ["label"],
|
|
67
|
+
dataSource
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return ac;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
$(() => {
|
|
74
|
+
const $autocompleteDiv = $("[data-autocomplete]");
|
|
75
|
+
if ($autocompleteDiv.length < 1) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
$autocompleteDiv.each((_index, element) => {
|
|
80
|
+
autoConfigure(element);
|
|
81
|
+
})
|
|
82
|
+
})
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/* eslint-disable no-invalid-this */
|
|
2
2
|
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import * as ReactDOM from "react-dom";
|
|
5
3
|
import toggleNav from "src/decidim/admin/toggle_nav"
|
|
6
4
|
import createSortList from "src/decidim/admin/sort_list.component"
|
|
7
5
|
import createQuillEditor from "src/decidim/editor"
|
|
8
6
|
import formDatePicker from "src/decidim/form_datepicker"
|
|
9
7
|
import DataPicker from "src/decidim/data_picker"
|
|
10
|
-
import Autocomplete from "src/decidim/admin/autocomplete.component";
|
|
11
8
|
import FormFilterComponent from "src/decidim/form_filter"
|
|
12
9
|
import Configuration from "src/decidim/configuration"
|
|
13
10
|
import InputCharacterCounter from "src/decidim/input_character_counter"
|
|
@@ -18,17 +15,6 @@ window.Decidim.managedUsersForm = managedUsersForm
|
|
|
18
15
|
window.Decidim.config = new Configuration()
|
|
19
16
|
window.Decidim.InputCharacterCounter = InputCharacterCounter;
|
|
20
17
|
|
|
21
|
-
const renderAutocompleteSelects = (nodeSelector) => {
|
|
22
|
-
window.$(nodeSelector).each((index, node) => {
|
|
23
|
-
const props = { ...window.$(node).data("autocomplete") };
|
|
24
|
-
|
|
25
|
-
ReactDOM.render(
|
|
26
|
-
React.createElement(Autocomplete, props),
|
|
27
|
-
node
|
|
28
|
-
);
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
18
|
$(() => {
|
|
33
19
|
window.theDataPicker = new DataPicker($(".data-picker"));
|
|
34
20
|
|
|
@@ -36,8 +22,6 @@ $(() => {
|
|
|
36
22
|
|
|
37
23
|
toggleNav();
|
|
38
24
|
|
|
39
|
-
renderAutocompleteSelects('[data-plugin="autocomplete"]');
|
|
40
|
-
|
|
41
25
|
createSortList("#steps tbody", {
|
|
42
26
|
placeholder: $('<tr style="border-style: dashed; border-color: #000"><td colspan="4"> </td></tr>')[0],
|
|
43
27
|
onSortUpdate: ($children) => {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/* eslint-disable no-invalid-this */
|
|
2
|
-
/* eslint-disable require-jsdoc */
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
select
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
$(() => {
|
|
4
|
+
$("select.language-change").change(function () {
|
|
5
|
+
let $select = $(this);
|
|
6
|
+
let targetTabPaneSelector = $select.val();
|
|
7
|
+
let $tabsContent = $select.parent().parent().siblings();
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
9
|
+
$tabsContent.children(".is-active").removeClass("is-active");
|
|
10
|
+
$tabsContent.children(targetTabPaneSelector).addClass("is-active");
|
|
11
|
+
})
|
|
12
|
+
});
|
|
@@ -70,7 +70,6 @@ class DynamicFieldsComponent {
|
|
|
70
70
|
$(this).replaceAttribute("for", placeholder, value);
|
|
71
71
|
$(this).replaceAttribute("tabs_id", placeholder, value);
|
|
72
72
|
$(this).replaceAttribute("href", placeholder, value);
|
|
73
|
-
$(this).replaceAttribute("value", placeholder, value);
|
|
74
73
|
|
|
75
74
|
return this;
|
|
76
75
|
}
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
@import "stylesheets/decidim/admin/modules/modules";
|
|
18
18
|
@import "stylesheets/decidim/admin/plugins/jquery.auto-complete";
|
|
19
19
|
@import "stylesheets/decidim/admin/components/accordion";
|
|
20
|
-
@import "stylesheets/decidim/admin/components/autocomplete_select.component";
|
|
21
20
|
@import "stylesheets/decidim/admin/components/dropdown-menu";
|
|
22
21
|
@import "stylesheets/decidim/admin/components/sortable";
|
|
23
22
|
@import "stylesheets/decidim/vizzs";
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
@import "stylesheets/decidim/admin/modules/buttons";
|
|
5
5
|
@import "stylesheets/decidim/admin/modules/forms";
|
|
6
6
|
@import "stylesheets/decidim/admin/modules/tabs";
|
|
7
|
+
@import "stylesheets/decidim/admin/modules/autocomplete";
|
|
7
8
|
|
|
8
9
|
//General layout
|
|
9
10
|
@import "stylesheets/decidim/admin/modules/layout";
|
|
@@ -29,7 +30,9 @@
|
|
|
29
30
|
@import "stylesheets/decidim/admin/modules/agenda";
|
|
30
31
|
@import "stylesheets/decidim/admin/modules/draggable-list";
|
|
31
32
|
@import "stylesheets/decidim/admin/modules/loading-spinner";
|
|
33
|
+
@import "stylesheets/decidim/admin/modules/import_result";
|
|
32
34
|
@import "stylesheets/decidim/admin/modules/reveal";
|
|
35
|
+
@import "stylesheets/decidim/admin/modules/upload_modal";
|
|
33
36
|
|
|
34
37
|
// mentions__container
|
|
35
38
|
@import "stylesheets/decidim/modules/tags";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@import "stylesheets/decidim/modules/upload_modal";
|
|
2
|
+
|
|
3
|
+
.upload-modal{
|
|
4
|
+
button{
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.upload-items{
|
|
9
|
+
.upload-item-first-row{
|
|
10
|
+
display: flex;
|
|
11
|
+
|
|
12
|
+
.file-name-span{
|
|
13
|
+
flex: 4 1 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.title-container{
|
|
17
|
+
flex: 3.5 1 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.upload-item-second-row{
|
|
22
|
+
display: flex;
|
|
23
|
+
|
|
24
|
+
.progress-bar-wrapper{
|
|
25
|
+
flex: 4 1 0;
|
|
26
|
+
margin-right: 1rem;
|
|
27
|
+
|
|
28
|
+
.progress-bar-border{
|
|
29
|
+
border: 1px solid map-get($foundation-palette, primary);
|
|
30
|
+
|
|
31
|
+
.progress-bar{
|
|
32
|
+
background-color: map-get($foundation-palette, primary);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.remove-upload-item{
|
|
38
|
+
flex: 1 1 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -29,14 +29,12 @@ module Decidim
|
|
|
29
29
|
read_admin_dashboard_action?
|
|
30
30
|
apply_newsletter_permissions_for_admin!
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
allow! if permission_action.subject == :global_moderation
|
|
33
33
|
|
|
34
34
|
if user.admin? && admin_terms_accepted?
|
|
35
35
|
allow! if read_admin_log_action?
|
|
36
|
-
allow! if read_user_statistics_action?
|
|
37
36
|
allow! if read_metrics_action?
|
|
38
37
|
allow! if static_page_action?
|
|
39
|
-
allow! if templates_action?
|
|
40
38
|
allow! if organization_action?
|
|
41
39
|
allow! if user_action?
|
|
42
40
|
|
|
@@ -58,6 +56,7 @@ module Decidim
|
|
|
58
56
|
allow! if permission_action.subject == :static_page_topic
|
|
59
57
|
allow! if permission_action.subject == :help_sections
|
|
60
58
|
allow! if permission_action.subject == :share_token
|
|
59
|
+
allow! if permission_action.subject == :reminder
|
|
61
60
|
end
|
|
62
61
|
|
|
63
62
|
permission_action
|
|
@@ -78,23 +77,6 @@ module Decidim
|
|
|
78
77
|
toggle_allow(user.admin? || space_allows_admin_access_to_current_action?)
|
|
79
78
|
end
|
|
80
79
|
|
|
81
|
-
def apply_global_moderations_permission_for_admin!
|
|
82
|
-
return unless admin_terms_accepted?
|
|
83
|
-
return unless permission_action.subject == :global_moderation
|
|
84
|
-
return allow! if user.admin?
|
|
85
|
-
|
|
86
|
-
return allow! if Decidim.participatory_space_manifests.flat_map.any? do |manifest|
|
|
87
|
-
Decidim
|
|
88
|
-
.find_participatory_space_manifest(manifest.name)
|
|
89
|
-
.participatory_spaces
|
|
90
|
-
.call(user.organization)&.any? do |space|
|
|
91
|
-
space.respond_to?(:user_roles) && space.user_roles(:admin).where(user: user).or(space.user_roles(:moderator).where(user: user)).any?
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
disallow!
|
|
96
|
-
end
|
|
97
|
-
|
|
98
80
|
def apply_newsletter_permissions_for_admin!
|
|
99
81
|
return unless admin_terms_accepted?
|
|
100
82
|
return unless permission_action.subject == :newsletter
|
|
@@ -120,11 +102,6 @@ module Decidim
|
|
|
120
102
|
end
|
|
121
103
|
end
|
|
122
104
|
|
|
123
|
-
def read_user_statistics_action?
|
|
124
|
-
permission_action.subject == :users_statistics &&
|
|
125
|
-
permission_action.action == :read
|
|
126
|
-
end
|
|
127
|
-
|
|
128
105
|
def read_metrics_action?
|
|
129
106
|
permission_action.subject == :metrics &&
|
|
130
107
|
permission_action.action == :read
|
|
@@ -152,11 +129,6 @@ module Decidim
|
|
|
152
129
|
end
|
|
153
130
|
end
|
|
154
131
|
|
|
155
|
-
def templates_action?
|
|
156
|
-
permission_action.subject == :templates &&
|
|
157
|
-
permission_action.action == :read
|
|
158
|
-
end
|
|
159
|
-
|
|
160
132
|
def organization_action?
|
|
161
133
|
return unless permission_action.subject == :organization
|
|
162
134
|
return unless permission_action.action == :update
|
|
@@ -168,7 +140,6 @@ module Decidim
|
|
|
168
140
|
return unless permission_action.subject == :managed_user
|
|
169
141
|
return user_manager_permissions if user_manager?
|
|
170
142
|
return unless user&.admin?
|
|
171
|
-
return unless user&.admin_terms_accepted?
|
|
172
143
|
|
|
173
144
|
case permission_action.action
|
|
174
145
|
when :create
|
|
@@ -213,7 +184,7 @@ module Decidim
|
|
|
213
184
|
|
|
214
185
|
def space_allows_admin_access_to_current_action?(require_admin_terms_accepted: false)
|
|
215
186
|
Decidim.participatory_space_manifests.any? do |manifest|
|
|
216
|
-
next if require_admin_terms_accepted && !admin_terms_accepted?
|
|
187
|
+
next if manifest.name != :initiatives && require_admin_terms_accepted && !admin_terms_accepted?
|
|
217
188
|
|
|
218
189
|
new_permission_action = Decidim::PermissionAction.new(
|
|
219
190
|
action: permission_action.action,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Decidim
|
|
4
4
|
module Admin
|
|
5
5
|
# Counts active users making a distinction between whether they are admins or participants
|
|
6
|
-
class ActiveUsersCounter <
|
|
6
|
+
class ActiveUsersCounter < Decidim::Query
|
|
7
7
|
# Initializes the class.
|
|
8
8
|
#
|
|
9
9
|
# @param organization [Organization] Current organization
|
|
@@ -4,7 +4,7 @@ module Decidim
|
|
|
4
4
|
module Admin
|
|
5
5
|
# A class used to find the recipients of the
|
|
6
6
|
# Newsletter depending on the params of the form
|
|
7
|
-
class NewsletterRecipients <
|
|
7
|
+
class NewsletterRecipients < Decidim::Query
|
|
8
8
|
# Syntactic sugar to initialize the class and return the queried objects.
|
|
9
9
|
#
|
|
10
10
|
# form - params to filter the query
|
|
@@ -56,7 +56,7 @@ module Decidim
|
|
|
56
56
|
if type.ids.include?("all")
|
|
57
57
|
object_class.where(organization: @organization)
|
|
58
58
|
else
|
|
59
|
-
object_class.where(id: type.ids.
|
|
59
|
+
object_class.where(id: type.ids.compact_blank)
|
|
60
60
|
end
|
|
61
61
|
end.flatten.compact
|
|
62
62
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Decidim
|
|
4
4
|
module Admin
|
|
5
5
|
# A class used to find the UserGroup's by their evaluation state.
|
|
6
|
-
class UserGroupsEvaluation <
|
|
6
|
+
class UserGroupsEvaluation < Decidim::Query
|
|
7
7
|
# Syntactic sugar to initialize the class and return the queried objects.
|
|
8
8
|
#
|
|
9
9
|
# user_groups - the initial User Group relation that needs to be filtered.
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
<%= form.number_field :weight %>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
<div class="row column">
|
|
16
|
-
<%= form.translated :editor, :description %>
|
|
17
|
-
</div>
|
|
18
|
-
|
|
19
15
|
<div class="row column">
|
|
20
16
|
<%= form.label :parent_id %>
|
|
21
17
|
<%= select :category, :parent_id, @form.parent_categories.collect { |c| [c.name[current_organization.default_locale], c.id] }, include_blank: true %>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<% end %>
|
|
13
13
|
|
|
14
14
|
<div class="grid-x grid-margin-x">
|
|
15
|
-
<% if
|
|
15
|
+
<% if current_user.admin? && current_user.organization&.id == current_organization.id %>
|
|
16
16
|
<div class="cell small-12 medium-6 large-4">
|
|
17
17
|
<%= render(
|
|
18
18
|
partial: "decidim/admin/users_statistics/users_count",
|