From 3d5f017ee4eb9914e0bb682b139b4676e2b2ffcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Verg=C3=A9s?= Date: Fri, 24 May 2024 11:26:38 +0200 Subject: [PATCH 1/4] hero size --- app/packs/stylesheets/partials/_homepage.scss | 7 +--- config/initializers/custom_admin_iframe.rb | 15 ++++---- spec/system/admin_custom_iframe_spec.rb | 37 +++++++++++++++++++ 3 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 spec/system/admin_custom_iframe_spec.rb diff --git a/app/packs/stylesheets/partials/_homepage.scss b/app/packs/stylesheets/partials/_homepage.scss index d8867e9a..f5ac6680 100644 --- a/app/packs/stylesheets/partials/_homepage.scss +++ b/app/packs/stylesheets/partials/_homepage.scss @@ -5,18 +5,15 @@ background-image: var(--hero-image); } .hero { - padding: 12rem 0 !important; gap: normal !important; - height: auto !important; } } .hero__title { font-weight: 400 !important; - letter-spacing: 0.1; - font-size: 3rem; - line-height: 1.2; + text-shadow: 1px 1px 5px #000; } .hero__subtitle { + text-shadow: 1px 1px 5px #000; text-align: center; color: white; font-size: 1.5rem; diff --git a/config/initializers/custom_admin_iframe.rb b/config/initializers/custom_admin_iframe.rb index d1f22dc0..16e89ef9 100644 --- a/config/initializers/custom_admin_iframe.rb +++ b/config/initializers/custom_admin_iframe.rb @@ -1,11 +1,10 @@ # frozen_string_literal: true -if ENV.fetch("ADMIN_IFRAME_URL", nil).present? - Decidim.menu :admin_menu do |menu| - menu.add_item :custom_iframe, - "Estadísques web", - Rails.application.routes.url_helpers.admin_iframe_index_path, - icon_name: "pie-chart", - position: 10 - end +Decidim.menu :admin_menu do |menu| + menu.add_item :custom_iframe, + "Estadístiques web", + Rails.application.routes.url_helpers.admin_iframe_index_path, + icon_name: "bar-chart-2-line", + position: 10, + if: ENV.fetch("ADMIN_IFRAME_URL", nil).present? end diff --git a/spec/system/admin_custom_iframe_spec.rb b/spec/system/admin_custom_iframe_spec.rb new file mode 100644 index 00000000..d2dba11b --- /dev/null +++ b/spec/system/admin_custom_iframe_spec.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +require "rails_helper" + +describe "Admin" do + context "when admin access to dashboard" do + let(:organization) { create(:organization) } + let!(:user) { create(:user, :confirmed, organization:) } + let!(:admin) { create(:user, :admin, :confirmed, organization:) } + let(:url) { "http://example.org" } + + before do + allow(ENV).to receive(:fetch).and_call_original + allow(ENV).to receive(:fetch).with("ADMIN_IFRAME_URL", nil).and_return(url) + switch_to_host(organization.host) + login_as admin, scope: :user + + visit decidim_admin.root_path + end + + it "displays custom iframe in the admin menu" do + click_link "Estadístiques web" + within ".layout-content" do + expect(page).to have_content("Estadístiques web") + expect(page).to have_selector("iframe[src='#{url}']") + end + end + + context "when no url is set" do + let(:url) { nil } + + it "does not display custom iframe in the admin menu" do + expect(page).not_to have_content("Estadístiques web") + end + end + end +end From 9ac651ab2ff9654530162cc3b9f4d15409b7f33d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Verg=C3=A9s?= Date: Fri, 24 May 2024 11:30:02 +0200 Subject: [PATCH 2/4] rubocop --- spec/system/admin_custom_iframe_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/system/admin_custom_iframe_spec.rb b/spec/system/admin_custom_iframe_spec.rb index d2dba11b..d25078c9 100644 --- a/spec/system/admin_custom_iframe_spec.rb +++ b/spec/system/admin_custom_iframe_spec.rb @@ -19,10 +19,10 @@ end it "displays custom iframe in the admin menu" do - click_link "Estadístiques web" + click_on "Estadístiques web" within ".layout-content" do expect(page).to have_content("Estadístiques web") - expect(page).to have_selector("iframe[src='#{url}']") + expect(page).to have_css("iframe[src='#{url}']") end end @@ -30,7 +30,7 @@ let(:url) { nil } it "does not display custom iframe in the admin menu" do - expect(page).not_to have_content("Estadístiques web") + expect(page).to have_no_content("Estadístiques web") end end end From e58a03dab10d01c25d12776af2a5434b1d81de08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Verg=C3=A9s?= Date: Fri, 24 May 2024 11:37:16 +0200 Subject: [PATCH 3/4] fix test --- app/views/admin/iframe/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/iframe/index.html.erb b/app/views/admin/iframe/index.html.erb index 7d8892b3..5e01d52a 100644 --- a/app/views/admin/iframe/index.html.erb +++ b/app/views/admin/iframe/index.html.erb @@ -1,3 +1,3 @@ - +
Stats powered by Plausible Analytics
From 8244ae6f0ed4ab499f63eef1910d64d4ae2b1797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Verg=C3=A9s?= Date: Fri, 24 May 2024 15:00:25 +0200 Subject: [PATCH 4/4] remove uneeded hack --- Gemfile.lock | 4 ++-- .../conferences/show/change_layout.html.erb.deface | 10 ---------- spec/lib/overrides_spec.rb | 5 ++--- 3 files changed, 4 insertions(+), 15 deletions(-) delete mode 100644 app/overrides/decidim/conferences/conferences/show/change_layout.html.erb.deface diff --git a/Gemfile.lock b/Gemfile.lock index 2326f602..298328d4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -278,7 +278,7 @@ GEM public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) aws-eventstream (1.3.0) - aws-partitions (1.933.0) + aws-partitions (1.934.0) aws-sdk-core (3.196.1) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) @@ -838,7 +838,7 @@ GEM web-push (3.0.1) jwt (~> 2.0) openssl (~> 3.0) - webmock (3.23.0) + webmock (3.23.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) diff --git a/app/overrides/decidim/conferences/conferences/show/change_layout.html.erb.deface b/app/overrides/decidim/conferences/conferences/show/change_layout.html.erb.deface deleted file mode 100644 index 4abd2c95..00000000 --- a/app/overrides/decidim/conferences/conferences/show/change_layout.html.erb.deface +++ /dev/null @@ -1,10 +0,0 @@ - - -<% -lay = if conference_nav_items(current_participatory_space).empty? - "layouts/decidim/shared/layout_center" - else - "layouts/decidim/shared/layout_two_col" - end -%> -<%= render layout: lay, locals: { reverse: true, main_enabled: false, columns: 10 } do %> \ No newline at end of file diff --git a/spec/lib/overrides_spec.rb b/spec/lib/overrides_spec.rb index 09fc9334..e1114e80 100644 --- a/spec/lib/overrides_spec.rb +++ b/spec/lib/overrides_spec.rb @@ -10,9 +10,8 @@ package: "decidim-conferences", files: { "/app/controllers/decidim/conferences/conferences_controller.rb" => "4e1bd7427cfd12c79391b451e07a2e2a", - "/app/models/decidim/conference.rb" => "095732cb2451adfb9db7a46078dc3a51", - "/app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb" => "7f24462f802a2c277697205511103d90", - "/app/views/decidim/conferences/conferences/show.html.erb" => "93fa0d48a6117d3b1cb210ad1f17da7e" + "/app/models/decidim/conference.rb" => "50732d8b25ff80aa88d39a5b4a6661a8", + "/app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb" => "7f24462f802a2c277697205511103d90" } }, {