diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index cc5a6d00c69d9..4f6416f022576 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -17,14 +17,14 @@ rbenv local 3.2.2 If not, you need to adapt it to your environment. See "2.1. Ruby update to 3.2" -### 2.1. Update your Gemfile +### 1.2. Update your Gemfile ```ruby gem "decidim", github: "decidim/decidim" gem "decidim-dev", github: "decidim/decidim" ``` -### 2.2. Run these commands +### 1.3. Run these commands ```console bundle update decidim @@ -32,7 +32,7 @@ bin/rails decidim:upgrade bin/rails db:migrate ``` -### 2.3. Follow the steps and commands detailed in these notes +### 1.4. Follow the steps and commands detailed in these notes ## 2. General notes @@ -47,6 +47,12 @@ We have updated the Rails version to 7.0.8.1. You do not need to do anything. You can read more about this change on PR [#12616](https://github.com/decidim/decidim/pull/12616). +## 2.3. Removal of the accountability naming customization + +We have removed the ability to customize the labels from the Accountability component, as it was not following the recommended way of handling these text customizations. If you want to migrate your current customizations, you can read about [Text customizations in Decidim Documentation](https://docs.decidim.org/en/develop/customize/texts) + +You can read more about this change on PR [#12853](https://github.com/decidim/decidim/pull/12853). + ## 3. One time actions These are one time actions that need to be done after the code is updated in the production database. @@ -181,7 +187,41 @@ You can read more about this change on PR [\#XXXX](https://github.com/decidim/de ## 5. Changes in APIs -### 5.1. [[TITLE OF THE CHANGE]] +### 5.1 Migration of Proposal states in own table + +As of [\#12052](https://github.com/decidim/decidim/pull/12052) all the proposals states are kept in a separate database table, enabling end users to customize the states of the proposals. By default we will create for any proposal component that is being installed in the project 5 default states that cannot be disabled nor deleted. These states are: + +- Not Answered ( default state for any new created proposal ) +- Evaluating +- Accepted +- Rejected +- Withdrawn ( special states for proposals that have been withdrawn by the author ) + +For any of the above states you can customize the name, description, css class used by labels. You can also decide which states the user can receive a notification or an answer. + +You do not need to run any task to migrate the existing states, as we will automatically migrate the existing states to the new table. + +You can see more details about this change on PR [\#12052](https://github.com/decidim/decidim/pull/12052) + +### 5.2. Seeds require assets precompiling + +In order to successfully showcase the features of the application, we have added as a mandatory step the assets precompiling, as the seeds will now fire the notification system. That allows any Decidim demo instance to display user notifications. + +if you previously seeded your database using: + +```bash +bin/rails db:drop db:create db:migrate db:seed +``` + +You are required to run using: + +```bash +bin/rails db:drop db:create db:migrate assets:precompile db:seed +``` + +You can see more details about this change on PR [\#12828](https://github.com/decidim/decidim/pull/12828) + +### 5.3. [[TITLE OF THE CHANGE]] In order to [[REASONING (e.g. improve the maintenance of the code base)]] we have changed... @@ -198,19 +238,3 @@ You need to change it to: # Explain the usage of the API as it is in the new version result = 1 + 1 if after ``` - -### 5.8 Migration of Proposal states in own table - -As of [\#12052](https://github.com/decidim/decidim/pull/12052) all the proposals states are kept in a separate database table, enabling end users to customize the states of the proposals. By default we will create for any proposal component that is being installed in the project 5 default states that cannot be disabled nor deleted. These states are: - -- Not Answered ( default state for any new created proposal ) -- Evaluating -- Accepted -- Rejected -- Withdrawn ( special states for proposals that have been withdrawn by the author ) - -For any of the above states you can customize the name, description, css class used by labels. You can also decide which states the user can receive a notification or an answer. - -You do not need to run any task to migrate the existing states, as we will automatically migrate the existing states to the new table. - -You can see more details about this change on PR [\#12052](https://github.com/decidim/decidim/pull/12052) diff --git a/decidim-accountability/app/cells/decidim/accountability/status_cell.rb b/decidim-accountability/app/cells/decidim/accountability/status_cell.rb index cd787ac1153af..6d9caaddab06a 100644 --- a/decidim-accountability/app/cells/decidim/accountability/status_cell.rb +++ b/decidim-accountability/app/cells/decidim/accountability/status_cell.rb @@ -75,12 +75,7 @@ def display_count(count) end def heading_parent_level_results(count) - text = translated_attribute(component_settings.heading_parent_level_results).presence - if text - pluralize(count, text) - else - t("results.count.results_count", scope: "decidim.accountability", count:) - end + t("results.count.results_count", scope: "decidim.accountability", count:) end def render_count diff --git a/decidim-accountability/app/events/decidim/accountability/base_result_event.rb b/decidim-accountability/app/events/decidim/accountability/base_result_event.rb index 3f14f856b3e0d..083d3c9f6e039 100644 --- a/decidim-accountability/app/events/decidim/accountability/base_result_event.rb +++ b/decidim-accountability/app/events/decidim/accountability/base_result_event.rb @@ -20,6 +20,10 @@ def proposal_path def proposal @proposal ||= resource.linked_resources(:proposals, "included_proposals").find_by(id: extra[:proposal_id]) end + + def hidden_resource? + super || (proposal.respond_to?(:hidden?) && proposal.hidden?) + end end end end diff --git a/decidim-accountability/app/helpers/decidim/accountability/application_helper.rb b/decidim-accountability/app/helpers/decidim/accountability/application_helper.rb index 74ee3c065d1ed..bb12d9f4c51a2 100644 --- a/decidim-accountability/app/helpers/decidim/accountability/application_helper.rb +++ b/decidim-accountability/app/helpers/decidim/accountability/application_helper.rb @@ -18,14 +18,6 @@ def component_name (defined?(current_component) && translated_attribute(current_component&.name).presence) || t("decidim.components.accountability.name") end - def categories_label - translated_attribute(component_settings.categories_label).presence || t("results.home.categories_label", scope: "decidim.accountability") - end - - def subcategories_label - translated_attribute(component_settings.subcategories_label).presence || t("results.home.subcategories_label", scope: "decidim.accountability") - end - def filter_items_for(participatory_space:, category:) [ { diff --git a/decidim-accountability/app/views/decidim/accountability/results/_home_categories.html.erb b/decidim-accountability/app/views/decidim/accountability/results/_home_categories.html.erb index f8af1c6a87702..b5938eaf01a43 100644 --- a/decidim-accountability/app/views/decidim/accountability/results/_home_categories.html.erb +++ b/decidim-accountability/app/views/decidim/accountability/results/_home_categories.html.erb @@ -9,12 +9,12 @@ ) %>
- <%= categories_label %> + <%= t("results.home.categories_label", scope: "decidim.accountability") %> <%= subelements.call %>
- <%= subcategories_label %> + <%= t("results.home.subcategories_label", scope: "decidim.accountability") %> <% if subelements.has_results? %>
<% category.subcategories.each do |subcategory| %> diff --git a/decidim-accountability/app/views/decidim/accountability/results/_scope_filters.html.erb b/decidim-accountability/app/views/decidim/accountability/results/_scope_filters.html.erb index 829adb5f9e045..56e0745f601be 100644 --- a/decidim-accountability/app/views/decidim/accountability/results/_scope_filters.html.erb +++ b/decidim-accountability/app/views/decidim/accountability/results/_scope_filters.html.erb @@ -4,7 +4,7 @@ <% if current_component.has_subscopes? %>
- -
diff --git a/decidim-core/app/cells/decidim/report_button/flag_modal.erb b/decidim-core/app/cells/decidim/report_button/flag_modal.erb index b7d1b981b5c81..5dff59d7d98ed 100644 --- a/decidim-core/app/cells/decidim/report_button/flag_modal.erb +++ b/decidim-core/app/cells/decidim/report_button/flag_modal.erb @@ -10,7 +10,7 @@ <%= f.collection_radio_buttons :reason, [ [:spam, t("decidim.shared.flag_modal.spam")], [:offensive, t("decidim.shared.flag_modal.offensive")], - [:does_not_belong, t("decidim.shared.flag_modal.does_not_belong", organization_name: current_organization.name)] + [:does_not_belong, t("decidim.shared.flag_modal.does_not_belong", organization_name: current_organization_name)] ], :first, :last do |builder| builder.label(for: nil, class: "form__wrapper-checkbox-label") { builder.radio_button(id: nil) + builder.text } end %> diff --git a/decidim-core/app/cells/decidim/resource_types_filter/show.erb b/decidim-core/app/cells/decidim/resource_types_filter/show.erb index 00ecf6580f8e7..24b5042263b37 100644 --- a/decidim-core/app/cells/decidim/resource_types_filter/show.erb +++ b/decidim-core/app/cells/decidim/resource_types_filter/show.erb @@ -1,5 +1,5 @@
- - <%= filter_form_for filter, form_path, class: "new_filter", id: "dropdown-menu-resource" do |form| %> + <%= filter_form_for filter, form_path, :class => "new_filter", :id => "dropdown-menu-resource", "aria-hidden" => true do |form| %> <%= form.collection_radio_buttons( filter_param_key, resource_types, diff --git a/decidim-core/app/controllers/concerns/decidim/payload_info.rb b/decidim-core/app/controllers/concerns/decidim/payload_info.rb index c9adfac3fe518..cdb768b5149bf 100644 --- a/decidim-core/app/controllers/concerns/decidim/payload_info.rb +++ b/decidim-core/app/controllers/concerns/decidim/payload_info.rb @@ -5,13 +5,14 @@ module Decidim module PayloadInfo extend ActiveSupport::Concern + include Decidim::TranslatableAttributes included do def append_info_to_payload(payload) super payload[:user_id] = try(:current_user).try(:id) payload[:organization_id] = try(:current_organization).try(:id) - payload[:app] = try(:current_organization).try(:name) + payload[:app] = translated_attribute(try(:current_organization).try(:name)) payload[:remote_ip] = request.remote_ip payload[:referer] = request.referer.to_s payload[:request_id] = request.uuid diff --git a/decidim-core/app/controllers/decidim/links_controller.rb b/decidim-core/app/controllers/decidim/links_controller.rb index 90b0331c38d4a..79dac5f528094 100644 --- a/decidim-core/app/controllers/decidim/links_controller.rb +++ b/decidim-core/app/controllers/decidim/links_controller.rb @@ -37,7 +37,19 @@ def parse_url end def external_url - @external_url ||= URI.parse(URI::Parser.new.escape(params[:external_url])) + @external_url ||= URI.parse(escape_url(params[:external_url])) + end + + def escape_url(external_url) + before_fragment, fragment = external_url.split("#", 2) + escaped_before_fragment = URI::Parser.new.escape(before_fragment) + + if fragment + escaped_fragment = URI::Parser.new.escape(fragment) + "#{escaped_before_fragment}##{escaped_fragment}" + else + escaped_before_fragment + end end end end diff --git a/decidim-core/app/events/decidim/welcome_notification_event.rb b/decidim-core/app/events/decidim/welcome_notification_event.rb index b5ee5994955ba..42188a17eb2cd 100644 --- a/decidim-core/app/events/decidim/welcome_notification_event.rb +++ b/decidim-core/app/events/decidim/welcome_notification_event.rb @@ -44,7 +44,7 @@ def resource_title def interpolate(template) template .gsub("{{name}}", user.name) - .gsub("{{organization}}", organization.name) + .gsub("{{organization}}", organization_name(organization)) .gsub("{{help_url}}", url_helpers.pages_url(host: organization.host)) .gsub("{{badges_url}}", url_helpers.gamification_badges_url(host: organization.host)) .html_safe diff --git a/decidim-core/app/helpers/decidim/layout_helper.rb b/decidim-core/app/helpers/decidim/layout_helper.rb index 458e494f62657..52c3262571ef7 100644 --- a/decidim-core/app/helpers/decidim/layout_helper.rb +++ b/decidim-core/app/helpers/decidim/layout_helper.rb @@ -3,6 +3,7 @@ module Decidim # View helpers related to the layout. module LayoutHelper + include Decidim::OrganizationHelper include Decidim::ModalHelper include Decidim::TooltipHelper @@ -129,28 +130,6 @@ def extended_navigation_bar(items, max_items: 5) } end - # Renders a view with the customizable CSS variables in two flavours: - # 1. as a hexadecimal valid CSS color (ie: #ff0000) - # 2. as a disassembled RGB components (ie: 255 0 0) - # - # Example: - # - # --primary: #ff0000; - # --primary-rgb: 255 0 0 - # - # Hexadecimal variables can be used as a normal CSS color: - # - # color: var(--primary) - # - # While the disassembled variant can be used where you need to manipulate - # the color somehow (ie: adding a background transparency): - # - # background-color: rgba(var(--primary-rgb), 0.5) - def organization_colors - css = current_organization.colors.each.map { |k, v| "--#{k}: #{v};--#{k}-rgb: #{v[1..2].hex} #{v[3..4].hex} #{v[5..6].hex};" }.join - render partial: "layouts/decidim/organization_colors", locals: { css: } - end - def current_user_unread_data return {} if current_user.blank? @@ -161,22 +140,8 @@ def current_user_unread_data end end - def organization_description_label - @organization_description_label ||= if empty_organization_description? - t("decidim.pages.home.footer_sub_hero.footer_sub_hero_body_html") - else - decidim_sanitize_admin(translated_attribute(current_organization.description)) - end - end - private - def empty_organization_description? - organization_description = translated_attribute(current_organization.description) - - organization_description.blank? || organization_description == "

" - end - def tag_builder @tag_builder ||= ActionView::Helpers::TagHelper::TagBuilder.new(self) end diff --git a/decidim-core/app/helpers/decidim/organization_helper.rb b/decidim-core/app/helpers/decidim/organization_helper.rb new file mode 100644 index 0000000000000..722929c0eb703 --- /dev/null +++ b/decidim-core/app/helpers/decidim/organization_helper.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module Decidim + # View helpers related to the organization. + + module OrganizationHelper + include Decidim::TranslatableAttributes + + # Renders a view with the customizable CSS variables in two flavours: + # 1. as a hexadecimal valid CSS color (ie: #ff0000) + # 2. as a disassembled RGB components (ie: 255 0 0) + # + # Example: + # + # --primary: #ff0000; + # --primary-rgb: 255 0 0 + # + # Hexadecimal variables can be used as a normal CSS color: + # + # color: var(--primary) + # + # While the disassembled variant can be used where you need to manipulate + # the color somehow (ie: adding a background transparency): + # + # background-color: rgba(var(--primary-rgb), 0.5) + def organization_colors + css = current_organization.colors.each.map { |k, v| "--#{k}: #{v};--#{k}-rgb: #{v[1..2].hex} #{v[3..4].hex} #{v[5..6].hex};" }.join + render partial: "layouts/decidim/organization_colors", locals: { css: } + end + + def organization_description_label + @organization_description_label ||= if empty_organization_description? + t("decidim.pages.home.footer_sub_hero.footer_sub_hero_body_html") + else + decidim_sanitize_admin(translated_attribute(current_organization.description)) + end + end + + def organization_name(organization = current_organization) + translated_attribute(organization.name, organization) + end + + def current_organization_name + organization_name(current_organization) + end + + private + + def empty_organization_description? + organization_description = translated_attribute(current_organization.description) + + organization_description.blank? || organization_description == "

" + end + end +end diff --git a/decidim-core/app/mailers/decidim/application_mailer.rb b/decidim-core/app/mailers/decidim/application_mailer.rb index f334811eec2a3..3a6c5cc79adcd 100644 --- a/decidim-core/app/mailers/decidim/application_mailer.rb +++ b/decidim-core/app/mailers/decidim/application_mailer.rb @@ -6,6 +6,10 @@ module Decidim class ApplicationMailer < ActionMailer::Base include LocalisedMailer include MultitenantAssetHost + include Decidim::SanitizeHelper + include Decidim::OrganizationHelper + helper_method :organization_name, :decidim_escape_translated, :decidim_sanitize_translated, :translated_attribute, :decidim_sanitize, :decidim_sanitize_newsletter + after_action :set_smtp after_action :set_from @@ -44,11 +48,11 @@ def sender smtp_settings_from = organization.smtp_settings["from"] return smtp_settings_from if already_defined_name_in_mail?(smtp_settings_from) - email_address_with_name(smtp_settings_from, organization.name) + email_address_with_name(smtp_settings_from, organization_name(organization)) end def default_sender - email_address_with_name(Decidim.config.mailer_sender, organization.name) + email_address_with_name(Decidim.config.mailer_sender, organization_name(organization)) end def already_defined_name_in_mail?(mail_address) diff --git a/decidim-core/app/mailers/decidim/block_user_mailer.rb b/decidim-core/app/mailers/decidim/block_user_mailer.rb index 5591246e03b0c..142d367a87781 100644 --- a/decidim-core/app/mailers/decidim/block_user_mailer.rb +++ b/decidim-core/app/mailers/decidim/block_user_mailer.rb @@ -11,7 +11,7 @@ def notify(user, justification) @justification = justification subject = I18n.t( "decidim.block_user_mailer.notify.subject", - organization_name: @organization.name, + organization_name: organization_name(@organization), justification: @justification ) diff --git a/decidim-core/app/mailers/decidim/decidim_devise_mailer.rb b/decidim-core/app/mailers/decidim/decidim_devise_mailer.rb index fcbd26a9401c5..48e04822f3842 100644 --- a/decidim-core/app/mailers/decidim/decidim_devise_mailer.rb +++ b/decidim-core/app/mailers/decidim/decidim_devise_mailer.rb @@ -5,6 +5,8 @@ module Decidim # each role and use a localised version. class DecidimDeviseMailer < ::Devise::Mailer include LocalisedMailer + include Decidim::SanitizeHelper + helper_method :decidim_escape_translated, :decidim_sanitize_translated, :translated_attribute layout "decidim/mailer" @@ -19,7 +21,11 @@ def invitation_instructions(user, token, opts = {}) @organization = user.organization @opts = opts - opts[:subject] = I18n.t("devise.mailer.#{opts[:invitation_instructions]}.subject", organization: user.organization.name) if opts[:invitation_instructions] + if opts[:invitation_instructions] + opts[:subject] = + I18n.t("devise.mailer.#{opts[:invitation_instructions]}.subject", + organization: organization_name(user.organization)) + end end devise_mail(user, opts[:invitation_instructions] || :invitation_instructions, opts) diff --git a/decidim-core/app/mailers/decidim/newsletter_mailer.rb b/decidim-core/app/mailers/decidim/newsletter_mailer.rb index cee715ed79a16..72b8ca59450ac 100644 --- a/decidim-core/app/mailers/decidim/newsletter_mailer.rb +++ b/decidim-core/app/mailers/decidim/newsletter_mailer.rb @@ -2,9 +2,6 @@ module Decidim class NewsletterMailer < ApplicationMailer - helper Decidim::SanitizeHelper - helper Decidim::TranslationsHelper - include Decidim::NewslettersHelper layout "decidim/newsletter_base" diff --git a/decidim-core/app/mailers/decidim/newsletters_opt_in_mailer.rb b/decidim-core/app/mailers/decidim/newsletters_opt_in_mailer.rb index 81e2e65733bb1..e5e0020c0be7b 100644 --- a/decidim-core/app/mailers/decidim/newsletters_opt_in_mailer.rb +++ b/decidim-core/app/mailers/decidim/newsletters_opt_in_mailer.rb @@ -10,7 +10,7 @@ def notify(user, token) @organization = user.organization @token = token - mail(to: user.email, subject: I18n.t("decidim.newsletters_opt_in_mailer.notify.subject", organization_name: @organization.name)) + mail(to: user.email, subject: I18n.t("decidim.newsletters_opt_in_mailer.notify.subject", organization_name: organization_name(@organization))) end end end diff --git a/decidim-core/app/mailers/decidim/notification_mailer.rb b/decidim-core/app/mailers/decidim/notification_mailer.rb index c9060132614fa..c744280fcf075 100644 --- a/decidim-core/app/mailers/decidim/notification_mailer.rb +++ b/decidim-core/app/mailers/decidim/notification_mailer.rb @@ -5,7 +5,6 @@ module Decidim # a events are received. class NotificationMailer < Decidim::ApplicationMailer helper Decidim::ResourceHelper - helper Decidim::SanitizeHelper def event_received(event, event_class_name, resource, user, user_role, extra) # rubocop:disable Metrics/ParameterLists with_user(user) do diff --git a/decidim-core/app/mailers/decidim/notifications_digest_mailer.rb b/decidim-core/app/mailers/decidim/notifications_digest_mailer.rb index 53d14210b6df5..62c5b6792fe57 100644 --- a/decidim-core/app/mailers/decidim/notifications_digest_mailer.rb +++ b/decidim-core/app/mailers/decidim/notifications_digest_mailer.rb @@ -5,7 +5,6 @@ module Decidim # a events are received. class NotificationsDigestMailer < Decidim::ApplicationMailer helper Decidim::ResourceHelper - helper Decidim::SanitizeHelper SIZE_LIMIT = 10 def digest_mail(user, notification_ids) diff --git a/decidim-core/app/mailers/decidim/reported_mailer.rb b/decidim-core/app/mailers/decidim/reported_mailer.rb index 5bb27a75ca0a7..d3aaa937395fd 100644 --- a/decidim-core/app/mailers/decidim/reported_mailer.rb +++ b/decidim-core/app/mailers/decidim/reported_mailer.rb @@ -4,7 +4,6 @@ module Decidim # A custom mailer for sending notifications to an admin when a report is created. class ReportedMailer < Decidim::ApplicationMailer helper Decidim::ResourceHelper - helper Decidim::TranslationsHelper helper_method :reported_content_url, :report_url, :manage_moderations_url, :author_profile_url, :reported_content_cell diff --git a/decidim-core/app/mailers/decidim/user_report_mailer.rb b/decidim-core/app/mailers/decidim/user_report_mailer.rb index 59377fb899834..c2334aecc0e08 100644 --- a/decidim-core/app/mailers/decidim/user_report_mailer.rb +++ b/decidim-core/app/mailers/decidim/user_report_mailer.rb @@ -11,7 +11,7 @@ def notify(admin, report) with_user(admin) do mail(to: admin.email, subject: I18n.t( "decidim.user_report_mailer.notify.subject", - organization_name: report.moderation.user.organization.name, + organization_name: organization_name(report.moderation.user.organization), reason: @report.reason )) end diff --git a/decidim-core/app/models/decidim/organization.rb b/decidim-core/app/models/decidim/organization.rb index 893eb956a7d63..9215737ddf4ef 100644 --- a/decidim-core/app/models/decidim/organization.rb +++ b/decidim-core/app/models/decidim/organization.rb @@ -15,7 +15,7 @@ class Organization < ApplicationRecord SOCIAL_HANDLERS = [:twitter, :facebook, :instagram, :youtube, :github].freeze AVAILABLE_MACHINE_TRANSLATION_DISPLAY_PRIORITIES = %w(original translation).freeze - translatable_fields :description, :cta_button_text, :omnipresent_banner_title, :omnipresent_banner_short_description, + translatable_fields :name, :description, :cta_button_text, :omnipresent_banner_title, :omnipresent_banner_short_description, :highlighted_content_banner_title, :highlighted_content_banner_short_description, :highlighted_content_banner_action_title, :highlighted_content_banner_action_subtitle, :welcome_notification_subject, :welcome_notification_body, :id_documents_explanation_text, :admin_terms_of_service_body @@ -41,7 +41,7 @@ class Organization < ApplicationRecord # disable: Users cannot register or sign in. enum users_registration_mode: [:enabled, :existing, :disabled], _prefix: true - validates :name, :host, uniqueness: true + validates :host, uniqueness: true validates :reference_prefix, presence: true validates :time_zone, presence: true, time_zone: true validates :default_locale, inclusion: { in: :available_locales } @@ -60,6 +60,27 @@ class Organization < ApplicationRecord has_one_attached :open_data_file + validate :unique_name + + def unique_name + base_query = new_record? ? Decidim::Organization.all : Decidim::Organization.where.not(id:).all + + organization_names = [] + + base_query.pluck(:name).each do |value| + organization_names += value.except("machine_translations").values + organization_names += value.fetch("machine_translations", {}).values + end + + organization_names = organization_names.map(&:downcase).compact_blank + + name.each do |language, value| + next if value.is_a?(Hash) + + errors.add("name_#{language}", :taken) if organization_names.include?(value.downcase) + end + end + def self.log_presenter_class_for(_log) Decidim::AdminLog::OrganizationPresenter end diff --git a/decidim-core/app/packs/src/decidim/a11y.js b/decidim-core/app/packs/src/decidim/a11y.js index e78d7aa0ffec2..be8abfaa961dd 100644 --- a/decidim-core/app/packs/src/decidim/a11y.js +++ b/decidim-core/app/packs/src/decidim/a11y.js @@ -104,6 +104,20 @@ const createDropdown = (component) => { }); } + // Disable focus on children elements so we can pass the AXE accessibility tests + const dropdownMenu = document.getElementById(dropdownOptions.dropdown); + if (dropdownMenu.getAttribute("aria-hidden") === "true") { + dropdownMenu. + querySelectorAll("a, input, button"). + forEach((element) => { element.tabIndex = -1 }) + } + + component.addEventListener("click", () => { + dropdownMenu. + querySelectorAll("a, input, button"). + forEach((element) => { element.tabIndex = 0 }) + }) + Dropdowns.render(component.id, dropdownOptions); } diff --git a/decidim-core/app/presenters/decidim/organization_presenter.rb b/decidim-core/app/presenters/decidim/organization_presenter.rb index fd275dd3bd93a..1b542a8afdb70 100644 --- a/decidim-core/app/presenters/decidim/organization_presenter.rb +++ b/decidim-core/app/presenters/decidim/organization_presenter.rb @@ -4,7 +4,7 @@ module Decidim # A general presenter to render organization logic to build a manifest class OrganizationPresenter < SimpleDelegator def html_name - name.html_safe + translated_attribute(name).html_safe end def translated_description diff --git a/decidim-core/app/views/decidim/block_user_mailer/notify.html.erb b/decidim-core/app/views/decidim/block_user_mailer/notify.html.erb index 230a4e9b5ad18..ed0ec06fb7207 100644 --- a/decidim-core/app/views/decidim/block_user_mailer/notify.html.erb +++ b/decidim-core/app/views/decidim/block_user_mailer/notify.html.erb @@ -1,7 +1,7 @@ - + - + diff --git a/decidim-core/app/views/decidim/devise/invitations/edit.html.erb b/decidim-core/app/views/decidim/devise/invitations/edit.html.erb index 265b15674a805..37b3ddad15556 100644 --- a/decidim-core/app/views/decidim/devise/invitations/edit.html.erb +++ b/decidim-core/app/views/decidim/devise/invitations/edit.html.erb @@ -14,7 +14,7 @@
<%= f.hidden_field :invitation_token %> - <%= f.text_field :nickname, help_text: t("devise.invitations.edit.nickname_help", organization: current_organization.name), required: "required", autocomplete: "nickname" %> + <%= f.text_field :nickname, help_text: t("devise.invitations.edit.nickname_help", organization: current_organization_name), required: "required", autocomplete: "nickname" %> <% if f.object.class.require_password_on_accepting %> <%= render partial: "decidim/account/password_fields", locals: { form: f, user: :user } %> diff --git a/decidim-core/app/views/decidim/devise/omniauth_registrations/new.html.erb b/decidim-core/app/views/decidim/devise/omniauth_registrations/new.html.erb index d70f83672100f..9565e5089ecd9 100644 --- a/decidim-core/app/views/decidim/devise/omniauth_registrations/new.html.erb +++ b/decidim-core/app/views/decidim/devise/omniauth_registrations/new.html.erb @@ -18,7 +18,7 @@
<%= f.text_field :name, help_text: t("decidim.devise.omniauth_registrations.new.username_help"), autocomplete: "name", placeholder: "John Doe" %> - <%= f.text_field :nickname, help_text: t("decidim.devise.omniauth_registrations.new.nickname_help", organization: current_organization.name), autocomplete: "nickname", placeholder: "johndoe" %> + <%= f.text_field :nickname, help_text: t("decidim.devise.omniauth_registrations.new.nickname_help", organization: current_organization_name), autocomplete: "nickname", placeholder: "johndoe" %> <%= f.email_field :email, autocomplete: "email", placeholder: t("placeholder_email", scope: "decidim.devise.shared") %> diff --git a/decidim-core/app/views/decidim/doorkeeper/authorizations/new.html.erb b/decidim-core/app/views/decidim/doorkeeper/authorizations/new.html.erb index 5b95a35da23af..c1acab5045da7 100644 --- a/decidim-core/app/views/decidim/doorkeeper/authorizations/new.html.erb +++ b/decidim-core/app/views/decidim/doorkeeper/authorizations/new.html.erb @@ -8,7 +8,7 @@