From d06d2db3eb6327f03bd195a2395fc916d014a5a7 Mon Sep 17 00:00:00 2001 From: Joonas Date: Mon, 9 Dec 2024 14:51:15 +0200 Subject: [PATCH] Fix specs / Modify views --- Rakefile | 1 - app/cells/decidim/ideas/idea_g_cell.rb | 2 +- .../decidim/ideas/ideas_controller.rb | 1 + .../decidim/ideas/admin/component_settings.rb | 2 +- .../decidim/ideas/admin/ideas_helper.rb | 4 ++-- .../decidim/ideas/admin/component_settings.js | 4 ++-- app/packs/src/decidim/ideas/admin/ideas.js | 14 ++++++------- .../src/decidim/ideas/admin/ideas_form.js | 6 +++--- app/packs/src/decidim/ideas/idea_form.js | 2 +- .../decidim/ideas/admin/ideas/_form.html.erb | 2 +- .../bulk_actions/_area_scope_change.html.erb | 10 +++------- .../ideas/bulk_actions/_dropdown.html.erb | 2 +- .../admin/ideas/bulk_actions/_merge.html.erb | 4 ++-- .../bulk_actions/_publish_answers.html.erb | 4 ++-- .../ideas/bulk_actions/_recategorize.html.erb | 4 ++-- .../decidim/ideas/ideas/_flag_modal.html.erb | 20 ------------------- app/views/decidim/ideas/ideas/_form.html.erb | 4 ++-- .../decidim/ideas/ideas/_idea_aside.html.erb | 4 ++-- spec/cells/decidim/ideas/idea_g_cell_spec.rb | 2 +- spec/system/admin/admin_creates_idea_spec.rb | 2 +- spec/system/admin/admin_filters_ideas_spec.rb | 15 ++++++-------- .../admin_manages_component_settings_spec.rb | 6 +++--- spec/system/admin/admin_manages_ideas_spec.rb | 4 ++-- spec/system/browse_ideas_spec.rb | 10 +++++++--- 24 files changed, 53 insertions(+), 76 deletions(-) delete mode 100644 app/views/decidim/ideas/ideas/_flag_modal.html.erb diff --git a/Rakefile b/Rakefile index 38c74c8..2d82310 100644 --- a/Rakefile +++ b/Rakefile @@ -24,7 +24,6 @@ end desc "Generates a dummy app for testing" task test_app: "decidim:generate_external_test_app" do ENV["RAILS_ENV"] = "test" - fix_babel_config("spec/decidim_dummy_app") install_module("spec/decidim_dummy_app") end diff --git a/app/cells/decidim/ideas/idea_g_cell.rb b/app/cells/decidim/ideas/idea_g_cell.rb index eb8e768..18c89ec 100644 --- a/app/cells/decidim/ideas/idea_g_cell.rb +++ b/app/cells/decidim/ideas/idea_g_cell.rb @@ -64,7 +64,7 @@ def body end def category - translated_attribute(model.category.name) if has_category? + decidim_sanitize translated_attribute(model.category.name) if has_category? end def full_category diff --git a/app/controllers/decidim/ideas/ideas_controller.rb b/app/controllers/decidim/ideas/ideas_controller.rb index f1337b2..f7c9c31 100644 --- a/app/controllers/decidim/ideas/ideas_controller.rb +++ b/app/controllers/decidim/ideas/ideas_controller.rb @@ -8,6 +8,7 @@ class IdeasController < Decidim::Ideas::ApplicationController include Decidim::ApplicationHelper include FormFactory + include Flaggable include FilterResource include Decidim::Ideas::Orderable include Paginable diff --git a/app/helpers/concerns/decidim/ideas/admin/component_settings.rb b/app/helpers/concerns/decidim/ideas/admin/component_settings.rb index 28deb84..7b82d9f 100644 --- a/app/helpers/concerns/decidim/ideas/admin/component_settings.rb +++ b/app/helpers/concerns/decidim/ideas/admin/component_settings.rb @@ -28,7 +28,7 @@ def settings_attribute_input(form, attribute, name, i18n_scope, options = {}) end when :idea_area_scope_coordinates component_id = @component.new_record? ? "new" : @component.id - visibility_class = @component.settings.geocoding_enabled ? "" : "hide" + visibility_class = @component.settings.geocoding_enabled ? "" : "hidden" value = area_scopes_coordinates(@component) label = t(name, scope: i18n_scope) coordinates_element = render( diff --git a/app/helpers/decidim/ideas/admin/ideas_helper.rb b/app/helpers/decidim/ideas/admin/ideas_helper.rb index b63e689..486263e 100644 --- a/app/helpers/decidim/ideas/admin/ideas_helper.rb +++ b/app/helpers/decidim/ideas/admin/ideas_helper.rb @@ -111,12 +111,12 @@ def ideas_admin_filter_applied_filters def icon_with_link_to_idea(idea) icon, tooltip = if allowed_to?(:create, :idea_answer, idea: idea) && !idea.emendation? [ - "comment-square", + "question-answer-line", t(:answer_idea, scope: "decidim.ideas.actions") ] else [ - "info", + "information-line", t(:show, scope: "decidim.ideas.actions") ] end diff --git a/app/packs/src/decidim/ideas/admin/component_settings.js b/app/packs/src/decidim/ideas/admin/component_settings.js index e63cfc1..b2c50dc 100644 --- a/app/packs/src/decidim/ideas/admin/component_settings.js +++ b/app/packs/src/decidim/ideas/admin/component_settings.js @@ -17,9 +17,9 @@ $(() => { $("input[name='component[settings][geocoding_enabled]']").on("change", (ev) => { if ($(ev.target).is(":checked")) { - $coordinatesElement.removeClass("hide"); + $coordinatesElement.removeClass("hidden"); } else { - $coordinatesElement.addClass("hide"); + $coordinatesElement.addClass("hidden"); } }); diff --git a/app/packs/src/decidim/ideas/admin/ideas.js b/app/packs/src/decidim/ideas/admin/ideas.js index 0b9fee5..3464983 100644 --- a/app/packs/src/decidim/ideas/admin/ideas.js +++ b/app/packs/src/decidim/ideas/admin/ideas.js @@ -33,32 +33,32 @@ $(document).ready(function () { let showBulkActionsButton = function() { if (selectedIdeasCount() > 0) { - $("#js-bulk-actions-button").removeClass("hide"); + $("#js-bulk-actions-button").removeClass("hidden"); } } window.hideBulkActionsButton = function(force = false) { if (selectedIdeasCount() === 0 || force === true) { - $("#js-bulk-actions-button").addClass("hide"); + $("#js-bulk-actions-button").addClass("hidden"); $("#js-bulk-actions-dropdown").removeClass("is-open"); } } window.showOtherActionsButtons = function() { - $("#js-other-actions-wrapper").removeClass("hide"); + $("#js-other-actions-wrapper").removeClass("hidden"); } window.hideOtherActionsButtons = function() { - $("#js-other-actions-wrapper").addClass("hide"); + $("#js-other-actions-wrapper").addClass("hidden"); } window.hideBulkActionForms = function() { - $(".js-bulk-action-form").addClass("hide"); + $(".js-bulk-action-form").addClass("hidden"); } if ($(".js-bulk-action-form").length) { window.hideBulkActionForms(); - $("#js-bulk-actions-button").addClass("hide"); + $("#js-bulk-actions-button").addClass("hidden"); $("#js-bulk-actions-dropdown ul li button").click(function(ev) { ev.preventDefault(); @@ -69,7 +69,7 @@ $(document).ready(function () { $(".layout-content > .callout-wrapper").html(""); }) - $(`#js-${action}-actions`).removeClass("hide"); + $(`#js-${action}-actions`).removeClass("hidden"); window.hideBulkActionsButton(true); window.hideOtherActionsButtons(); } diff --git a/app/packs/src/decidim/ideas/admin/ideas_form.js b/app/packs/src/decidim/ideas/admin/ideas_form.js index 7b9a34a..5a691b1 100644 --- a/app/packs/src/decidim/ideas/admin/ideas_form.js +++ b/app/packs/src/decidim/ideas/admin/ideas_form.js @@ -10,7 +10,7 @@ const subcategorySelects = {}; $sections.each((_i, el) => { const $sub = $(el); - $sub.removeClass("hide"); + $sub.removeClass("hidden"); subcategorySelects[$sub.data("parent")] = $sub; }); @@ -28,9 +28,9 @@ $geocodingToggle.on("change.decidim.ideas", () => { if ($geocodingToggle.is(":checked")) { - $(".geocoding-field").addClass("hide"); + $(".geocoding-field").addClass("hidden"); } else { - $(".geocoding-field").removeClass("hide"); + $(".geocoding-field").removeClass("hidden"); } }).trigger("change.decidim.ideas"); }; diff --git a/app/packs/src/decidim/ideas/idea_form.js b/app/packs/src/decidim/ideas/idea_form.js index c4cfcf2..06da5cd 100644 --- a/app/packs/src/decidim/ideas/idea_form.js +++ b/app/packs/src/decidim/ideas/idea_form.js @@ -237,7 +237,7 @@ import "src/decidim/ideas/info_modals"; const subcategorySelects = {}; $sections.each((_i, el) => { const $sub = $(el); - $sub.removeClass("hide"); + $sub.removeClass("hidden"); subcategorySelects[$sub.data("parent")] = $sub; }); diff --git a/app/views/decidim/ideas/admin/ideas/_form.html.erb b/app/views/decidim/ideas/admin/ideas/_form.html.erb index ddc6ffe..53b4de7 100644 --- a/app/views/decidim/ideas/admin/ideas/_form.html.erb +++ b/app/views/decidim/ideas/admin/ideas/_form.html.erb @@ -72,7 +72,7 @@ <% @form.top_categories.each do |category| %> <% next if category.subcategories.blank? %> -
+