decidim-admin 0.26.2 → 0.27.0.rc2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim-admin might be problematic. Click here for more details.

Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/admin/attachments_privacy_warning/show.erb +3 -0
  3. data/app/cells/decidim/admin/attachments_privacy_warning_cell.rb +19 -0
  4. data/app/commands/decidim/admin/block_user.rb +1 -1
  5. data/app/commands/decidim/admin/close_session_managed_user.rb +1 -1
  6. data/app/commands/decidim/admin/create_area.rb +1 -1
  7. data/app/commands/decidim/admin/create_area_type.rb +6 -3
  8. data/app/commands/decidim/admin/create_attachment.rb +14 -6
  9. data/app/commands/decidim/admin/create_attachment_collection.rb +13 -4
  10. data/app/commands/decidim/admin/create_category.rb +6 -4
  11. data/app/commands/decidim/admin/create_component.rb +1 -1
  12. data/app/commands/decidim/admin/create_import.rb +4 -5
  13. data/app/commands/decidim/admin/create_import_example.rb +1 -1
  14. data/app/commands/decidim/admin/create_newsletter.rb +1 -1
  15. data/app/commands/decidim/admin/create_participatory_space_private_user.rb +1 -1
  16. data/app/commands/decidim/admin/create_scope.rb +1 -1
  17. data/app/commands/decidim/admin/create_scope_type.rb +6 -3
  18. data/app/commands/decidim/admin/create_static_page.rb +1 -1
  19. data/app/commands/decidim/admin/create_static_page_topic.rb +1 -1
  20. data/app/commands/decidim/admin/deliver_newsletter.rb +6 -6
  21. data/app/commands/decidim/admin/destroy_area.rb +1 -1
  22. data/app/commands/decidim/admin/destroy_category.rb +6 -3
  23. data/app/commands/decidim/admin/destroy_component.rb +1 -1
  24. data/app/commands/decidim/admin/destroy_newsletter.rb +1 -1
  25. data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +1 -1
  26. data/app/commands/decidim/admin/destroy_scope.rb +1 -1
  27. data/app/commands/decidim/admin/destroy_share_token.rb +1 -1
  28. data/app/commands/decidim/admin/destroy_static_page.rb +1 -1
  29. data/app/commands/decidim/admin/destroy_static_page_topic.rb +1 -1
  30. data/app/commands/decidim/admin/hide_resource.rb +2 -2
  31. data/app/commands/decidim/admin/impersonate_user.rb +1 -1
  32. data/app/commands/decidim/admin/invite_admin.rb +1 -1
  33. data/app/commands/decidim/admin/officialize_user.rb +1 -1
  34. data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +7 -3
  35. data/app/commands/decidim/admin/process_user_group_verification_csv.rb +8 -4
  36. data/app/commands/decidim/admin/promote_managed_user.rb +1 -1
  37. data/app/commands/decidim/admin/publish_component.rb +1 -1
  38. data/app/commands/decidim/admin/reject_user_group.rb +1 -1
  39. data/app/commands/decidim/admin/remove_admin.rb +1 -1
  40. data/app/commands/decidim/admin/reorder_content_blocks.rb +1 -1
  41. data/app/commands/decidim/admin/transfer_user.rb +1 -1
  42. data/app/commands/decidim/admin/unblock_user.rb +1 -1
  43. data/app/commands/decidim/admin/unhide_resource.rb +1 -1
  44. data/app/commands/decidim/admin/unofficialize_user.rb +1 -1
  45. data/app/commands/decidim/admin/unpublish_component.rb +1 -1
  46. data/app/commands/decidim/admin/unreport_resource.rb +1 -1
  47. data/app/commands/decidim/admin/unreport_user.rb +1 -1
  48. data/app/commands/decidim/admin/update_area.rb +1 -1
  49. data/app/commands/decidim/admin/update_area_type.rb +8 -3
  50. data/app/commands/decidim/admin/update_attachment.rb +4 -3
  51. data/app/commands/decidim/admin/update_attachment_collection.rb +8 -3
  52. data/app/commands/decidim/admin/update_category.rb +9 -5
  53. data/app/commands/decidim/admin/update_component.rb +8 -5
  54. data/app/commands/decidim/admin/update_component_permissions.rb +9 -6
  55. data/app/commands/decidim/admin/update_content_block.rb +1 -1
  56. data/app/commands/decidim/admin/update_external_domain_whitelist.rb +6 -3
  57. data/app/commands/decidim/admin/update_help_sections.rb +17 -3
  58. data/app/commands/decidim/admin/update_newsletter.rb +1 -1
  59. data/app/commands/decidim/admin/update_organization.rb +1 -1
  60. data/app/commands/decidim/admin/update_organization_appearance.rb +1 -1
  61. data/app/commands/decidim/admin/update_organization_tos_version.rb +1 -1
  62. data/app/commands/decidim/admin/update_resource_permissions.rb +2 -2
  63. data/app/commands/decidim/admin/update_scope.rb +1 -1
  64. data/app/commands/decidim/admin/update_scope_type.rb +8 -3
  65. data/app/commands/decidim/admin/update_static_page.rb +1 -1
  66. data/app/commands/decidim/admin/update_static_page_topic.rb +1 -1
  67. data/app/commands/decidim/admin/update_user_groups.rb +1 -1
  68. data/app/commands/decidim/admin/verify_user_group.rb +1 -1
  69. data/app/controllers/concerns/decidim/admin/filterable.rb +1 -1
  70. data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +3 -1
  71. data/app/controllers/decidim/admin/application_controller.rb +1 -0
  72. data/app/controllers/decidim/admin/area_types_controller.rb +6 -3
  73. data/app/controllers/decidim/admin/categories_controller.rb +3 -3
  74. data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
  75. data/app/controllers/decidim/admin/components/base_controller.rb +1 -0
  76. data/app/controllers/decidim/admin/components_controller.rb +1 -1
  77. data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +6 -3
  78. data/app/controllers/decidim/admin/concerns/has_attachments.rb +6 -3
  79. data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +7 -0
  80. data/app/controllers/decidim/admin/dashboard_controller.rb +4 -3
  81. data/app/controllers/decidim/admin/exports_controller.rb +4 -1
  82. data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
  83. data/app/controllers/decidim/admin/metrics_controller.rb +2 -1
  84. data/app/controllers/decidim/admin/moderations_controller.rb +9 -7
  85. data/app/controllers/decidim/admin/organization_controller.rb +3 -3
  86. data/app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb +1 -1
  87. data/app/controllers/decidim/admin/reminders_controller.rb +61 -0
  88. data/app/controllers/decidim/admin/resource_permissions_controller.rb +3 -3
  89. data/app/controllers/decidim/admin/scope_types_controller.rb +6 -3
  90. data/app/controllers/decidim/admin/static_pages_controller.rb +1 -7
  91. data/app/forms/decidim/admin/category_form.rb +1 -2
  92. data/app/forms/decidim/admin/component_form.rb +16 -7
  93. data/app/forms/decidim/admin/import_example_form.rb +1 -5
  94. data/app/forms/decidim/admin/import_form.rb +7 -10
  95. data/app/forms/decidim/admin/managed_user_promotion_form.rb +1 -1
  96. data/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb +7 -4
  97. data/app/forms/decidim/admin/permission_form.rb +9 -8
  98. data/app/forms/decidim/admin/permissions_form.rb +1 -10
  99. data/app/forms/decidim/admin/user_group_csv_verification_form.rb +2 -2
  100. data/app/helpers/decidim/admin/bulk_actions_helper.rb +0 -4
  101. data/app/helpers/decidim/admin/moderations/reports_helper.rb +11 -2
  102. data/app/helpers/decidim/admin/reminders_helper.rb +12 -0
  103. data/app/helpers/decidim/admin/settings_helper.rb +57 -11
  104. data/app/packs/entrypoints/decidim_admin.js +7 -2
  105. data/app/packs/src/decidim/admin/admin_autocomplete.js +86 -0
  106. data/app/packs/src/decidim/admin/application.js +0 -16
  107. data/app/packs/src/decidim/admin/choose_language.js +11 -9
  108. data/app/packs/src/decidim/admin/dynamic_fields.component.js +1 -0
  109. data/app/packs/stylesheets/decidim/admin/_decidim.scss +0 -1
  110. data/app/packs/stylesheets/decidim/admin/modules/_autocomplete.scss +5 -0
  111. data/app/packs/stylesheets/decidim/admin/modules/_forms.scss +6 -0
  112. data/app/packs/stylesheets/decidim/admin/modules/_modules.scss +2 -0
  113. data/app/packs/stylesheets/decidim/admin/modules/_upload_modal.scss +42 -0
  114. data/app/permissions/decidim/admin/permissions.rb +1 -0
  115. data/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb +3 -1
  116. data/app/queries/decidim/admin/active_users_counter.rb +1 -1
  117. data/app/queries/decidim/admin/newsletter_recipients.rb +2 -2
  118. data/app/queries/decidim/admin/user_filter.rb +1 -1
  119. data/app/queries/decidim/admin/user_groups_evaluation.rb +1 -1
  120. data/app/views/decidim/admin/attachments/index.html.erb +1 -0
  121. data/app/views/decidim/admin/categories/_form.html.erb +0 -4
  122. data/app/views/decidim/admin/categories/show.html.erb +1 -2
  123. data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -4
  124. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +1 -1
  125. data/app/views/decidim/admin/participatory_space_private_users_csv_imports/new.html.erb +20 -1
  126. data/app/views/decidim/admin/reminders/new.html.erb +21 -0
  127. data/app/views/decidim/admin/resource_permissions/edit.html.erb +1 -1
  128. data/app/views/decidim/admin/shared/_gallery.html.erb +6 -1
  129. data/app/views/decidim/admin/shared/_js-callout.html.erb +6 -0
  130. data/app/views/decidim/admin/users_statistics/_users_count.html.erb +2 -2
  131. data/app/views/layouts/decidim/admin/_application.html.erb +2 -0
  132. data/config/locales/ar.yml +15 -4
  133. data/config/locales/bg.yml +1 -0
  134. data/config/locales/ca.yml +22 -4
  135. data/config/locales/cs.yml +24 -4
  136. data/config/locales/de.yml +22 -4
  137. data/config/locales/el.yml +1 -5
  138. data/config/locales/en.yml +21 -4
  139. data/config/locales/eo.yml +1 -0
  140. data/config/locales/es-MX.yml +22 -4
  141. data/config/locales/es-PY.yml +22 -4
  142. data/config/locales/es.yml +22 -4
  143. data/config/locales/eu.yml +1 -5
  144. data/config/locales/fi-plain.yml +22 -4
  145. data/config/locales/fi.yml +22 -4
  146. data/config/locales/fr-CA.yml +22 -4
  147. data/config/locales/fr.yml +36 -18
  148. data/config/locales/ga-IE.yml +1 -0
  149. data/config/locales/gl.yml +16 -4
  150. data/config/locales/hu.yml +196 -3
  151. data/config/locales/id-ID.yml +1 -3
  152. data/config/locales/is-IS.yml +2 -4
  153. data/config/locales/it.yml +6 -5
  154. data/config/locales/ja.yml +21 -4
  155. data/config/locales/lb.yml +1 -5
  156. data/config/locales/lt.yml +994 -0
  157. data/config/locales/lv.yml +1 -3
  158. data/config/locales/nl.yml +83 -5
  159. data/config/locales/no.yml +27 -4
  160. data/config/locales/pl.yml +77 -5
  161. data/config/locales/pt-BR.yml +1 -5
  162. data/config/locales/pt.yml +1 -5
  163. data/config/locales/ro-RO.yml +7 -5
  164. data/config/locales/ru.yml +1 -3
  165. data/config/locales/sk.yml +1 -3
  166. data/config/locales/sl.yml +1 -0
  167. data/config/locales/sr-CS.yml +1 -2
  168. data/config/locales/sv.yml +22 -3
  169. data/config/locales/tr-TR.yml +1 -3
  170. data/config/locales/uk.yml +1 -2
  171. data/config/locales/val-ES.yml +1 -0
  172. data/config/locales/zh-CN.yml +1 -3
  173. data/lib/decidim/admin/engine.rb +0 -1
  174. data/lib/decidim/admin/import/importer.rb +9 -7
  175. data/lib/decidim/admin/import/readers/json.rb +1 -1
  176. data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +15 -2
  177. data/lib/decidim/admin/test/commands/create_category_examples.rb +16 -6
  178. data/lib/decidim/admin/test/commands/destroy_category_examples.rb +29 -1
  179. data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +15 -2
  180. data/lib/decidim/admin/test/commands/update_category_examples.rb +16 -6
  181. data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +4 -4
  182. data/lib/decidim/admin/test/filters_participatory_space_users_examples.rb +4 -4
  183. data/lib/decidim/admin/test/forms/category_form_examples.rb +1 -21
  184. data/lib/decidim/admin/test/manage_attachments_examples.rb +9 -2
  185. data/lib/decidim/admin/test/manage_categories_examples.rb +0 -10
  186. data/lib/decidim/admin/test/manage_component_permissions_examples.rb +0 -2
  187. data/lib/decidim/admin/test/manage_moderations_examples.rb +26 -0
  188. data/lib/decidim/admin/version.rb +1 -1
  189. metadata +21 -15
  190. data/app/packs/src/decidim/admin/autocomplete.component.js +0 -146
  191. data/app/packs/src/decidim/admin/autocomplete.component.test.js +0 -19
  192. data/app/packs/stylesheets/decidim/admin/components/_autocomplete_select.component.scss +0 -19
@@ -18,16 +18,19 @@ module Decidim
18
18
  time: :datetime_field
19
19
  }.freeze
20
20
 
21
- # Public: Renders a form field that matches a settings attribute's
22
- # type.
21
+ # Renders a form field that matches a settings attribute's type.
22
+ # Besides the field itself, it also renders all the metadata (like the labels and help texts)
23
23
  #
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.
24
+ # @param form [Decidim::Admin::FormBuilder] The form in which to render the field
25
+ # @param attribute [Decidim::SettingsManifest::Attribute] The Settings::Attribute instance with the
26
+ # description of the attribute.
27
+ # @param name [Symbol] The name of the field.
28
+ # @param i18n_scope [String] The scope where it'll find all the texts for the internationalization (locales)
29
+ # @param options [Hash] Extra options to be passed to the field helper.
30
+ # @option options [String] :tabs_prefix The type of the setting.
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.
31
34
  def settings_attribute_input(form, attribute, name, i18n_scope, options = {})
32
35
  form_method = form_method_for_attribute(attribute)
33
36
 
@@ -62,6 +65,18 @@ module Decidim
62
65
 
63
66
  private
64
67
 
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)
65
80
  def render_select_form_field(form, attribute, name, i18n_scope, options)
66
81
  html = form.select(
67
82
  name,
@@ -73,6 +88,17 @@ module Decidim
73
88
  end
74
89
 
75
90
  # 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)
76
102
  def render_enum_form_field(form, attribute, name, i18n_scope, options)
77
103
  html = label_tag(name) do
78
104
  concat options[:label]
@@ -88,13 +114,25 @@ module Decidim
88
114
  html
89
115
  end
90
116
 
117
+ # Get the translation for a given attribute
91
118
  # 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]
92
124
  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
+
93
128
  key = "#{i18n_scope}.#{name}_#{suffix}"
94
129
  return t(key) if I18n.exists?(key)
95
130
  end
96
131
 
97
- # Returns the FormBuilder's method used to render
132
+ # Which form method is being used for this attribute
133
+ #
134
+ # @param attribute [Decidim::SettingsManifest::Attribute]
135
+ # @return [Symbol] The FormBuilder's method used to render
98
136
  def form_method_for_attribute(attribute)
99
137
  return :editor if attribute.type.to_sym == :text && attribute.editor?
100
138
 
@@ -102,7 +140,9 @@ module Decidim
102
140
  end
103
141
 
104
142
  # Handles special cases.
105
- # Returns an empty Hash or a Hash with extra HTML options.
143
+ #
144
+ # @param input_type [Symbol]
145
+ # @return [Hash] Empty Hash or a Hash with extra HTML options.
106
146
  def extra_options_for_type(input_type)
107
147
  case input_type
108
148
  when :text_area
@@ -113,6 +153,12 @@ module Decidim
113
153
  end
114
154
 
115
155
  # 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>>]
116
162
  def build_enum_choices(name, i18n_scope, choices)
117
163
  choices.map do |choice|
118
164
  [t("#{name}_choices.#{choice}", scope: i18n_scope), choice]
@@ -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 "src/decidim/admin/choose_language"
16
+ import initLanguageChangeSelect from "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,9 +33,15 @@ 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()
44
+
45
+ window.addEventListener("DOMContentLoaded", () => {
46
+ initLanguageChangeSelect(document.querySelectorAll("select.language-change"));
47
+ });
@@ -0,0 +1,86 @@
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 searchUrl = new URL(config.searchURL);
22
+ const textInput = document.createElement("input");
23
+ textInput.type = "text";
24
+ textInput.className = "autocomplete-input";
25
+ el.appendChild(textInput);
26
+ let mode = config.mode || "sticky"
27
+ let selected = null;
28
+ if (config.selected) {
29
+ switch (mode) {
30
+ case "multi":
31
+ selected = config.selected.map((item) => (
32
+ {
33
+ key: "label",
34
+ value: {
35
+ value: item.value,
36
+ label: item.label
37
+ }
38
+ }
39
+ ));
40
+ break;
41
+ case "sticky":
42
+ selected = { key: "label", value: config.options[config.options.length - 1] };
43
+ break;
44
+ default:
45
+ selected = config.selected;
46
+ }
47
+ }
48
+
49
+ const dataSource = (query, callback) => {
50
+ const params = new URLSearchParams({
51
+ ...Object.fromEntries(searchUrl.searchParams),
52
+ term: query
53
+ });
54
+ fetch(`${searchUrl.origin}${searchUrl.pathname}?${params.toString()}`, {
55
+ method: "GET",
56
+ headers: { "Content-Type": "application/json" }
57
+ }).then((response) => response.json()).then((data) => {
58
+ callback(data)
59
+ });
60
+ };
61
+
62
+ const ac = new AutoComplete(textInput, {
63
+ name: config.name,
64
+ placeholder: config.placeholder,
65
+ selected: selected,
66
+ mode: mode,
67
+ searchPrompt: true,
68
+ searchPromptText: config.searchPromptText,
69
+ threshold: 3,
70
+ dataMatchKeys: ["label"],
71
+ dataSource
72
+ });
73
+
74
+ return ac;
75
+ }
76
+
77
+ $(() => {
78
+ const $autocompleteDiv = $("[data-autocomplete]");
79
+ if ($autocompleteDiv.length < 1) {
80
+ return;
81
+ }
82
+
83
+ $autocompleteDiv.each((_index, element) => {
84
+ autoConfigure(element);
85
+ })
86
+ })
@@ -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">&nbsp;</td></tr>')[0],
43
27
  onSortUpdate: ($children) => {
@@ -1,12 +1,14 @@
1
1
  /* eslint-disable no-invalid-this */
2
+ /* eslint-disable require-jsdoc */
2
3
 
3
- $(() => {
4
- $("select.language-change").change(function () {
5
- let $select = $(this);
6
- let targetTabPaneSelector = $select.val();
7
- let $tabsContent = $select.parent().parent().siblings();
4
+ export default function initLanguageChangeSelect(elements) {
5
+ elements.forEach((select) => {
6
+ select.addEventListener("change", () => {
7
+ let targetTabPaneSelector = select.value;
8
+ let tabsContent = select.parentElement.parentElement.nextElementSibling;
8
9
 
9
- $tabsContent.children(".is-active").removeClass("is-active");
10
- $tabsContent.children(targetTabPaneSelector).addClass("is-active");
11
- })
12
- });
10
+ tabsContent.querySelector(".is-active").classList.remove("is-active");
11
+ tabsContent.querySelector(targetTabPaneSelector).classList.add("is-active");
12
+ })
13
+ });
14
+ }
@@ -70,6 +70,7 @@ 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);
73
74
 
74
75
  return this;
75
76
  }
@@ -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";
@@ -0,0 +1,5 @@
1
+ @import "stylesheets/decidim/modules/autocomplete";
2
+
3
+ .autoComplete_wrapper{
4
+ margin-bottom: 1.5rem;
5
+ }
@@ -116,6 +116,12 @@ label,
116
116
  margin-bottom: $input-margin;
117
117
  }
118
118
 
119
+ .form-input-extra-before{
120
+ margin-bottom: $form-spacing * 1.5;
121
+ display: block;
122
+ margin-top: $form-spacing * -1;
123
+ }
124
+
119
125
  .custom-error{
120
126
  @extend .form-error;
121
127
  }
@@ -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";
@@ -31,6 +32,7 @@
31
32
  @import "stylesheets/decidim/admin/modules/loading-spinner";
32
33
  @import "stylesheets/decidim/admin/modules/import_result";
33
34
  @import "stylesheets/decidim/admin/modules/reveal";
35
+ @import "stylesheets/decidim/admin/modules/upload_modal";
34
36
 
35
37
  // mentions__container
36
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
+ }
@@ -56,6 +56,7 @@ module Decidim
56
56
  allow! if permission_action.subject == :static_page_topic
57
57
  allow! if permission_action.subject == :help_sections
58
58
  allow! if permission_action.subject == :share_token
59
+ allow! if permission_action.subject == :reminder
59
60
  end
60
61
 
61
62
  permission_action
@@ -3,7 +3,9 @@
3
3
  module Decidim
4
4
  module Admin
5
5
  class DashboardMetricChartsPresenter < Decidim::MetricChartsPresenter
6
- attribute :summary, Boolean
6
+ def summary?
7
+ __getobj__.fetch(:summary)
8
+ end
7
9
 
8
10
  def render_not_highlighted(metrics)
9
11
  safe_join(
@@ -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 < Rectify::Query
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 < Rectify::Query
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.reject(&:blank?))
59
+ object_class.where(id: type.ids.compact_blank)
60
60
  end
61
61
  end.flatten.compact
62
62
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Admin
5
5
  # A class used to filter users by whitelisted scope or searches on their
6
6
  # name
7
- class UserFilter < Rectify::Query
7
+ class UserFilter < Decidim::Query
8
8
  WHITELISTED_STATE_SCOPES = %w(
9
9
  officialized
10
10
  not_officialized
@@ -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 < Rectify::Query
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.
@@ -9,6 +9,7 @@
9
9
  </div>
10
10
 
11
11
  <div class="card-section">
12
+ <%= cell("decidim/admin/attachments_privacy_warning", attached_to.attachments) %>
12
13
  <% if attached_to.attachments.any? %>
13
14
  <div class="table-scroll">
14
15
  <table class="table-list">
@@ -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 %>
@@ -8,6 +8,5 @@
8
8
 
9
9
  <dl>
10
10
  <%= display_for @category,
11
- :name,
12
- :description %>
11
+ :name %>
13
12
  </dl>
@@ -14,7 +14,8 @@
14
14
  <%= form.upload(
15
15
  :favicon,
16
16
  dimensions_info: current_organization.attached_uploader(:favicon).dimensions_info,
17
- extension_allowlist: current_organization.attached_uploader(:favicon).extension_allowlist
17
+ extension_allowlist: current_organization.attached_uploader(:favicon).extension_allowlist,
18
+ help_i18n_scope: "decidim.forms.file_help.icon"
18
19
  ) %>
19
20
  </div>
20
21
 
@@ -22,7 +23,7 @@
22
23
  <%= form.upload(
23
24
  :logo,
24
25
  dimensions_info: current_organization.attached_uploader(:logo).dimensions_info,
25
- extension_allowlist: current_organization.attached_uploader(:favicon).extension_allowlist
26
+ extension_allowlist: current_organization.attached_uploader(:logo).extension_allowlist
26
27
  ) %>
27
28
  </div>
28
29
 
@@ -30,7 +31,7 @@
30
31
  <%= form.upload(
31
32
  :official_img_header,
32
33
  dimensions_info: current_organization.attached_uploader(:official_img_header).dimensions_info,
33
- extension_allowlist: current_organization.attached_uploader(:favicon).extension_allowlist
34
+ extension_allowlist: current_organization.attached_uploader(:official_img_header).extension_allowlist
34
35
  ) %>
35
36
  </div>
36
37
 
@@ -38,7 +39,7 @@
38
39
  <%= form.upload(
39
40
  :official_img_footer,
40
41
  dimensions_info: current_organization.attached_uploader(:official_img_footer).dimensions_info,
41
- extension_allowlist: current_organization.attached_uploader(:favicon).extension_allowlist
42
+ extension_allowlist: current_organization.attached_uploader(:official_img_footer).extension_allowlist
42
43
  ) %>
43
44
  </div>
44
45
  </div>
@@ -3,7 +3,7 @@
3
3
  <h2 class="card-title">
4
4
  <%= t(".title") %>
5
5
  <% if allowed_to? :create, :space_private_user %>
6
- <%= link_to t(".import_via_csv"), new_participatory_space_private_users_csv_import_path, class: "button tiny button--title import" %>
6
+ <%= link_to t(".import_via_csv"), new_participatory_space_private_users_csv_imports_path, class: "button tiny button--title import" %>
7
7
  <%= link_to t("actions.participatory_space_private_user.new", scope: "decidim.admin"), url_for(action: :new), class: "button tiny button--title new" %>
8
8
  <% end %>
9
9
  </h2>
@@ -1,3 +1,22 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title">
4
+ <%= t(".destroy.title") %>
5
+ </h2>
6
+ </div>
7
+ <div class="card-section">
8
+ <% if @count != 0 %>
9
+ <p><%= t(".destroy.explanation", count: @count) %></p>
10
+ <%= link_to t(".destroy.button"),
11
+ destroy_all_participatory_space_private_users_csv_imports_path,
12
+ method: :delete,
13
+ class: "button alert",
14
+ data: { confirm: t(".destroy.confirm") } %>
15
+ <% else %>
16
+ <p><%= t(".destroy.empty") %></p>
17
+ <% end %>
18
+ </div>
19
+ </div>
1
20
  <div class="card" id='user-groups'>
2
21
  <div class="card-divider">
3
22
  <h2 class="card-title">
@@ -5,7 +24,7 @@
5
24
  </h2>
6
25
  </div>
7
26
  <div class="card-section">
8
- <%= decidim_form_for(@form, url: participatory_space_private_users_csv_import_path, html: { class: "form" }) do |form| %>
27
+ <%= decidim_form_for(@form, url: participatory_space_private_users_csv_imports_path, html: { class: "form" }) do |form| %>
9
28
  <p><%= t(".explanation") %></p>
10
29
  <div class="row column">
11
30
  <%= form.upload :file, optional: false %>
@@ -0,0 +1,21 @@
1
+ <%= decidim_form_for(@form, url: component_reminders_path(name: reminder_manifest.name), class: "form grid-container") do |form| %>
2
+ <div class="card">
3
+ <div class="card-divider">
4
+ <h2 class="card-title flex--sbc">
5
+ <%= reminder_manifest.message(:title, count: @form.try(:reminder_amount)) %>
6
+ </h2>
7
+ </div>
8
+ <div class="card-section">
9
+ <div class="row">
10
+ <div class="columns small-12">
11
+ <p><%= reminder_manifest.message(:description) %></p>
12
+ </div>
13
+ </div>
14
+ <div class="row">
15
+ <div class="columns small-12 text-center">
16
+ <%= form.submit t(".submit") %>
17
+ </div>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ <% end %>
@@ -21,7 +21,7 @@
21
21
  <% if @component %>
22
22
  <div class="card-divider"><%= t("#{@component.manifest.name}.actions.#{action}", scope: "decidim.components") %></div>
23
23
  <% else %>
24
- <div class="card-divider"><%= t("#{resource.manifest.name}.actions.#{action}", scope: "decidim.resources") %></div>
24
+ <div class="card-divider"><%= t("#{resource.resource_manifest.name}.actions.#{action}", scope: "decidim.resources") %></div>
25
25
  <% end %>
26
26
 
27
27
  <div class="card-section">
@@ -15,7 +15,12 @@
15
15
  <% end %>
16
16
 
17
17
  <div class="row column">
18
- <%= form.file_field :add_photos, multiple: true, label: t(".add_images") %>
18
+ <%= form.attachment :photos,
19
+ multiple: true,
20
+ label: t(".add_images"),
21
+ button_label: t(".add_images"),
22
+ button_edit_label: t(".edit_images"),
23
+ help_i18n_scope: "decidim.forms.file_help.image" %>
19
24
  </div>
20
25
  </fieldset>
21
26
  </div>
@@ -0,0 +1,6 @@
1
+ <div class="callout callout--full <%= css %>" data-closable>
2
+ <%= text %>
3
+ <button class="close-button" type="button" data-close="">
4
+ <span aria-hidden="true">×</span>
5
+ </button>
6
+ </div>
@@ -24,13 +24,13 @@
24
24
  <td class="title"><%= t(".participants") %></td>
25
25
  <td><%= result[:total_participants_last_month] %></td>
26
26
  <td><%= result[:total_participants_last_week] %></td>
27
- <td><%= result[:total_participants_last_24] %></td>
27
+ <td><%= result[:total_participants_last_day] %></td>
28
28
  </tr>
29
29
  <tr>
30
30
  <td class="title"><%= t(".admins") %></td>
31
31
  <td><%= result[:total_admins_last_month] %></td>
32
32
  <td><%= result[:total_admins_last_week] %></td>
33
- <td><%= result[:total_admins_last_24] %></td>
33
+ <td><%= result[:total_admins_last_day] %></td>
34
34
  </tr>
35
35
  </tbody>
36
36
  </table>
@@ -29,5 +29,7 @@
29
29
  <%= render partial: "decidim/shared/confirm_modal" %>
30
30
  <%= render partial: "layouts/decidim/admin/js_configuration" %>
31
31
  <%= render partial: "layouts/decidim/cors" if Decidim.cors_enabled %>
32
+
33
+ <%= snippets.display(:foot) %>
32
34
  </body>
33
35
  </html>