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 +4 -4
- data/app/controllers/decidim/admin/organization_controller.rb +3 -3
- data/app/controllers/decidim/admin/resource_permissions_controller.rb +1 -1
- data/app/helpers/decidim/admin/settings_helper.rb +57 -11
- data/app/packs/entrypoints/decidim_admin.js +5 -1
- data/app/packs/src/decidim/admin/admin_autocomplete.js +6 -2
- data/app/packs/src/decidim/admin/choose_language.js +11 -9
- data/app/packs/src/decidim/admin/dynamic_fields.component.js +1 -0
- data/app/packs/stylesheets/decidim/admin/modules/_forms.scss +6 -0
- data/app/views/decidim/admin/resource_permissions/edit.html.erb +1 -1
- data/config/locales/am-ET.yml +0 -1
- data/config/locales/da.yml +0 -1
- data/config/locales/de.yml +3 -0
- data/config/locales/et.yml +0 -1
- data/config/locales/fr.yml +14 -14
- data/config/locales/hr.yml +0 -1
- data/config/locales/hu.yml +182 -0
- data/config/locales/ko.yml +0 -1
- data/config/locales/lt.yml +149 -0
- data/config/locales/mt.yml +0 -1
- data/config/locales/nl.yml +83 -1
- data/config/locales/no.yml +16 -0
- data/config/locales/om-ET.yml +0 -1
- data/config/locales/pl.yml +2 -2
- data/config/locales/pt-BR.yml +1 -1
- data/config/locales/si-LK.yml +0 -1
- data/config/locales/so-SO.yml +0 -1
- data/config/locales/sw-KE.yml +0 -1
- data/config/locales/ti-ER.yml +0 -1
- data/config/locales/vi.yml +0 -1
- data/config/locales/zh-TW.yml +0 -1
- data/lib/decidim/admin/version.rb +1 -1
- metadata +8 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a5ed15c6f0a16e84e95cb02c129c2b52cb40bccf9c8b90b85c8bc1c7012e1412
         | 
| 4 | 
            +
              data.tar.gz: 46b07fc0bf82a571a725d3f3e8eca721bac6fd37faa09876a17cbaa5a565d36b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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}) | 
| 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
         | 
| @@ -18,16 +18,19 @@ module Decidim | |
| 18 18 | 
             
                    time: :datetime_field
         | 
| 19 19 | 
             
                  }.freeze
         | 
| 20 20 |  | 
| 21 | 
            -
                  #  | 
| 22 | 
            -
                  #  | 
| 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 | 
| 25 | 
            -
                  # attribute  | 
| 26 | 
            -
                  # | 
| 27 | 
            -
                  # name | 
| 28 | 
            -
                  #  | 
| 29 | 
            -
                  #
         | 
| 30 | 
            -
                  #  | 
| 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 | 
            -
                  #  | 
| 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 | 
            -
                  # | 
| 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({ | 
| 50 | 
            -
             | 
| 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 | 
            -
               | 
| 5 | 
            -
                 | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 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 | 
            -
             | 
| 10 | 
            -
             | 
| 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 | 
             
                }
         | 
| @@ -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. | 
| 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">
         | 
    
        data/config/locales/am-ET.yml
    CHANGED
    
    
    
        data/config/locales/da.yml
    CHANGED
    
    
    
        data/config/locales/de.yml
    CHANGED
    
    | @@ -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:
         | 
    
        data/config/locales/et.yml
    CHANGED
    
    
    
        data/config/locales/fr.yml
    CHANGED
    
    | @@ -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' | 
| 215 | 
            -
                      success:  | 
| 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  | 
| 218 | 
            -
                      success:  | 
| 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  | 
| 220 | 
            +
                      title: Modifier le périmètre d'assemblée
         | 
| 221 221 | 
             
                      update: Mettre à jour
         | 
| 222 222 | 
             
                    new:
         | 
| 223 | 
            -
                      create: Créer  | 
| 224 | 
            -
                      title:  | 
| 225 | 
            -
                    no_areas:  | 
| 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  | 
| 228 | 
            -
                      success:  | 
| 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:  | 
| 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:  | 
| 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:  | 
| 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:  | 
| 972 | 
            +
                    scopes: Secteurs
         | 
| 973 973 | 
             
                    static_pages: Pages
         | 
| 974 974 | 
             
                    statistics: Activité
         | 
| 975 975 | 
             
                    user_groups: Groupes d'utilisateurs
         | 
    
        data/config/locales/hr.yml
    CHANGED