decidim-admin 0.27.0.rc1 → 0.27.0.rc2

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.

Potentially problematic release.


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

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd57dbd303809b47c0bbf9c466c4ed731f6e3d4c8b6604d1adb478114f5ef0cb
4
- data.tar.gz: e77d08a54416dbff1d3481d3ddf32de28828d475143ff5cb4b5c536114106c45
3
+ metadata.gz: a5ed15c6f0a16e84e95cb02c129c2b52cb40bccf9c8b90b85c8bc1c7012e1412
4
+ data.tar.gz: 46b07fc0bf82a571a725d3f3e8eca721bac6fd37faa09876a17cbaa5a565d36b
5
5
  SHA512:
6
- metadata.gz: b97e7a0cdb53e8c909c42e7fc6b2cd345f66f61c67648a3c086ad2db8ba9e9dc936e60d51cfaf7689d086d4c9a1f347b2432f22f9e7590743bec4897c278cf17
7
- data.tar.gz: 96cb283bb59d1026e5de9d917db4dbf185ef5384442a9166f1211077c757554d6680dec253d1408da3924ae381b9dfcbb590f50c1cd73bd80b5120c4cd1cba78
6
+ metadata.gz: 61558f5b7c81beada95e0fe404e20dae4365cd93b0119ab20d2a238cd3bb2b6509b54a5579787971793f67f22b43679aff0502a7569d037665955e26571bcf41
7
+ data.tar.gz: 90e6c74f71c60251c4ebe7d7d46894db2681558f68843bb4bd5d9001a2fd32cebf63ee705951d535670e6634c5d62820d1794c2c87c053abb73cf22b9a5e0d61
@@ -30,11 +30,11 @@ module Decidim
30
30
  end
31
31
 
32
32
  def users
33
- search(current_organization.users)
33
+ search(current_organization.users.available)
34
34
  end
35
35
 
36
36
  def user_entities
37
- search(current_organization.user_entities)
37
+ search(current_organization.user_entities.available)
38
38
  end
39
39
 
40
40
  private
@@ -51,7 +51,7 @@ module Decidim
51
51
  query.where("email ILIKE ?", "%#{term}%")
52
52
  )
53
53
  end
54
- render json: query.all.collect { |u| { value: u.id, label: "#{u.name} (@#{u.nickname}) #{u.email}" } }
54
+ render json: query.all.collect { |u| { value: u.id, label: "#{u.name} (@#{u.nickname})" } }
55
55
  else
56
56
  render json: []
57
57
  end
@@ -83,7 +83,7 @@ module Decidim
83
83
  end
84
84
 
85
85
  def manifest_name
86
- @manifest_name ||= resource.manifest.name
86
+ @manifest_name ||= resource.resource_manifest.name
87
87
  end
88
88
 
89
89
  def permissions
@@ -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]
@@ -13,7 +13,7 @@ import "src/decidim/foundation_datepicker_locales"
13
13
  import "jquery-serializejson"
14
14
 
15
15
  import "src/decidim/admin/tab_focus"
16
- import "src/decidim/admin/choose_language"
16
+ import initLanguageChangeSelect from "src/decidim/admin/choose_language"
17
17
  import "src/decidim/admin/application"
18
18
  import "src/decidim/admin/resources_permissions"
19
19
  import "src/decidim/admin/welcome_notification"
@@ -41,3 +41,7 @@ import "entrypoints/decidim_admin.scss";
41
41
 
42
42
  // This needs to be loaded after confirm dialog to bind properly
43
43
  Rails.start()
44
+
45
+ window.addEventListener("DOMContentLoaded", () => {
46
+ initLanguageChangeSelect(document.querySelectorAll("select.language-change"));
47
+ });
@@ -18,6 +18,7 @@ import AutoComplete from "src/decidim/autocomplete";
18
18
  */
19
19
  const autoConfigure = (el) => {
20
20
  const config = JSON.parse(el.dataset.autocomplete);
21
+ const searchUrl = new URL(config.searchURL);
21
22
  const textInput = document.createElement("input");
22
23
  textInput.type = "text";
23
24
  textInput.className = "autocomplete-input";
@@ -46,8 +47,11 @@ const autoConfigure = (el) => {
46
47
  }
47
48
 
48
49
  const dataSource = (query, callback) => {
49
- const params = new URLSearchParams({ term: query });
50
- fetch(`${config.searchURL}?${params.toString()}`, {
50
+ const params = new URLSearchParams({
51
+ ...Object.fromEntries(searchUrl.searchParams),
52
+ term: query
53
+ });
54
+ fetch(`${searchUrl.origin}${searchUrl.pathname}?${params.toString()}`, {
51
55
  method: "GET",
52
56
  headers: { "Content-Type": "application/json" }
53
57
  }).then((response) => response.json()).then((data) => {
@@ -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
  }
@@ -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
  }
@@ -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">
@@ -1,2 +1 @@
1
- ---
2
1
  am:
@@ -1,2 +1 @@
1
- ---
2
1
  da:
@@ -850,6 +850,9 @@ de:
850
850
  reminders:
851
851
  create:
852
852
  error: Beim Erstellen dieser Erinnerungen ist ein Problem aufgetreten.
853
+ success:
854
+ one: "%{count} Benutzer wird erinnert."
855
+ other: "%{count} Benutzer werden erinnert."
853
856
  new:
854
857
  submit: Senden
855
858
  resource_permissions:
@@ -1,2 +1 @@
1
- ---
2
1
  et:
@@ -211,21 +211,21 @@ fr:
211
211
  success: Le type de périmètre d'assemblée a été mis à jour avec succès
212
212
  areas:
213
213
  create:
214
- error: Une erreur s'est produite lors de la création d'une nouvelle zone d'application.
215
- success: Zone d'application créée avec succès.
214
+ error: Une erreur s'est produite lors de la création d'un nouveau périmètre d'assemblée.
215
+ success: Périmètre d'assemblée créé avec succès.
216
216
  destroy:
217
- has_spaces: Des espaces dépendent de cette zone d'application. Veuillez vous assurer qu'aucun espace participatif n'est lié à cette zone avant de la supprimer.
218
- success: La zone d'application a bien été supprimée
217
+ has_spaces: Des espaces dépendent de ce périmètre d'assemblée. Veuillez vous assurer qu'aucun espace participatif n'est lié à périmètre avant de la supprimer.
218
+ success: Le périmètre d'assemblée a bien été supprimé
219
219
  edit:
220
- title: Modifier la zone d'application
220
+ title: Modifier le périmètre d'assemblée
221
221
  update: Mettre à jour
222
222
  new:
223
- create: Créer une zone d'application
224
- title: Nouvelle zone d'application
225
- no_areas: Aucune zone d'application
223
+ create: Créer un périmètre d'assemblée
224
+ title: Nouveau périmètre d'assemblée
225
+ no_areas: Aucun périmètre d'assemblée
226
226
  update:
227
- error: Une erreur s'est produite lors de la mise à jour de cette zone d'application.
228
- success: Zone d'application mise à jour avec succès
227
+ error: Une erreur s'est produite lors de la mise à jour de ce périmètre d'assemblée.
228
+ success: Périmètre d'assemblée mise à jour avec succès
229
229
  attachment_collections:
230
230
  create:
231
231
  error: Une erreur s'est produite lors de la création d'un nouveau dossier.
@@ -526,7 +526,7 @@ fr:
526
526
  admins: Administrateurs
527
527
  appearance: Apparence
528
528
  area_types: Types de périmètre d'assemblée
529
- areas: Zones d'application
529
+ areas: Périmètres d'assemblée
530
530
  configuration: Configuration
531
531
  dashboard: Tableau de bord
532
532
  external_domain_whitelist: Domaines externes autorisés
@@ -538,7 +538,7 @@ fr:
538
538
  participants: Participants
539
539
  reported_users: Utilisateurs signalés
540
540
  scope_types: Types de secteur
541
- scopes: Périmètres d’application
541
+ scopes: Secteurs
542
542
  settings: Paramètres
543
543
  static_pages: Pages
544
544
  user_groups: Groupes d'utilisateurs
@@ -960,7 +960,7 @@ fr:
960
960
  titles:
961
961
  admin_log: Journal d'administration
962
962
  area_types: Types de périmètre d'assemblée
963
- areas: Zones d'application
963
+ areas: Périmètres d'assemblée
964
964
  authorization_workflows: Méthodes de vérification
965
965
  dashboard: Tableau de bord
966
966
  impersonatable_users: Utilisateurs pouvant être représentés
@@ -969,7 +969,7 @@ fr:
969
969
  panel: Administrateur
970
970
  participants: Utilisateurs
971
971
  scope_types: Types de secteur
972
- scopes: Périmètres d'application
972
+ scopes: Secteurs
973
973
  static_pages: Pages
974
974
  statistics: Activité
975
975
  user_groups: Groupes d'utilisateurs
@@ -1,2 +1 @@
1
- ---
2
1
  hr: