decidim-admin 0.26.1 → 0.26.3

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.

Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/decidim/admin/conflicts_controller.rb +3 -1
  3. data/app/controllers/decidim/admin/organization_controller.rb +3 -3
  4. data/app/controllers/decidim/admin/resource_permissions_controller.rb +1 -1
  5. data/app/helpers/decidim/admin/newsletters_helper.rb +1 -1
  6. data/app/helpers/decidim/admin/settings_helper.rb +57 -11
  7. data/app/packs/entrypoints/decidim_admin.js +5 -1
  8. data/app/packs/src/decidim/admin/choose_language.js +11 -9
  9. data/app/packs/src/decidim/admin/dynamic_fields.component.js +1 -0
  10. data/app/packs/stylesheets/decidim/admin/modules/_forms.scss +6 -0
  11. data/app/queries/decidim/admin/newsletter_recipients.rb +4 -3
  12. data/app/views/decidim/admin/organization_appearance/form/_colors.html.erb +6 -6
  13. data/app/views/decidim/admin/resource_permissions/edit.html.erb +1 -1
  14. data/config/locales/ar.yml +163 -25
  15. data/config/locales/ca.yml +6 -2
  16. data/config/locales/cs.yml +19 -15
  17. data/config/locales/de.yml +9 -0
  18. data/config/locales/el.yml +0 -1
  19. data/config/locales/en.yml +1 -1
  20. data/config/locales/es-MX.yml +5 -1
  21. data/config/locales/es-PY.yml +5 -1
  22. data/config/locales/es.yml +6 -2
  23. data/config/locales/eu.yml +0 -1
  24. data/config/locales/fi-plain.yml +5 -1
  25. data/config/locales/fi.yml +5 -1
  26. data/config/locales/fr-CA.yml +4 -0
  27. data/config/locales/fr.yml +18 -14
  28. data/config/locales/ga-IE.yml +0 -1
  29. data/config/locales/gl.yml +0 -1
  30. data/config/locales/hu.yml +185 -3
  31. data/config/locales/it.yml +0 -1
  32. data/config/locales/ja.yml +5 -1
  33. data/config/locales/lb.yml +0 -1
  34. data/config/locales/lt.yml +1075 -0
  35. data/config/locales/nl.yml +61 -2
  36. data/config/locales/no.yml +6 -2
  37. data/config/locales/oc-FR.yml +1 -0
  38. data/config/locales/pl.yml +65 -3
  39. data/config/locales/pt-BR.yml +0 -1
  40. data/config/locales/pt.yml +0 -1
  41. data/config/locales/ro-RO.yml +0 -1
  42. data/config/locales/sv.yml +10 -6
  43. data/config/locales/tr-TR.yml +0 -1
  44. data/lib/decidim/admin/version.rb +1 -1
  45. metadata +9 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 838ff353bee24a8f82dec6d06f8c04701ff1d1e07eedb876f682f54a21aa40ca
4
- data.tar.gz: 10c9cce477a7b3ef4bf4647e4d7cba1b501b8a4b4706e0e3d2120c2bacb17965
3
+ metadata.gz: a33b1f86d32bce28471d7e0cae6d58f3f0b8734e8588543b249f0eae9a187707
4
+ data.tar.gz: 5ade51348a77a2ba45c95cb747cdf31ea9f743ce2b36753f102ebd6399fc4789
5
5
  SHA512:
6
- metadata.gz: e920a9e4c8c02d5b9633bbb4c73b0142979c1cfba995002e0334c7fca776b37d406bea56757a1fcc488c7dee8c901499aefda2f9e5e38e15f43b788b2cba8d91
7
- data.tar.gz: 7d1caa9a3dc607071368cf9815847000a5d8a9592853540389805fe902d6171db5676974fda69fd5ff1a808520cb785121bbe111b65e4325bcce706c7cb10ac9
6
+ metadata.gz: 477ee263630fb1af968f73a922d899819908e60faa909e13ed3c585404b9e4c09fe4dd83bf4c458f1ff62a4e7844e6d663e28f32ed64ad9d7475f5ab5632b463
7
+ data.tar.gz: eaae371f50ec70b88bc4805a16157aee750bcc8a1b0edcc924f35ea8b4dd434759d36a33874147402c181bf87c6da60cd231bdf3fc97e2222f38cd53a7968412
@@ -6,7 +6,9 @@ module Decidim
6
6
  layout "decidim/admin/users"
7
7
 
8
8
  def index
9
- @conflicts = Decidim::Verifications::Conflict.all
9
+ @conflicts = Decidim::Verifications::Conflict.joins(:current_user).where(
10
+ decidim_users: { decidim_organization_id: current_organization.id }
11
+ )
10
12
  end
11
13
 
12
14
  def edit
@@ -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
@@ -102,7 +102,7 @@ module Decidim
102
102
  .find_participatory_space_manifest(manifest_name)
103
103
  .participatory_spaces.call(current_organization)
104
104
  .published
105
- .sort_by { |space| [space.closed? ? 1 : 0, space.title[current_locale]] }
105
+ .sort_by { |space| [space.try(:closed?) ? 1 : 0, space.title[current_locale]] }
106
106
  end
107
107
 
108
108
  def spaces_user_can_admin
@@ -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]
@@ -14,7 +14,7 @@ import "jquery.autocomplete"
14
14
  import "jquery-serializejson"
15
15
 
16
16
  import "src/decidim/admin/tab_focus"
17
- import "src/decidim/admin/choose_language"
17
+ import initLanguageChangeSelect from "src/decidim/admin/choose_language"
18
18
  import "src/decidim/admin/application"
19
19
  import "src/decidim/admin/resources_permissions"
20
20
  import "src/decidim/admin/welcome_notification"
@@ -40,3 +40,7 @@ import "entrypoints/decidim_admin.scss";
40
40
 
41
41
  // This needs to be loaded after confirm dialog to bind properly
42
42
  Rails.start()
43
+
44
+ window.addEventListener("DOMContentLoaded", () => {
45
+ initLanguageChangeSelect(document.querySelectorAll("select.language-change"));
46
+ });
@@ -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
  }
@@ -51,11 +51,12 @@ module Decidim
51
51
  @spaces ||= @form.participatory_space_types.map do |type|
52
52
  next if type.ids.blank?
53
53
 
54
- object_class = "Decidim::#{type.manifest_name.classify}"
54
+ object_class = Decidim.participatory_space_registry.find(type.manifest_name).model_class_name.constantize
55
+
55
56
  if type.ids.include?("all")
56
- object_class.constantize.where(organization: @organization)
57
+ object_class.where(organization: @organization)
57
58
  else
58
- object_class.constantize.where(id: type.ids.reject(&:blank?))
59
+ object_class.where(id: type.ids.reject(&:blank?))
59
60
  end
60
61
  end.flatten.compact
61
62
  end
@@ -2,13 +2,13 @@
2
2
  <div class="card-divider">
3
3
  <h2 class="card-title"><%= t ".colors_title" %></h2>
4
4
  </div>
5
- <div class="callout warning">
6
- <p>
7
- <%= icon "warning" %>
8
- <%= t ".colors_warning_html", link: "https://webaim.org/resources/contrastchecker" %>
9
- </p>
10
- </div>
11
5
  <div class="card-section">
6
+ <div class="callout warning">
7
+ <p>
8
+ <%= icon "warning" %>
9
+ <%= t ".colors_warning_html", link: "https://webaim.org/resources/contrastchecker" %>
10
+ </p>
11
+ </div>
12
12
  <div class="organization-colors">
13
13
  <%= form.color_field :primary_color, value: current_organization.colors["primary"] %>
14
14
  <%= form.color_field :secondary_color, value: current_organization.colors["secondary"] %>
@@ -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">