diff --git a/.erb-lint.yml b/.erb-lint.yml index af4b9ee7a14f..9c0b1a2e6570 100644 --- a/.erb-lint.yml +++ b/.erb-lint.yml @@ -170,6 +170,7 @@ linters: - budget-list__item - budget-list__item-cell - budget-list__number + - budget-list__number-show-for-medium - budget-list__text - budget-list__title - budget-progress--fixed @@ -1585,9 +1586,10 @@ linters: - show-8 - show-9 - show-comment-replies - - show-for-dark-mode - show-for-ie + - show-for-dark-mode - show-for-landscape + - show-for-large - show-for-large-only - show-for-medium - show-for-medium-only @@ -1892,6 +1894,7 @@ linters: - timeline__phase - timeline__phase__number - timeline__title + - tiny - title-action - title-action__action - title-action__title diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md index 3b9bb0c10f9a..ca3fd9a8b7cf 100644 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -8,7 +8,7 @@ We have disabled the feature request's issue creation on this repository. If you * [Feature Request](https://meta.decidim.org/processes/roadmap) -We are doing this because we are trying to eat our own dog food. Once your proposal is collaboratively reviewed and accepted by the Product Comitee, we will create the new issue on GitHub and notify you through Metadecidim. +We are doing this because we are trying to eat our own dog food. Once your proposal is collaboratively reviewed and accepted by the Product Committee, we will create the new issue on GitHub and notify you through Metadecidim. Thanks for contributing to Decidim! diff --git a/Gemfile.lock b/Gemfile.lock index ad2f5f0dfff9..3191b3ed6c97 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -83,6 +83,7 @@ PATH mime-types (>= 1.16, < 4.0) mini_magick (~> 4.9) net-smtp (~> 0.3.1) + nokogiri (~> 1.16, >= 1.16.2) omniauth (~> 2.0) omniauth-facebook (~> 5.0) omniauth-google-oauth2 (~> 1.0) @@ -121,7 +122,7 @@ PATH factory_bot_rails (~> 6.2) faker (~> 3.2) i18n-tasks (~> 1.0) - nokogiri (~> 1.14, >= 1.14.3) + nokogiri (~> 1.16, >= 1.16.2) parallel_tests (~> 4.2) puma (~> 6.2, >= 6.3.1) rails-controller-testing (~> 1.0) @@ -169,7 +170,7 @@ PATH decidim-proposals (0.29.0.dev) decidim-comments (= 0.29.0.dev) decidim-core (= 0.29.0.dev) - doc2text (~> 0.4.6) + doc2text (~> 0.4.7) redcarpet (~> 3.5, >= 3.5.1) decidim-sortitions (0.29.0.dev) decidim-admin (= 0.29.0.dev) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 774d004244e8..1ac565a885a6 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -106,7 +106,17 @@ In case you have modifications in your application's webpack configuration, adap You can read more about this change on PR [\#12238](https://github.com/decidim/decidim/pull/12238). -### 3.4. [[TITLE OF THE ACTION]] +### 3.4. Allow removal of orphan categories + +A bug was identified that prevented the deletion of categories lacking associated resources. This action is a one-time task that must be performed directly in the production database. + +```console +bin/rails decidim:upgrade:fix_orphan_categorizations +``` + +You can read more about this change on PR [\#12143](https://github.com/decidim/decidim/pull/12143). + +### 3.5. [[TITLE OF THE ACTION]] You can read more about this change on PR [\#XXXX](https://github.com/decidim/decidim/pull/XXXX). diff --git a/decidim-accountability/app/cells/decidim/accountability/project_cell.rb b/decidim-accountability/app/cells/decidim/accountability/project_cell.rb index 566a120b4c2d..a1c9b61a3b10 100644 --- a/decidim-accountability/app/cells/decidim/accountability/project_cell.rb +++ b/decidim-accountability/app/cells/decidim/accountability/project_cell.rb @@ -18,11 +18,11 @@ def show private def title - translated_attribute result.title + decidim_escape_translated result.title end def description - translated_attribute(result.description).html_safe + decidim_sanitize_admin translated_attribute(result.description) end def scope diff --git a/decidim-accountability/app/cells/decidim/accountability/result_metadata_cell.rb b/decidim-accountability/app/cells/decidim/accountability/result_metadata_cell.rb index e1a3658501b1..8c31ad3130c6 100644 --- a/decidim-accountability/app/cells/decidim/accountability/result_metadata_cell.rb +++ b/decidim-accountability/app/cells/decidim/accountability/result_metadata_cell.rb @@ -69,7 +69,7 @@ def status_item_compact return if status.blank? { - text: translated_attribute(status.name), + text: decidim_escape_translated(status.name), icon: "focus-2-line" } end @@ -108,12 +108,12 @@ def status_item { text: t("models.result.fields.status", scope: "decidim.accountability"), icon: "focus-2-line", - value: translated_attribute(status.name) + value: decidim_escape_translated(status.name) } end def status_description - return unless status.present? && (description = translated_attribute(status.description)).present? + return unless status.present? && (description = decidim_escape_translated(status.description)).present? { text: t("models.status.fields.description", scope: "decidim.accountability"), diff --git a/decidim-accountability/app/models/decidim/accountability/result.rb b/decidim-accountability/app/models/decidim/accountability/result.rb index 52745230d352..3bdac690ce3f 100644 --- a/decidim-accountability/app/models/decidim/accountability/result.rb +++ b/decidim-accountability/app/models/decidim/accountability/result.rb @@ -56,7 +56,7 @@ def update_parent_progress end # Public: There are two ways to update parent's progress: - # - using weights, in which case each progress is multiplied by the weigth and them summed + # - using weights, in which case each progress is multiplied by the weight and them summed # - not using weights, and using the average of progress of each children def update_progress! self.progress = if children_use_weighted_progress? diff --git a/decidim-accountability/app/views/decidim/accountability/admin/statuses/index.html.erb b/decidim-accountability/app/views/decidim/accountability/admin/statuses/index.html.erb index 2e76084f38c6..44a2488f0e0b 100644 --- a/decidim-accountability/app/views/decidim/accountability/admin/statuses/index.html.erb +++ b/decidim-accountability/app/views/decidim/accountability/admin/statuses/index.html.erb @@ -22,7 +22,7 @@
", "
") { generate_localized_title }, - categories_label: Decidim::Faker::Localized.word, - subcategories_label: Decidim::Faker::Localized.word, - heading_parent_level_results: Decidim::Faker::Localized.word, - heading_leaf_level_results: Decidim::Faker::Localized.word, + intro: generate_localized_description(:accountability_component_intro, skip_injection:), + categories_label: generate_localized_word(:accountability_component_categories_label, skip_injection:), + subcategories_label: generate_localized_word(:accountability_component_subcategories_label, skip_injection:), + heading_parent_level_results: generate_localized_word(:accountability_component_heading_parent_level_results, skip_injection:), + heading_leaf_level_results: generate_localized_word(:accountability_component_heading_leaf_level_results, skip_injection:), scopes_enabled: true, scope_id: participatory_space.scope&.id } @@ -26,27 +29,36 @@ end factory :status, class: "Decidim::Accountability::Status" do - component { create(:accountability_component) } + transient do + skip_injection { false } + end + component { create(:accountability_component, skip_injection:) } sequence(:key) { |n| "status_#{n}" } - name { Decidim::Faker::Localized.word } - description { generate_localized_title } + name { generate_localized_word(:status_name, skip_injection:) } + description { generate_localized_word(:status_description, skip_injection:) } progress { rand(1..100) } end factory :result, class: "Decidim::Accountability::Result" do - component { create(:accountability_component) } - title { generate_localized_title } - description { Decidim::Faker::Localized.wrapped("", "
") { generate_localized_title } } + transient do + skip_injection { false } + end + component { create(:accountability_component, skip_injection:) } + title { generate_localized_title(:result_title, skip_injection:) } + description { generate_localized_description(:result_description, skip_injection:) } start_date { "12/7/2017" } end_date { "30/9/2017" } - status { create :status, component: } + status { create :status, component:, skip_injection: } progress { rand(1..100) } end factory :timeline_entry, class: "Decidim::Accountability::TimelineEntry" do - result { create(:result) } + transient do + skip_injection { false } + end + result { create(:result, skip_injection:) } entry_date { "12/7/2017" } - title { generate_localized_title } - description { generate_localized_title } + title { generate_localized_title(:timeline_entry_title, skip_injection:) } + description { generate_localized_title(:timeline_entry_description, skip_injection:) } end end diff --git a/decidim-accountability/spec/events/decidim/accountability/proposal_linked_event_spec.rb b/decidim-accountability/spec/events/decidim/accountability/proposal_linked_event_spec.rb index 16c52d8baaba..85b572c6d032 100644 --- a/decidim-accountability/spec/events/decidim/accountability/proposal_linked_event_spec.rb +++ b/decidim-accountability/spec/events/decidim/accountability/proposal_linked_event_spec.rb @@ -10,7 +10,7 @@ let(:proposal_component) do create(:component, manifest_name: "proposals", participatory_space: resource.component.participatory_space) end - let(:proposal) { create(:proposal, component: proposal_component, title: generate_localized_title(:proposal_title)) } + let(:proposal) { create(:proposal, component: proposal_component) } let(:extra) { { proposal_id: proposal.id } } let(:proposal_path) { resource_locator(proposal).path } let(:proposal_title) { decidim_sanitize_translated(proposal.title) } diff --git a/decidim-accountability/spec/events/decidim/accountability/result_progress_updated_event_spec.rb b/decidim-accountability/spec/events/decidim/accountability/result_progress_updated_event_spec.rb index 17fe1d937aba..575591767880 100644 --- a/decidim-accountability/spec/events/decidim/accountability/result_progress_updated_event_spec.rb +++ b/decidim-accountability/spec/events/decidim/accountability/result_progress_updated_event_spec.rb @@ -10,7 +10,7 @@ let(:proposal_component) do create(:component, manifest_name: "proposals", participatory_space: resource.component.participatory_space) end - let(:proposal) { create(:proposal, component: proposal_component, title: generate_localized_title(:proposal_title)) } + let(:proposal) { create(:proposal, component: proposal_component) } let(:extra) { { proposal_id: proposal.id, progress: 95 } } let(:proposal_path) { resource_locator(proposal).path } let(:proposal_title) { decidim_sanitize_translated(proposal.title) } diff --git a/decidim-accountability/spec/shared/export_results_examples.rb b/decidim-accountability/spec/shared/export_results_examples.rb index 529a79b864e0..f7e01129d567 100644 --- a/decidim-accountability/spec/shared/export_results_examples.rb +++ b/decidim-accountability/spec/shared/export_results_examples.rb @@ -25,7 +25,7 @@ shared_examples "export as CSV" do it "exports a CSV" do find("span.exports", text: export_type).click - perform_enqueued_jobs { click_link "Results as CSV" } + perform_enqueued_jobs { click_on "Results as CSV" } expect(page).to have_admin_callout "Your export is currently in progress. You will receive an email when it is complete." expect(last_email.subject).to include("results", "csv") @@ -37,7 +37,7 @@ shared_examples "export as JSON" do it "exports a JSON" do find("span.exports", text: export_type).click - perform_enqueued_jobs { click_link "Results as JSON" } + perform_enqueued_jobs { click_on "Results as JSON" } expect(page).to have_admin_callout "Your export is currently in progress. You will receive an email when it is complete." expect(last_email.subject).to include("results", "json") diff --git a/decidim-accountability/spec/shared/manage_attachment_collections_examples.rb b/decidim-accountability/spec/shared/manage_attachment_collections_examples.rb index d8d11f58e993..8e4cdfd01f3e 100644 --- a/decidim-accountability/spec/shared/manage_attachment_collections_examples.rb +++ b/decidim-accountability/spec/shared/manage_attachment_collections_examples.rb @@ -5,7 +5,7 @@ before do within "tr", text: translated(result.title) do - click_link "Folders" + click_on "Folders" end end diff --git a/decidim-accountability/spec/shared/manage_attachments_examples.rb b/decidim-accountability/spec/shared/manage_attachments_examples.rb index 5bc6714b7712..8ccceff11330 100644 --- a/decidim-accountability/spec/shared/manage_attachments_examples.rb +++ b/decidim-accountability/spec/shared/manage_attachments_examples.rb @@ -8,7 +8,7 @@ before do within "tr", text: translated(result.title) do - click_link "Attachments" + click_on "Attachments" end end diff --git a/decidim-accountability/spec/shared/manage_child_results_examples.rb b/decidim-accountability/spec/shared/manage_child_results_examples.rb index d83e2f84abb9..d2ab8d43499a 100644 --- a/decidim-accountability/spec/shared/manage_child_results_examples.rb +++ b/decidim-accountability/spec/shared/manage_child_results_examples.rb @@ -3,7 +3,7 @@ RSpec.shared_examples "manage child results" do it "updates a result" do within "tr", text: translated(child_result.title) do - click_link "Edit" + click_on "Edit" end within ".edit_result" do @@ -38,7 +38,7 @@ end it "creates a new child result" do - click_link "New result", match: :first + click_on "New result", match: :first within ".new_result" do fill_in_i18n( @@ -74,13 +74,13 @@ before do visit current_path within ".table-list__actions" do - click_link "New result" + click_on "New result" end end it "deletes a result" do within "tr", text: translated(child_result.title) do - accept_confirm { click_link "Delete" } + accept_confirm { click_on "Delete" } end expect(page).to have_admin_callout("successfully") diff --git a/decidim-accountability/spec/shared/manage_results_examples.rb b/decidim-accountability/spec/shared/manage_results_examples.rb index c0947d0b93b2..dec97c1a56a7 100644 --- a/decidim-accountability/spec/shared/manage_results_examples.rb +++ b/decidim-accountability/spec/shared/manage_results_examples.rb @@ -34,7 +34,7 @@ it "updates a result" do within "tr", text: translated(result.title) do - click_link "Edit" + click_on "Edit" end within ".edit_result" do @@ -59,7 +59,7 @@ end it "creates a new result", :slow do - click_link "New result", match: :first + click_on "New result", match: :first within ".new_result" do fill_in_i18n( @@ -114,7 +114,7 @@ it "deletes a result" do within "tr", text: translated(result2.title) do - accept_confirm { click_link "Delete" } + accept_confirm { click_on "Delete" } end expect(page).to have_admin_callout("successfully") diff --git a/decidim-accountability/spec/shared/manage_statuses_examples.rb b/decidim-accountability/spec/shared/manage_statuses_examples.rb index 075aec3169b5..69af2bf4c8be 100644 --- a/decidim-accountability/spec/shared/manage_statuses_examples.rb +++ b/decidim-accountability/spec/shared/manage_statuses_examples.rb @@ -3,7 +3,7 @@ RSpec.shared_examples "manage statuses" do it "updates a status" do within "tr", text: status.key do - click_link "Edit" + click_on "Edit" end within ".edit_status" do @@ -26,7 +26,7 @@ end it "creates a new status" do - click_link "New status" + click_on "New status" within ".new_status" do fill_in :status_key, with: "status_key_1" @@ -69,7 +69,7 @@ it "deletes a status" do within "tr", text: status2.key do - accept_confirm { click_link "Delete" } + accept_confirm { click_on "Delete" } end expect(page).to have_admin_callout("successfully") diff --git a/decidim-accountability/spec/system/admin/admin_manages_accountability_spec.rb b/decidim-accountability/spec/system/admin/admin_manages_accountability_spec.rb index ef34763336cb..347e554c4ed4 100644 --- a/decidim-accountability/spec/system/admin/admin_manages_accountability_spec.rb +++ b/decidim-accountability/spec/system/admin/admin_manages_accountability_spec.rb @@ -21,7 +21,7 @@ describe "child results" do before do within ".table-list__actions" do - click_link "New result" + click_on "New result" end end @@ -30,7 +30,7 @@ describe "statuses" do before do - click_link "Statuses" + click_on "Statuses" end it_behaves_like "manage statuses" diff --git a/decidim-accountability/spec/system/admin/admin_orders_results_spec.rb b/decidim-accountability/spec/system/admin/admin_orders_results_spec.rb index 3ad41a566844..99496667cae6 100644 --- a/decidim-accountability/spec/system/admin/admin_orders_results_spec.rb +++ b/decidim-accountability/spec/system/admin/admin_orders_results_spec.rb @@ -29,7 +29,7 @@ it "orders results by ID" do ordered_results = results.sort_by(&:id).reverse - click_link "ID" + click_on "ID" rows = page.all("tbody tr") rows.each_with_index do |row, i| @@ -40,7 +40,7 @@ it "orders results by title" do ordered_results = results.sort_by { |result| translated(result.title) } - click_link "Title" + click_on "Title" rows = page.all("tbody tr") rows.each_with_index do |row, i| @@ -51,7 +51,7 @@ it "orders results by category" do ordered_results = results.sort_by { |result| translated(result.category.name) } - click_link "Category" + click_on "Category" rows = page.all("tbody tr") rows.each_with_index do |row, i| @@ -62,7 +62,7 @@ it "orders results by scope" do ordered_results = results.sort_by { |result| translated(result.scope.name) } - click_link "Scope" + click_on "Scope" rows = page.all("tbody tr") rows.each_with_index do |row, i| @@ -73,7 +73,7 @@ it "orders results by status" do ordered_results = results.sort_by { |result| translated(result.status.name) } - click_link "Status" + click_on "Status" rows = page.all("tbody tr") rows.each_with_index do |row, i| @@ -84,7 +84,7 @@ it "orders results by progress" do ordered_results = results.sort_by(&:progress) - click_link "Progress" + click_on "Progress" rows = page.all("tbody tr") rows.each_with_index do |row, i| @@ -95,7 +95,7 @@ it "orders results by created at" do ordered_results = results.sort_by(&:created_at) - click_link "Created" + click_on "Created" rows = page.all("tbody tr") rows.each_with_index do |row, i| diff --git a/decidim-accountability/spec/system/explore_results_spec.rb b/decidim-accountability/spec/system/explore_results_spec.rb index 8b879fac140f..794cd88c79e0 100644 --- a/decidim-accountability/spec/system/explore_results_spec.rb +++ b/decidim-accountability/spec/system/explore_results_spec.rb @@ -23,7 +23,7 @@ context "when filtering by scope" do it "shows an empty page with a message" do within "div.filter-container" do - click_link translated(scope.name) + click_on translated(scope.name) end within "main" do @@ -116,7 +116,7 @@ context "with a scope" do before do within "div.filter-container" do - click_link translated(scope.name) + click_on translated(scope.name) end end @@ -210,7 +210,7 @@ end it "maintains scope filter" do - click_link translated(category.name) + click_on translated(category.name) within "div.filter-container a.is-active" do expect(page).to have_content(translated(scope.name)) @@ -226,7 +226,7 @@ it "shows all result info" do expect(page).to have_i18n_content(result.title) - expect(page).to have_i18n_content(result.description) + expect(page).to have_i18n_content(result.description, strip_tags: true) expect(page).to have_content(result.reference) expect(page).to have_content("#{result.progress.to_i}%") end @@ -331,12 +331,12 @@ end it "the result is mentioned in the proposal page" do - click_link translated(proposal.title) + click_on translated(proposal.title) expect(page).to have_i18n_content(result.title) end it "a banner links back to the result" do - click_link translated(proposal.title) + click_on translated(proposal.title) expect(page).to have_content("Included in #{translated(result.title)}") end end @@ -365,7 +365,7 @@ end it "the result is mentioned in the project page" do - click_link translated(project.title) + click_on translated(project.title) expect(page).to have_i18n_content(result.title) end end @@ -393,12 +393,12 @@ end it "the result is mentioned in the meeting page" do - click_link translated(meeting.title) + click_on translated(meeting.title) expect(page).to have_i18n_content(result.title) end it "a banner links back to the result" do - click_link translated(meeting.title) + click_on translated(meeting.title) expect(page).to have_content("Included in #{translated(result.title)}") end end diff --git a/decidim-accountability/spec/system/explore_versions_spec.rb b/decidim-accountability/spec/system/explore_versions_spec.rb index bca4bd447ad7..22cff6d3863e 100644 --- a/decidim-accountability/spec/system/explore_versions_spec.rb +++ b/decidim-accountability/spec/system/explore_versions_spec.rb @@ -33,7 +33,7 @@ context "when visiting versions index" do before do - click_link "see other versions" + click_on "see other versions" end it "lists all versions" do @@ -44,8 +44,8 @@ context "when showing version" do before do - click_link "see other versions" - click_link "Version 2 of 2" + click_on "see other versions" + click_on "Version 2 of 2" end it "shows the version author and creation date" do diff --git a/decidim-accountability/spec/types/integration_schema_spec.rb b/decidim-accountability/spec/types/integration_schema_spec.rb index 5bc4ad75d8ab..3812fbea1c7f 100644 --- a/decidim-accountability/spec/types/integration_schema_spec.rb +++ b/decidim-accountability/spec/types/integration_schema_spec.rb @@ -71,7 +71,7 @@ { "__typename" => "Accountability", "id" => current_component.id.to_s, - "name" => { "translation" => "Accountability" }, + "name" => { "translation" => translated(current_component.name) }, "results" => { "edges" => [ { @@ -187,7 +187,7 @@ ) end - it "executes sucessfully" do + it "executes successfully" do expect { response }.not_to raise_error end @@ -294,7 +294,7 @@ ) end - it "executes sucessfully" do + it "executes successfully" do expect { response }.not_to raise_error end diff --git a/decidim-admin/app/cells/decidim/admin/content_block_cell.rb b/decidim-admin/app/cells/decidim/admin/content_block_cell.rb index 83733b187693..15b449640d82 100644 --- a/decidim-admin/app/cells/decidim/admin/content_block_cell.rb +++ b/decidim-admin/app/cells/decidim/admin/content_block_cell.rb @@ -29,7 +29,7 @@ def component def name return I18n.t(public_name_key) if component.blank? - "#{I18n.t(public_name_key)} (#{translated_attribute(component&.name)})" + "#{I18n.t(public_name_key)} (#{decidim_escape_translated(component&.name)})" end end end diff --git a/decidim-admin/app/commands/decidim/admin/destroy_category.rb b/decidim-admin/app/commands/decidim/admin/destroy_category.rb index 39da3d11996a..778178e3dbb2 100644 --- a/decidim-admin/app/commands/decidim/admin/destroy_category.rb +++ b/decidim-admin/app/commands/decidim/admin/destroy_category.rb @@ -5,10 +5,10 @@ module Admin # A command with all the business logic to destroy a category in the # system. class DestroyCategory < Decidim::Commands::DestroyResource - private + protected def invalid? - resource.nil? || resource.subcategories.any? + resource.nil? || resource.subcategories.any? || !resource.unused? end end end diff --git a/decidim-admin/app/commands/decidim/admin/officialize_user.rb b/decidim-admin/app/commands/decidim/admin/officialize_user.rb index 8af3c5d41e1f..51441f9c448c 100644 --- a/decidim-admin/app/commands/decidim/admin/officialize_user.rb +++ b/decidim-admin/app/commands/decidim/admin/officialize_user.rb @@ -13,7 +13,7 @@ def initialize(form) # Executes the command. Broadcasts these events: # - # - :ok when the officialization suceeds. + # - :ok when the officialization succeeds. # - :invalid when the form is invalid. # # Returns nothing. diff --git a/decidim-admin/app/commands/decidim/admin/unofficialize_user.rb b/decidim-admin/app/commands/decidim/admin/unofficialize_user.rb index bad5fd843b46..dcaa4f2edc81 100644 --- a/decidim-admin/app/commands/decidim/admin/unofficialize_user.rb +++ b/decidim-admin/app/commands/decidim/admin/unofficialize_user.rb @@ -15,7 +15,7 @@ def initialize(user, current_user) # Executes the command. Broadcasts these events: # - # - :ok when the unofficialization suceeds. + # - :ok when the unofficialization succeeds. # - :invalid when the form is invalid. # # Returns nothing. diff --git a/decidim-admin/app/controllers/decidim/admin/impersonatable_users_controller.rb b/decidim-admin/app/controllers/decidim/admin/impersonatable_users_controller.rb index 5709a0bbb08d..12cf38926d31 100644 --- a/decidim-admin/app/controllers/decidim/admin/impersonatable_users_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/impersonatable_users_controller.rb @@ -28,7 +28,7 @@ def index private def collection - @collection ||= current_organization.users.where(admin: false, roles: []).order(created_at: :desc) + @collection ||= current_organization.users.not_deleted.not_blocked.where(admin: false, roles: []).order(created_at: :desc) end def new_managed_user diff --git a/decidim-admin/app/helpers/decidim/admin/newsletters_helper.rb b/decidim-admin/app/helpers/decidim/admin/newsletters_helper.rb index 96746e2233f6..f65ab7702f61 100644 --- a/decidim-admin/app/helpers/decidim/admin/newsletters_helper.rb +++ b/decidim-admin/app/helpers/decidim/admin/newsletters_helper.rb @@ -65,7 +65,7 @@ def sent_to_users(newsletter) def sent_to_spaces(newsletter) html = "" - newsletter.sended_to_partipatory_spaces.try(:each) do |type| + newsletter.sent_to_participatory_spaces.try(:each) do |type| next if type["ids"].blank? html += t("index.segmented_to", scope: "decidim.admin.newsletters", subject: t("activerecord.models.decidim/#{type["manifest_name"].singularize}.other")) diff --git a/decidim-admin/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb b/decidim-admin/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb index d96e914e7708..a26273396bb5 100644 --- a/decidim-admin/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb +++ b/decidim-admin/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb @@ -17,7 +17,7 @@ def perform(email, user_name, privatable_to, current_user) private_user_form = ParticipatorySpacePrivateUserForm.from_params(params, privatable_to:) .with_context( current_user:, - current_particiaptory_space: privatable_to + current_participatory_space: privatable_to ) Decidim::Admin::CreateParticipatorySpacePrivateUser.call(private_user_form, current_user, privatable_to, via_csv: true) diff --git a/decidim-admin/app/packs/src/decidim/admin/form.js b/decidim-admin/app/packs/src/decidim/admin/form.js index 0f12d6b477db..0dbd0cfb0d09 100644 --- a/decidim-admin/app/packs/src/decidim/admin/form.js +++ b/decidim-admin/app/packs/src/decidim/admin/form.js @@ -28,7 +28,7 @@ $(() => { // - amendment_promotion_enabled // (1) Hides target fields if amendments_enabled component setting is NOT checked. - // (2) Toggles visibilty of target fields when amendments_enabled component setting is clicked. + // (2) Toggles visibility of target fields when amendments_enabled component setting is clicked. const $amendmentsEnabled = $("input#component_settings_amendments_enabled"); if ($amendmentsEnabled.length > 0) { diff --git a/decidim-admin/app/views/decidim/admin/block_user/new.html.erb b/decidim-admin/app/views/decidim/admin/block_user/new.html.erb index 54ff3b161455..e62f0e08d20f 100644 --- a/decidim-admin/app/views/decidim/admin/block_user/new.html.erb +++ b/decidim-admin/app/views/decidim/admin/block_user/new.html.erb @@ -16,8 +16,7 @@ <% if @form.hide %> - <% announcement_message = t(".already_reported_html", link: new_user_block_path(user_id: user.id)) %> - <%= cell("decidim/announcement", announcement_message, callout_class: "alert" ) %> + <%= cell("decidim/announcement", t(".already_reported_html"), callout_class: "alert" ) %> <% end %> <% if defined?(Decidim::Templates) %> diff --git a/decidim-admin/app/views/decidim/admin/categories/index.html.erb b/decidim-admin/app/views/decidim/admin/categories/index.html.erb index f996cd740bb7..5a17b62433f2 100644 --- a/decidim-admin/app/views/decidim/admin/categories/index.html.erb +++ b/decidim-admin/app/views/decidim/admin/categories/index.html.erb @@ -48,7 +48,11 @@ <% end %> <% if allowed_to? :destroy, :category, category: subcategory %> - <%= icon_link_to "delete-bin-line", category_path(current_participatory_space, subcategory), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %> + <% if subcategory.unused? %> + <%= icon_link_to "delete-bin-line", category_path(current_participatory_space, subcategory), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %> + <% else %> + <%= icon "delete-bin-line", class: "action-icon action-icon--disabled", role: "img", "aria-hidden": true %> + <% end %> <% end %>
Well hello!
" - click_button "Save" + click_on "Save" expect(page).to have_admin_callout "Help sections updated successfully" @@ -33,7 +33,7 @@ it "destroys the section when it is empty" do clear_i18n_editor :help_sections_sections_participatory_processes_content, "#sections_participatory_processes_content", [:en] - click_button "Save" + click_on "Save" expect(page).to have_admin_callout "Help sections updated successfully" diff --git a/decidim-admin/spec/system/admin_manages_impersonatable_users_list_spec.rb b/decidim-admin/spec/system/admin_manages_impersonatable_users_list_spec.rb index d005ab5a8b94..4456c4e89b4e 100644 --- a/decidim-admin/spec/system/admin_manages_impersonatable_users_list_spec.rb +++ b/decidim-admin/spec/system/admin_manages_impersonatable_users_list_spec.rb @@ -11,34 +11,41 @@ switch_to_host(organization.host) login_as admin, scope: :user visit decidim_admin.root_path - click_link "Participants" + click_on "Participants" end describe "listing impersonatable users" do let!(:managed) { create(:user, :managed, organization:) } - let!(:not_managed) { create(:user, organization:) } - let!(:external_not_managed) { create(:user) } - let!(:another_admin) { create(:user, :admin) } - let!(:user_manager) { create(:user, :user_manager) } + let!(:deleted) { create(:user, :confirmed, :deleted, organization:) } + let!(:blocked) { create(:user, :confirmed, :blocked, organization:) } + let!(:another_admin) { create(:user, :admin, organization:) } + let!(:user_manager) { create(:user, :user_manager, organization:) } + let!(:external_not_managed) { create(:user) } + let!(:external_admin) { create(:user, :admin) } + let!(:external_user_manager) { create(:user, :user_manager) } before do within_admin_sidebar_menu do - click_link "Impersonations" + click_on "Impersonations" end end it "shows each user and its managed status" do expect(page).to have_css("tr[data-user-id=\"#{managed.id}\"]", text: managed.name) expect(page).to have_css("tr[data-user-id=\"#{managed.id}\"]", text: "Managed") + expect(page).to have_css("tr[data-user-id=\"#{not_managed.id}\"]", text: not_managed.name) + expect(page).to have_css("tr[data-user-id=\"#{not_managed.id}\"]", text: "Not managed") - expect(page).to have_no_css("tr[data-user-id=\"#{external_not_managed.id}\"]", text: not_managed.name) + expect(page).to have_no_css("tr[data-user-id=\"#{admin.id}\"]", text: admin.name) + expect(page).to have_no_css("tr[data-user-id=\"#{deleted.id}\"]", text: deleted.name) + expect(page).to have_no_css("tr[data-user-id=\"#{blocked.id}\"]", text: blocked.name) expect(page).to have_no_css("tr[data-user-id=\"#{another_admin.id}\"]", text: another_admin.name) expect(page).to have_no_css("tr[data-user-id=\"#{user_manager.id}\"]", text: user_manager.name) - - expect(page).to have_css("tr[data-user-id=\"#{not_managed.id}\"]", text: not_managed.name) - expect(page).to have_css("tr[data-user-id=\"#{not_managed.id}\"]", text: "Not managed") + expect(page).to have_no_css("tr[data-user-id=\"#{external_not_managed.id}\"]", text: external_not_managed.name) + expect(page).to have_no_css("tr[data-user-id=\"#{external_admin.id}\"]", text: external_admin.name) + expect(page).to have_no_css("tr[data-user-id=\"#{external_user_manager.id}\"]", text: external_user_manager.name) end end end diff --git a/decidim-admin/spec/system/admin_manages_impersonations_spec.rb b/decidim-admin/spec/system/admin_manages_impersonations_spec.rb index f54cbeb647c1..97b429d3196c 100644 --- a/decidim-admin/spec/system/admin_manages_impersonations_spec.rb +++ b/decidim-admin/spec/system/admin_manages_impersonations_spec.rb @@ -7,9 +7,9 @@ def navigate_to_impersonations_page visit decidim_admin.root_path - click_link "Participants" + click_on "Participants" within_admin_sidebar_menu do - click_link "Impersonations" + click_on "Impersonations" end end diff --git a/decidim-admin/spec/system/admin_manages_newsletter_templates_spec.rb b/decidim-admin/spec/system/admin_manages_newsletter_templates_spec.rb index 339b94f4bc53..cb687f502738 100644 --- a/decidim-admin/spec/system/admin_manages_newsletter_templates_spec.rb +++ b/decidim-admin/spec/system/admin_manages_newsletter_templates_spec.rb @@ -29,7 +29,7 @@ find(".button.new").click within "#basic_only_text" do - click_link "Preview" + click_on "Preview" end expect(page).to have_content("Preview template: Basic (only text)") @@ -45,10 +45,10 @@ find(".button.new").click within "#basic_only_text" do - click_link "Preview" + click_on "Preview" end - click_link "Use this template" + click_on "Use this template" expect(page).to have_content("New newsletter") end diff --git a/decidim-admin/spec/system/admin_manages_newsletters_spec.rb b/decidim-admin/spec/system/admin_manages_newsletters_spec.rb index 2537f77dd12a..f657c61aaaa7 100644 --- a/decidim-admin/spec/system/admin_manages_newsletters_spec.rb +++ b/decidim-admin/spec/system/admin_manages_newsletters_spec.rb @@ -34,7 +34,7 @@ find(".button.new").click within "#image_text_cta" do - click_link "Use this template" + click_on "Use this template" end within ".new_newsletter" do @@ -116,7 +116,7 @@ it "sends a test email" do visit decidim_admin.newsletter_path(newsletter) perform_enqueued_jobs do - click_link "Send me a test email" + click_on "Send me a test email" end expect(page).to have_content("Newsletter has been sent") expect(last_email.subject).to include("A fancy newsletter for") @@ -127,7 +127,7 @@ it "sends a test email" do visit decidim_admin.newsletters_path perform_enqueued_jobs do - click_link "Send me a test email" + click_on "Send me a test email" end expect(page).to have_content("Newsletter has been sent") expect(last_email.subject).to include("A fancy newsletter for") @@ -141,7 +141,7 @@ it "allows a newsletter to be updated" do visit decidim_admin.newsletters_path within("tr[data-newsletter-id=\"#{newsletter.id}\"]") do - click_link "Edit" + click_on "Edit" end within ".edit_newsletter" do @@ -341,7 +341,7 @@ def select_all visit decidim_admin.newsletters_path within("tr[data-newsletter-id=\"#{newsletter.id}\"]") do - accept_confirm { click_link "Delete" } + accept_confirm { click_on "Delete" } end expect(page).to have_content("successfully") diff --git a/decidim-admin/spec/system/admin_manages_officializations_spec.rb b/decidim-admin/spec/system/admin_manages_officializations_spec.rb index 1b2595f0cae1..1d1d405c3a60 100644 --- a/decidim-admin/spec/system/admin_manages_officializations_spec.rb +++ b/decidim-admin/spec/system/admin_manages_officializations_spec.rb @@ -16,7 +16,7 @@ switch_to_host(organization.host) login_as admin, scope: :user visit decidim_admin.root_path - click_link "Participants" + click_on "Participants" end describe "listing officializations" do @@ -31,7 +31,7 @@ before do within_admin_sidebar_menu do - click_link "Participants" + click_on "Participants" end end @@ -53,7 +53,7 @@ before do within_admin_sidebar_menu do - click_link "Participants" + click_on "Participants" end end @@ -72,16 +72,16 @@ before do within_admin_sidebar_menu do - click_link "Participants" + click_on "Participants" end within "tr[data-user-id=\"#{user.id}\"]" do - click_link "Officialize" + click_on "Officialize" end end it "officializes it with the standard badge" do - click_button "Officialize" + click_on "Officialize" expect(page).to have_content("successfully officialized") @@ -98,7 +98,7 @@ es: "Alcaldesa de Barcelona" ) - click_button "Officialize" + click_on "Officialize" expect(page).to have_content("successfully officialized") @@ -120,11 +120,11 @@ before do within_admin_sidebar_menu do - click_link "Participants" + click_on "Participants" end within "tr[data-user-id=\"#{user.id}\"]" do - click_link "Reofficialize" + click_on "Reofficialize" end end @@ -136,7 +136,7 @@ "#officialization-officialized_as-tabs", en: "Major of Barcelona" ) - click_button "Officialize" + click_on "Officialize" expect(page).to have_content("successfully officialized") @@ -152,11 +152,11 @@ before do within_admin_sidebar_menu do - click_link "Participants" + click_on "Participants" end within "tr[data-user-id=\"#{user.id}\"]" do - click_link "Unofficialize" + click_on "Unofficialize" end end @@ -174,13 +174,13 @@ before do within_admin_sidebar_menu do - click_link "Participants" + click_on "Participants" end end it "redirect to conversation path" do within "tr[data-user-id=\"#{user.id}\"]" do - click_link "Contact" + click_on "Contact" end expect(page).to have_current_path decidim.new_conversation_path(recipient_id: user.id) end @@ -191,13 +191,13 @@ before do within_admin_sidebar_menu do - click_link "Participants" + click_on "Participants" end end it "redirect to user profile page" do within "tr[data-user-id=\"#{user.id}\"]" do - click_link user.name + click_on user.name end within "div.profile__details" do @@ -211,13 +211,13 @@ before do within_admin_sidebar_menu do - click_link "Participants" + click_on "Participants" end end it "redirect to user profile page" do within "tr[data-user-id=\"#{user.id}\"]" do - click_link user.nickname + click_on user.nickname end within "div.profile__details" do @@ -231,21 +231,21 @@ before do within_admin_sidebar_menu do - click_link "Participants" + click_on "Participants" end end it "shows the users emails to admin users and logs the action" do users.each do |user| within "tr[data-user-id=\"#{user.id}\"]" do - click_link "Show email" + click_on "Show email" end within "#show-email-modal" do expect(page).to have_content("Show participant's email address") expect(page).to have_no_content(user.email) - click_button "Show" + click_on "Show" expect(page).to have_content(user.email) diff --git a/decidim-admin/spec/system/admin_manages_organization_admins_spec.rb b/decidim-admin/spec/system/admin_manages_organization_admins_spec.rb index 93b87317e8c3..6bfb121e7d36 100644 --- a/decidim-admin/spec/system/admin_manages_organization_admins_spec.rb +++ b/decidim-admin/spec/system/admin_manages_organization_admins_spec.rb @@ -14,14 +14,14 @@ before do login_as admin, scope: :user visit decidim_admin.root_path - click_link "Participants" + click_on "Participants" within_admin_sidebar_menu do - click_link "Admins" + click_on "Admins" end end it "can invite new users" do - click_link "New admin" + click_on "New admin" within ".new_user" do fill_in :user_name, with: "New admin" @@ -38,7 +38,7 @@ end it "can invite a user with a specific role" do - click_link "New admin" + click_on "New admin" within ".new_user" do fill_in :user_name, with: "New user manager" @@ -70,7 +70,7 @@ it "can resend the invitation" do within "tr[data-user-id=\"#{user.id}\"]" do - click_link "Resend invitation" + click_on "Resend invitation" end expect(page).to have_content("Invitation successfully resent") @@ -80,7 +80,7 @@ expect(page).to have_content(other_admin.name) within "tr[data-user-id=\"#{other_admin.id}\"]" do - accept_confirm { click_link "Delete" } + accept_confirm { click_on "Delete" } end expect(page).to have_no_content(other_admin.name) diff --git a/decidim-admin/spec/system/admin_manages_organization_appearance_spec.rb b/decidim-admin/spec/system/admin_manages_organization_appearance_spec.rb index 515303153e00..66b2d1aa7329 100644 --- a/decidim-admin/spec/system/admin_manages_organization_appearance_spec.rb +++ b/decidim-admin/spec/system/admin_manages_organization_appearance_spec.rb @@ -73,7 +73,7 @@ end dynamically_attach_file(:organization_official_img_footer, Decidim::Dev.asset("city3.jpeg"), remove_before: true) - click_button "Update" + click_on "Update" expect(page).to have_content("updated successfully") diff --git a/decidim-admin/spec/system/admin_manages_organization_area_types_spec.rb b/decidim-admin/spec/system/admin_manages_organization_area_types_spec.rb index 0ba13d168942..710f0cf9b56e 100644 --- a/decidim-admin/spec/system/admin_manages_organization_area_types_spec.rb +++ b/decidim-admin/spec/system/admin_manages_organization_area_types_spec.rb @@ -10,9 +10,9 @@ switch_to_host(organization.host) login_as admin, scope: :user visit decidim_admin.root_path - click_link "Settings" - click_link "Areas" - click_link "Area types" + click_on "Settings" + click_on "Areas" + click_on "Area types" end it "can create new area types" do @@ -62,7 +62,7 @@ it "can edit them" do within "tr", text: translated(area_type.name) do - click_link "Edit" + click_on "Edit" end within ".edit_area_type" do @@ -89,7 +89,7 @@ it "can delete them" do within "tr", text: translated(area_type.name) do - accept_confirm { click_link "Delete" } + accept_confirm { click_on "Delete" } end expect(page).to have_admin_callout("successfully") diff --git a/decidim-admin/spec/system/admin_manages_organization_areas_spec.rb b/decidim-admin/spec/system/admin_manages_organization_areas_spec.rb index 773079554b58..6ce0ea16ac26 100644 --- a/decidim-admin/spec/system/admin_manages_organization_areas_spec.rb +++ b/decidim-admin/spec/system/admin_manages_organization_areas_spec.rb @@ -16,12 +16,12 @@ before do login_as admin, scope: :user visit decidim_admin.root_path - click_link "Settings" - click_link "Areas" + click_on "Settings" + click_on "Areas" end it "can create new areas" do - click_link "Add" + click_on "Add" within ".item__edit-form" do fill_in_i18n :area_name, "#area-name-tabs", en: "My area", @@ -55,7 +55,7 @@ it "can edit them" do within "tr", text: translated(area.name) do - click_link "Edit" + click_on "Edit" end within ".item__edit-form" do @@ -98,7 +98,7 @@ def click_delete_area within "tr", text: translated(area.name) do - accept_confirm { click_link "Delete" } + accept_confirm { click_on "Delete" } end end end diff --git a/decidim-admin/spec/system/admin_manages_organization_homepage_spec.rb b/decidim-admin/spec/system/admin_manages_organization_homepage_spec.rb index b552a8f7dee0..bd677cd6707b 100644 --- a/decidim-admin/spec/system/admin_manages_organization_homepage_spec.rb +++ b/decidim-admin/spec/system/admin_manages_organization_homepage_spec.rb @@ -18,7 +18,7 @@ expect(Decidim::ContentBlock.count).to eq 0 within ".edit_content_blocks" do - click_button "Add content block" + click_on "Add content block" within ".add-components" do find("a", text: "Hero image").click end @@ -39,7 +39,7 @@ with: "Custom welcome text!" ) - click_button "Update" + click_on "Update" visit decidim.root_path expect(page).to have_content("Custom welcome text!") end @@ -49,7 +49,7 @@ dynamically_attach_file(:content_block_images_background_image, Decidim::Dev.asset("city2.jpeg")) - click_button "Update" + click_on "Update" visit decidim.root_path expect(page.html).to include("city2.jpeg") end diff --git a/decidim-admin/spec/system/admin_manages_organization_scope_types_spec.rb b/decidim-admin/spec/system/admin_manages_organization_scope_types_spec.rb index 1a134fe6548e..fc0e16becef0 100644 --- a/decidim-admin/spec/system/admin_manages_organization_scope_types_spec.rb +++ b/decidim-admin/spec/system/admin_manages_organization_scope_types_spec.rb @@ -10,9 +10,9 @@ switch_to_host(organization.host) login_as admin, scope: :user visit decidim_admin.root_path - click_link "Settings" - click_link "Scopes" - click_link "Scope types" + click_on "Settings" + click_on "Scopes" + click_on "Scope types" end it "can create new scope types" do @@ -62,7 +62,7 @@ it "can edit them" do within "tr", text: translated(scope_type.name) do - click_link "Edit" + click_on "Edit" end within ".item__edit-form" do @@ -89,7 +89,7 @@ it "can delete them" do within "tr", text: translated(scope_type.name) do - accept_confirm { click_link "Delete" } + accept_confirm { click_on "Delete" } end expect(page).to have_admin_callout("successfully") diff --git a/decidim-admin/spec/system/admin_manages_organization_scopes_spec.rb b/decidim-admin/spec/system/admin_manages_organization_scopes_spec.rb index a5cf4488f6ae..2ae76f8ed660 100644 --- a/decidim-admin/spec/system/admin_manages_organization_scopes_spec.rb +++ b/decidim-admin/spec/system/admin_manages_organization_scopes_spec.rb @@ -16,12 +16,12 @@ before do login_as admin, scope: :user visit decidim_admin.root_path - click_link "Settings" - click_link "Scopes" + click_on "Settings" + click_on "Scopes" end it "can create new scopes" do - click_link "Add" + click_on "Add" within ".new_scope" do fill_in_i18n :scope_name, "#scope-name-tabs", en: "My nice district", @@ -49,7 +49,7 @@ it "can edit them" do within "tr", text: translated(scope.name) do - click_link "Edit" + click_on "Edit" end within ".edit_scope" do @@ -68,7 +68,7 @@ it "can delete them" do within "tr", text: translated(scope.name) do - accept_confirm { click_link "Delete" } + accept_confirm { click_on "Delete" } end expect(page).to have_admin_callout("successfully") @@ -78,12 +78,12 @@ end end - it "can create a new subcope" do + it "can create a new subscope" do within "tr", text: translated(scope.name) do page.find("td:first-child a").click end - click_link "Add" + click_on "Add" within ".new_scope" do fill_in_i18n :scope_name, "#scope-name-tabs", en: "My nice subdistrict", diff --git a/decidim-admin/spec/system/admin_manages_organization_spec.rb b/decidim-admin/spec/system/admin_manages_organization_spec.rb index 7b409ac3bea3..27527e84a853 100644 --- a/decidim-admin/spec/system/admin_manages_organization_spec.rb +++ b/decidim-admin/spec/system/admin_manages_organization_spec.rb @@ -21,7 +21,7 @@ %w(X Facebook Instagram YouTube GitHub).each do |network| within "#organization_social_handlers" do - click_link network + click_on network end field_name = "organization_#{network.downcase}_handler" @@ -36,7 +36,7 @@ en: "Respect the privacy of others.
", es: "Spanish - Respect the privacy of others.
" - click_button "Update" + click_on "Update" expect(page).to have_content("updated successfully") end @@ -258,7 +258,7 @@ it "is still editable" do find('div[contenteditable="true"].ProseMirror').native.send_keys(Array.new(15) { :backspace }, "bar baz") - click_button "Update" + click_on "Update" expect(page).to have_content("Organization updated successfully") expect(find( "#organization-admin_terms_of_service_body-tabs-admin_terms_of_service_body-panel-0 .editor .ProseMirror" @@ -510,7 +510,7 @@ find("button[data-action='save']").click end - click_button "Update" + click_on "Update" organization.reload expect(translated(organization.admin_terms_of_service_body)).to eq( @@ -527,7 +527,7 @@ visit decidim_admin.edit_organization_path check "Send welcome notification" expect(page).to have_no_content("Welcome notification subject") - click_button "Update" + click_on "Update" expect(page).to have_content("updated successfully") organization.reload @@ -548,7 +548,7 @@ fill_in_i18n_editor :organization_welcome_notification_body, "#organization-welcome_notification_body-tabs", en: "Body
" - click_button "Update" + click_on "Update" expect(page).to have_content("updated successfully") organization.reload @@ -565,13 +565,13 @@ fill_in_i18n :organization_welcome_notification_subject, "#organization-welcome_notification_subject-tabs", en: "" - click_button "Update" + click_on "Update" expect(page).to have_content("There was a problem updating this organization.") fill_in_i18n :organization_welcome_notification_subject, "#organization-welcome_notification_subject-tabs", en: "Well hello!" - click_button "Update" + click_on "Update" expect(page).to have_content("updated successfully") organization.reload diff --git a/decidim-admin/spec/system/admin_manages_static_page_content_blocks_spec.rb b/decidim-admin/spec/system/admin_manages_static_page_content_blocks_spec.rb index 4e141b22fce1..a116fb918706 100644 --- a/decidim-admin/spec/system/admin_manages_static_page_content_blocks_spec.rb +++ b/decidim-admin/spec/system/admin_manages_static_page_content_blocks_spec.rb @@ -19,7 +19,7 @@ expect(Decidim::ContentBlock.count).to eq 0 within ".edit_content_blocks" do - click_button "Add content block" + click_on "Add content block" within ".add-components" do find("a", text: "Summary").click end @@ -37,7 +37,7 @@ expect do number_of_content_blocks.times do within ".edit_content_blocks" do - click_button "Add content block" + click_on "Add content block" within ".add-components" do find("a", text: "Section").click end @@ -90,7 +90,7 @@ "#content_block-settings--summary-tabs", en: "Custom privacy policy summary text!
" - click_button "Update" + click_on "Update" visit decidim.page_path(tos_page) expect(page).to have_content("Custom privacy policy summary text!") diff --git a/decidim-admin/spec/system/admin_manages_user_groups_spec.rb b/decidim-admin/spec/system/admin_manages_user_groups_spec.rb index 52e17b01b595..44d51fdc54bf 100644 --- a/decidim-admin/spec/system/admin_manages_user_groups_spec.rb +++ b/decidim-admin/spec/system/admin_manages_user_groups_spec.rb @@ -15,15 +15,15 @@ switch_to_host(organization.host) login_as user, scope: :user visit decidim_admin.root_path - click_link "Participants" + click_on "Participants" within_admin_sidebar_menu do - click_link "Groups" + click_on "Groups" end end it "verifies a user group" do within "tr[data-user-group-id=\"#{user_group.id}\"]" do - click_link "Verify" + click_on "Verify" end expect(page).to have_content("successfully verified") @@ -35,7 +35,7 @@ it "reject a user group" do within "tr[data-user-group-id=\"#{user_group.id}\"]" do - click_link "Reject" + click_on "Reject" end expect(page).to have_content("successfully rejected") diff --git a/decidim-admin/spec/system/admin_moderates_user_spec.rb b/decidim-admin/spec/system/admin_moderates_user_spec.rb index 7297e4eceb49..7665e5fa9107 100644 --- a/decidim-admin/spec/system/admin_moderates_user_spec.rb +++ b/decidim-admin/spec/system/admin_moderates_user_spec.rb @@ -19,7 +19,7 @@ expect(page).to have_css(".profile__actions-secondary") within ".profile__actions-secondary", match: :first do - click_button + click_on "Report" end expect(page).to have_css(".flag-modal", visible: :visible) @@ -28,7 +28,7 @@ find(:css, "input[name='report[block]']").set(true) expect(page).to have_field(name: "report[block]", visible: :visible) expect(page).to have_field(name: "report[hide]", visible: :visible) - click_button I18n.t("decidim.shared.flag_user_modal.block") + click_on I18n.t("decidim.shared.flag_user_modal.block") end expect(page).to have_current_path(decidim_admin.new_user_block_path(user_id: reportable.id), ignore_query: true) @@ -42,7 +42,7 @@ expect(page).to have_css(".profile__actions-secondary") within ".profile__actions-secondary", match: :first do - click_button + click_on "Report" end expect(page).to have_css(".flag-modal", visible: :visible) @@ -52,7 +52,7 @@ find(:css, "input[name='report[hide]']").set(true) expect(page).to have_field(name: "report[block]", visible: :visible) expect(page).to have_field(name: "report[hide]", visible: :visible) - click_button I18n.t("decidim.shared.flag_user_modal.block") + click_on I18n.t("decidim.shared.flag_user_modal.block") end expect(page).to have_current_path(decidim_admin.new_user_block_path(user_id: reportable.id), ignore_query: true) diff --git a/decidim-admin/spec/system/admin_passwords_spec.rb b/decidim-admin/spec/system/admin_passwords_spec.rb index aaab987cfc2c..899147ce707b 100644 --- a/decidim-admin/spec/system/admin_passwords_spec.rb +++ b/decidim-admin/spec/system/admin_passwords_spec.rb @@ -22,7 +22,7 @@ expect(page).to have_content("Admin users need to change their password every 90 days") expect(page).to have_content("Password change") fill_in :password_user_password, with: new_password - click_button "Change my password" + click_on "Change my password" expect(page).to have_css("[data-alert-box].success") expect(page).to have_content("Password successfully updated") expect(user.reload.password_updated_at).to be_between(2.seconds.ago, Time.current) @@ -32,7 +32,7 @@ manual_login(user.email, password) expect(page).to have_content("Password change") within "#admin-bar" do - click_link "Admin dashboard" + click_on "Admin dashboard" end expect(page).to have_content("You need to change your password in order to proceed further") expect(page).to have_content("Password change") @@ -48,7 +48,7 @@ manual_login(user.email, password) expect(page).to have_content("Password change") fill_in :password_user_password, with: new_password - click_button "Change my password" + click_on "Change my password" expect(page).to have_admin_callout("Password successfully updated") expect(page).to have_current_path(decidim_admin.root_path) @@ -81,9 +81,11 @@ end def manual_login(email, password) - click_link "Log in", match: :first - fill_in :session_user_email, with: email - fill_in :session_user_password, with: password - click_button "Log in" + click_on "Log in", match: :first + within ".new_user" do + fill_in :session_user_email, with: email + fill_in :session_user_password, with: password + click_on "Log in" + end end end diff --git a/decidim-admin/spec/system/admin_tos_acceptance_spec.rb b/decidim-admin/spec/system/admin_tos_acceptance_spec.rb index f7e2953db408..1d3bece6ee68 100644 --- a/decidim-admin/spec/system/admin_tos_acceptance_spec.rb +++ b/decidim-admin/spec/system/admin_tos_acceptance_spec.rb @@ -52,7 +52,7 @@ end it "allows accepting and redirects to the previous page" do - click_button "I agree with the terms" + click_on "I agree with the terms" expect(page).to have_content("New process") within_admin_menu do expect(page).to have_content("Process types") @@ -80,7 +80,7 @@ # ActionDispatch::Cookies::CookieOverflow exception visit "#{decidim_admin_participatory_processes.participatory_processes_path}?#{long_parameters}" expect(page).to have_content(review_message) - click_button "I agree with the terms" + click_on "I agree with the terms" expect(page).to have_content("New process") within_admin_menu do expect(page).to have_content("Process types") @@ -100,7 +100,7 @@ end it "allows accepting the terms" do - click_button "I agree with the terms" + click_on "I agree with the terms" expect(page).to have_content("Activity") expect(page).to have_content("Metrics") diff --git a/decidim-admin/spec/system/admin_verifies_user_groups_via_csv_spec.rb b/decidim-admin/spec/system/admin_verifies_user_groups_via_csv_spec.rb index 211149d5042c..c22d9d0db08b 100644 --- a/decidim-admin/spec/system/admin_verifies_user_groups_via_csv_spec.rb +++ b/decidim-admin/spec/system/admin_verifies_user_groups_via_csv_spec.rb @@ -21,11 +21,11 @@ switch_to_host(organization.host) login_as user, scope: :user visit decidim_admin.root_path - click_link "Participants" + click_on "Participants" within_admin_sidebar_menu do - click_link "Groups" + click_on "Groups" end - click_link "Verify via CSV" + click_on "Verify via CSV" end it "verifies a batch of user groups" do @@ -35,7 +35,7 @@ expect(Decidim::Admin::VerifyUserGroupFromCsvJob).to receive(:perform_later).once.ordered.with("Email", user, organization) expect(Decidim::Admin::VerifyUserGroupFromCsvJob).to receive(:perform_later).once.ordered.with(user_group.email, user, organization) dynamically_attach_file(:user_group_csv_verification_file, Decidim::Dev.asset("verify_user_groups.csv")) - perform_enqueued_jobs { click_button "Upload" } + perform_enqueued_jobs { click_on "Upload" } expect(page).to have_content("CSV file uploaded successfully") end diff --git a/decidim-admin/spec/system/autocomplete/multiselect_spec.rb b/decidim-admin/spec/system/autocomplete/multiselect_spec.rb index bc016362f5ec..d2b1a3e2247e 100644 --- a/decidim-admin/spec/system/autocomplete/multiselect_spec.rb +++ b/decidim-admin/spec/system/autocomplete/multiselect_spec.rb @@ -61,7 +61,7 @@ + Required field #{body_extra}