From 300a4aeef99c7ed7b9e76b7a0889cb222c349975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Bol=C3=ADvar?= Date: Fri, 15 Mar 2024 15:44:43 +0100 Subject: [PATCH] Include ephemeral participation specs in the CI and fix them --- .github/workflows/test.yml | 4 +- .../decidim/decidim_application.scss | 5 ++ app/views/layouts/decidim/mailer.html.erb | 4 +- .../permissions_form_override.rb | 2 +- .../component_override.rb | 2 - .../ephemeral_participation_permissions.rb | 6 +- .../_ephemeral_participation_button.html.erb | 2 +- .../with_ephemerable_participation.rb | 21 ++++--- .../spec/rails_helper.rb | 2 +- .../spec/system/admin/component_spec.rb | 56 +++++++++---------- .../spec/system/admin/conflicts_spec.rb | 8 +-- .../spec/system/admin/organization_spec.rb | 2 +- .../system/user/complete_registration_spec.rb | 12 +--- .../ephemeral_participation_button_spec.rb | 6 +- .../spec/system/user/permissions_spec.rb | 24 ++++---- .../spec/system/user/session_spec.rb | 2 +- .../user/successful_verification_spec.rb | 4 +- .../spec/system/user/user_menu_spec.rb | 10 ++-- .../user/verification_conflicts_spec.rb | 9 +-- spec/rails_helper.rb | 2 +- 20 files changed, 92 insertions(+), 91 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e60043b46..252476be1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,5 +43,7 @@ jobs: run: | npm install bundle exec rake assets:precompile - - run: bundle exec rspec + - run: | + bundle exec rspec + bundle exec rspec decidim-ephemeral_participation/spec/**/*.rb name: Run specs diff --git a/app/packs/stylesheets/decidim/decidim_application.scss b/app/packs/stylesheets/decidim/decidim_application.scss index 38bc6f17f..801c388b3 100644 --- a/app/packs/stylesheets/decidim/decidim_application.scss +++ b/app/packs/stylesheets/decidim/decidim_application.scss @@ -8,3 +8,8 @@ // @import "stylesheets/barcelona"; // @import "stylesheets/global_accountability"; + +// Fix for the confirm modal showing behind the modal who generates it +#confirm-modal { + z-index: 100; +} diff --git a/app/views/layouts/decidim/mailer.html.erb b/app/views/layouts/decidim/mailer.html.erb index 0e4f54c93..8af4d49ff 100644 --- a/app/views/layouts/decidim/mailer.html.erb +++ b/app/views/layouts/decidim/mailer.html.erb @@ -47,9 +47,9 @@ diff --git a/decidim-ephemeral_participation/app/forms/decidim/ephemeral_participation/permissions_form_override.rb b/decidim-ephemeral_participation/app/forms/decidim/ephemeral_participation/permissions_form_override.rb index e4c1dda7f..2540e6314 100644 --- a/decidim-ephemeral_participation/app/forms/decidim/ephemeral_participation/permissions_form_override.rb +++ b/decidim-ephemeral_participation/app/forms/decidim/ephemeral_participation/permissions_form_override.rb @@ -20,7 +20,7 @@ def validate_ephemeral_participation_permissions_settings permissions.values.each do |permission_form| next if valid_permission_form?(permission_form) - permission_form.errors.add(:base, :invalid_ephemeral_participation_permissions, i18n_options) + permission_form.errors.add(:base, I18n.t("activemodel.errors.models.permission.attributes.base.invalid_ephemeral_participation_permissions", **i18n_options)) end end diff --git a/decidim-ephemeral_participation/app/models/decidim/ephemeral_participation/component_override.rb b/decidim-ephemeral_participation/app/models/decidim/ephemeral_participation/component_override.rb index c76464738..dad0813c8 100644 --- a/decidim-ephemeral_participation/app/models/decidim/ephemeral_participation/component_override.rb +++ b/decidim-ephemeral_participation/app/models/decidim/ephemeral_participation/component_override.rb @@ -8,8 +8,6 @@ module ComponentOverride included do def ephemeral_participation_enabled? organization.try(:ephemeral_participation_authorization) && settings.try(:ephemeral_participation_enabled) == true - # @todo: Remove this line - true end # Given organization.ephemeral_participation_authorization == "valid_auth" diff --git a/decidim-ephemeral_participation/app/permissions/decidim/ephemeral_participation/ephemeral_participation_permissions.rb b/decidim-ephemeral_participation/app/permissions/decidim/ephemeral_participation/ephemeral_participation_permissions.rb index 56bcd5180..b22c5a891 100644 --- a/decidim-ephemeral_participation/app/permissions/decidim/ephemeral_participation/ephemeral_participation_permissions.rb +++ b/decidim-ephemeral_participation/app/permissions/decidim/ephemeral_participation/ephemeral_participation_permissions.rb @@ -126,9 +126,9 @@ def answering_public_survey? def ephemeral_participation_permission_action? Decidim::EphemeralParticipation::EphemeralPermissionActionsDictionary.for(component) - .any? do |_, permission_action_attributes| - permission_action_attributes.any? do |action:, scope:, subject:| - permission_action.matches?(scope, action, subject) + .any? do |_, ephemeral_permission_actions| + ephemeral_permission_actions.any? do |ephemeral_permission_action| + permission_action.matches?(ephemeral_permission_action[:scope], ephemeral_permission_action[:action], ephemeral_permission_action[:subject]) end end end diff --git a/decidim-ephemeral_participation/app/views/decidim/ephemeral_participation/shared/_ephemeral_participation_button.html.erb b/decidim-ephemeral_participation/app/views/decidim/ephemeral_participation/shared/_ephemeral_participation_button.html.erb index af0180ffa..cb7ae51b6 100644 --- a/decidim-ephemeral_participation/app/views/decidim/ephemeral_participation/shared/_ephemeral_participation_button.html.erb +++ b/decidim-ephemeral_participation/app/views/decidim/ephemeral_participation/shared/_ephemeral_participation_button.html.erb @@ -1,5 +1,5 @@ <% if controller.respond_to?(:current_component) && current_component.ephemeral_participation_enabled? && current_component.ephemeral_participation_permissions.any? %> -
+
diff --git a/decidim-ephemeral_participation/lib/decidim/ephemeral_participation/test/shared_examples/with_ephemerable_participation.rb b/decidim-ephemeral_participation/lib/decidim/ephemeral_participation/test/shared_examples/with_ephemerable_participation.rb index 46b32b167..3691d971d 100644 --- a/decidim-ephemeral_participation/lib/decidim/ephemeral_participation/test/shared_examples/with_ephemerable_participation.rb +++ b/decidim-ephemeral_participation/lib/decidim/ephemeral_participation/test/shared_examples/with_ephemerable_participation.rb @@ -69,11 +69,18 @@ def create_ephemeral_participant let(:document_number) { "123456789X" } def click_ephemeral_participation_button(selector = ephemeral_participation_action_button_selector) - click_ephemeral_parcipation_action_button(selector) - accept_confirm { click_on("I want to participate without registering") } + click_ephemeral_participation_action_button(selector) + accept_confirm { click_ephemeral_participation_login_button } end - def click_ephemeral_parcipation_action_button(_selector = ephemeral_participation_action_button_selector) + def click_ephemeral_participation_login_button + # Modals takes too long rendering. We wait for the buttons to be visible and enabled. + sleep(0.2) + click_on("I want to participate without registering") + sleep(0.2) + end + + def click_ephemeral_participation_action_button(_selector = ephemeral_participation_action_button_selector) page.find(ephemeral_participation_action_button_selector).click end @@ -94,10 +101,10 @@ def submit_unverifiable_form let(:email) { "unique@email.example" } def register_workflows - [ - "decidim-generators/lib/decidim/generators/app_templates/dummy_authorization_handler.rb", - "decidim-generators/lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb" - ].each { |file_path| require "#{Gem::Specification.find_by_name("decidim").gem_dir}/#{file_path}" } + %w(lib/decidim/generators/app_templates/dummy_authorization_handler.rb + lib/decidim/generators/app_templates/another_dummy_authorization_handler.rb).each do |file_path| + require "#{Gem::Specification.find_by_name("decidim-generators").gem_dir}/#{file_path}" + end Decidim::Verifications.register_workflow(:dummy_authorization_handler) do |workflow| workflow.form = "DummyAuthorizationHandler" diff --git a/decidim-ephemeral_participation/spec/rails_helper.rb b/decidim-ephemeral_participation/spec/rails_helper.rb index ee8491ac8..3bbda0e5b 100644 --- a/decidim-ephemeral_participation/spec/rails_helper.rb +++ b/decidim-ephemeral_participation/spec/rails_helper.rb @@ -1,3 +1,3 @@ # frozen_string_literal: true -require "../../spec/rails_helper" +require_relative "../../spec/rails_helper" diff --git a/decidim-ephemeral_participation/spec/system/admin/component_spec.rb b/decidim-ephemeral_participation/spec/system/admin/component_spec.rb index f82bf1936..74bf35cc7 100644 --- a/decidim-ephemeral_participation/spec/system/admin/component_spec.rb +++ b/decidim-ephemeral_participation/spec/system/admin/component_spec.rb @@ -52,9 +52,9 @@ es: "Alerta!" ) - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.success") + expect(page).to have_css("div.callout-wrapper .flash.success") end end @@ -73,9 +73,9 @@ es: "Alerta!" ) - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.alert") + expect(page).to have_css("div.callout-wrapper .flash.alert") end end end @@ -102,26 +102,26 @@ it "updates permissions when selecting ephemeral authorization for a given action" do check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.success") + expect(page).to have_css("div.callout-wrapper .flash.success") end it "updates permissions when selecting regular authorization for a given action" do check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.success") + expect(page).to have_css("div.callout-wrapper .flash.success") end it "fails to update permissions when selecting more than one authorization for a given action" do check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler") check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.alert") + expect(page).to have_css("div.callout-wrapper .flash.alert") end end @@ -133,26 +133,26 @@ it "updates permissions when selecting ephemeral authorization for a given action" do check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.success") + expect(page).to have_css("div.callout-wrapper .flash.success") end it "updates permissions when selecting regular authorization for a given action" do check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.success") + expect(page).to have_css("div.callout-wrapper .flash.success") end it "updates permissions when selecting more than one authorization for a given action" do check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler") check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.success") + expect(page).to have_css("div.callout-wrapper .flash.success") end end end @@ -173,26 +173,26 @@ it "updates permissions when selecting ephemeral authorization for a given action" do check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.success") + expect(page).to have_css("div.callout-wrapper .flash.success") end it "updates permissions when selecting regular authorization for a given action" do check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.success") + expect(page).to have_css("div.callout-wrapper .flash.success") end it "updates permissions when selecting more than one authorization for a given action" do check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler") check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.success") + expect(page).to have_css("div.callout-wrapper .flash.success") end end @@ -204,26 +204,26 @@ it "updates permissions when selecting ephemeral authorization for a given action" do check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.success") + expect(page).to have_css("div.callout-wrapper .flash.success") end it "updates permissions when selecting regular authorization for a given action" do check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.success") + expect(page).to have_css("div.callout-wrapper .flash.success") end it "updates permissions when selecting more than one authorization for a given action" do check("component_permissions_permissions_vote_authorization_handlers_dummy_authorization_handler") check("component_permissions_permissions_vote_authorization_handlers_another_dummy_authorization_handler") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click - expect(page).to have_css("div.callout.success") + expect(page).to have_css("div.callout-wrapper .flash.success") end end end diff --git a/decidim-ephemeral_participation/spec/system/admin/conflicts_spec.rb b/decidim-ephemeral_participation/spec/system/admin/conflicts_spec.rb index 64348eb5a..d2de9504b 100644 --- a/decidim-ephemeral_participation/spec/system/admin/conflicts_spec.rb +++ b/decidim-ephemeral_participation/spec/system/admin/conflicts_spec.rb @@ -24,7 +24,7 @@ shared_examples "fails to transfer the users" do it "fails to transfer the users" do - within(".callout") do + within(".callout-wrapper") do expect(page).to have_content("There was a problem transfering the current participant to managed participant.") end @@ -46,7 +46,7 @@ context "when transfering the user" do before do - click_on(href: "/admin/conflicts/#{conflict.id}/edit") + find(:xpath, "//a[@href='/admin/conflicts/#{conflict.id}/edit']").click end context "and submitting a registered email" do @@ -78,7 +78,7 @@ context "when transfering the user" do before do - click_on(href: "/admin/conflicts/#{conflict.id}/edit") + find(:xpath, "//a[@href='/admin/conflicts/#{conflict.id}/edit']").click end context "and submitting a registered email" do @@ -101,7 +101,7 @@ end it "transfers the users successfuly" do - within(".callout") do + within(".callout-wrapper") do expect(page).to have_content("The current transfer has been successfully completed.") end diff --git a/decidim-ephemeral_participation/spec/system/admin/organization_spec.rb b/decidim-ephemeral_participation/spec/system/admin/organization_spec.rb index b274ff747..6d37177ca 100644 --- a/decidim-ephemeral_participation/spec/system/admin/organization_spec.rb +++ b/decidim-ephemeral_participation/spec/system/admin/organization_spec.rb @@ -35,7 +35,7 @@ choose("organization_available_authorizations_dummy_authorization_handler_allow_ephemeral_participation") - find("*[type=submit]").click + find("*[type=submit][name=commit]").click expect(page).to have_css("div.flash.success") diff --git a/decidim-ephemeral_participation/spec/system/user/complete_registration_spec.rb b/decidim-ephemeral_participation/spec/system/user/complete_registration_spec.rb index e0c249166..ffc06b95a 100644 --- a/decidim-ephemeral_participation/spec/system/user/complete_registration_spec.rb +++ b/decidim-ephemeral_participation/spec/system/user/complete_registration_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -describe "User menu" do +describe "Complete registration" do include_context "with ephemerable participation" let!(:project) { create(:project, budget:) } @@ -19,21 +19,15 @@ end context "when the user clicks the ephemeral participation button and toggles the user menu" do - let(:toggle_user_menu) do - within(".topbar__user__logged") do - click_on(current_user.name) - end - end let(:current_user) { Decidim::User.last } before do click_ephemeral_participation_button - toggle_user_menu end context "when the user clicks the complete registration link" do before do - within(".topbar__user__logged") do + within(".main-footer__top") do click_on("Finish your registration") end end @@ -46,7 +40,7 @@ fill_in("ephemeral_participant_email", with: email) fill_in("ephemeral_participant_password", with: password) fill_in("ephemeral_participant_password_confirmation", with: password) - find("*[type=submit]").click + find("*[type=submit][name=commit]").click end end let(:name) { "New name" } diff --git a/decidim-ephemeral_participation/spec/system/user/ephemeral_participation_button_spec.rb b/decidim-ephemeral_participation/spec/system/user/ephemeral_participation_button_spec.rb index 9c14ee4c8..ee5489e6c 100644 --- a/decidim-ephemeral_participation/spec/system/user/ephemeral_participation_button_spec.rb +++ b/decidim-ephemeral_participation/spec/system/user/ephemeral_participation_button_spec.rb @@ -36,9 +36,9 @@ end it "renders the confirmation modal" do - click_on("I want to participate without registering") + click_ephemeral_participation_login_button - within(".confirm-modal-content") do + within("#confirm-modal-content") do expect(page).to have_content("Are you sure?") end end @@ -50,7 +50,7 @@ end it "renders the verification form directly" do - click_on("I want to participate without registering") + click_ephemeral_participation_login_button within_flash_messages do expect(page).to have_content("en.decidim.ephemeral_participation.ephemeral_participants.create") diff --git a/decidim-ephemeral_participation/spec/system/user/permissions_spec.rb b/decidim-ephemeral_participation/spec/system/user/permissions_spec.rb index 64fe6e7a7..067fac906 100644 --- a/decidim-ephemeral_participation/spec/system/user/permissions_spec.rb +++ b/decidim-ephemeral_participation/spec/system/user/permissions_spec.rb @@ -47,8 +47,8 @@ def perform_non_authorized_action let(:perform_authorized_action_supposed_to_redirect) do click_on(project.title["en"]) - within("#project") do - click_on("Add to your vote") + within("#project-item") do + click_on("Add") end end @@ -81,21 +81,23 @@ def perform_non_authorized_action submit_authorization_form end - it "allows to perfom authorized action" do - click_ephemeral_parcipation_action_button + it "allows to perform authorized action" do + click_ephemeral_participation_action_button click_on("Vote") click_on("Confirm") - expect(page).to have_content("You've already voted for the budget.") + expect(page).to have_content("You have already voted for the budget.") end - it "disallows to perfom non authorized action" do + it "disallows to perform non authorized action" do perform_non_authorized_action - within_flash_messages do - expect(page).to have_content("You are not authorized to perform this action") - expect(page).to have_link("Finish your registration here") + within "#content" do + within_flash_messages do + expect(page).to have_content("You are not authorized to perform this action") + expect(page).to have_link("Finish your registration here") + end end end @@ -103,7 +105,7 @@ def perform_non_authorized_action [ decidim.account_path, decidim.notifications_settings_path, - decidim.data_portability_path, + decidim.download_your_data_path, decidim.own_user_groups_path, decidim.user_interests_path, decidim.notifications_path, @@ -141,7 +143,7 @@ def perform_non_authorized_action it "allows answering the questionnaire" do visit main_component_path(surveys_component) - expect(page).to have_i18n_content(questionnaire.title, upcase: true) + expect(page).to have_i18n_content(questionnaire.title) expect(page).to have_i18n_content(questionnaire.description) fill_in(question.body["en"], with: "My first answer") diff --git a/decidim-ephemeral_participation/spec/system/user/session_spec.rb b/decidim-ephemeral_participation/spec/system/user/session_spec.rb index faf0b15c1..dbeea02f9 100644 --- a/decidim-ephemeral_participation/spec/system/user/session_spec.rb +++ b/decidim-ephemeral_participation/spec/system/user/session_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -describe "Succesful verification" do +describe "Session" do include ActiveSupport::Testing::TimeHelpers include_context "with ephemerable participation" diff --git a/decidim-ephemeral_participation/spec/system/user/successful_verification_spec.rb b/decidim-ephemeral_participation/spec/system/user/successful_verification_spec.rb index dc7e5fa96..fe0f09426 100644 --- a/decidim-ephemeral_participation/spec/system/user/successful_verification_spec.rb +++ b/decidim-ephemeral_participation/spec/system/user/successful_verification_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -describe "Succesful verification" do +describe "Successful verification" do include_context "with ephemerable participation" let!(:project) { create(:project, budget:) } @@ -29,7 +29,7 @@ it "authorizes the user and redirects back to where ephemeral participation button was clicked" do within_flash_messages do - expect(page).to have_content("You've been successfully authorized") + expect(page).to have_content("You have been successfully authorized") end expect(page).to have_current_path(ephemeral_participation_path) diff --git a/decidim-ephemeral_participation/spec/system/user/user_menu_spec.rb b/decidim-ephemeral_participation/spec/system/user/user_menu_spec.rb index 11568090b..20e862276 100644 --- a/decidim-ephemeral_participation/spec/system/user/user_menu_spec.rb +++ b/decidim-ephemeral_participation/spec/system/user/user_menu_spec.rb @@ -22,8 +22,8 @@ let(:current_user) { Decidim::User.last } let(:session_duration) { 5.minutes } let(:toggle_user_menu) do - within(".topbar__user__logged") do - click_on(current_user.name) + within(".main-bar__dropdown-container") do + click_on("Account") end end @@ -34,7 +34,7 @@ end it "shows alternative user menu" do - within(".topbar__user__logged") do + within(".main-bar__dropdown-container") do expect(page).to have_content("#{(session_duration / 1.minute).round} min. before automatic sign out") expect(page).to have_link("Finish your registration") expect(page).to have_link("Cancel and sign out") @@ -43,7 +43,7 @@ context "when the user clicks the sign out link" do before do - within(".topbar__user__logged") do + within(".main-bar__dropdown-container") do click_on("Cancel and sign out") end end @@ -59,7 +59,7 @@ context "when the user clicks the complete registration link" do before do - within(".topbar__user__logged") do + within(".main-bar__dropdown-container") do click_on("Finish your registration") end end diff --git a/decidim-ephemeral_participation/spec/system/user/verification_conflicts_spec.rb b/decidim-ephemeral_participation/spec/system/user/verification_conflicts_spec.rb index 262a3ccea..e85a9fe7a 100644 --- a/decidim-ephemeral_participation/spec/system/user/verification_conflicts_spec.rb +++ b/decidim-ephemeral_participation/spec/system/user/verification_conflicts_spec.rb @@ -37,13 +37,7 @@ it "creates verification conflict and notifies admins" do expect(Decidim::Verifications::Conflict.count).to eq(1) - notification_job = { - job: Decidim::EventPublisherJob, - args: array_including("decidim.events.verifications.managed_user_error_event"), - queue: "events" - } - - expect(enqueued_jobs.last).to match(notification_job) + expect(enqueued_jobs.last[:args]).to include("decidim.events.verifications.managed_user_error_event") end it "shows an error" do @@ -172,7 +166,6 @@ let(:submit_password_form) do within("form#password_new_user") do fill_in(:password_user_password, with: "decidim123456") - fill_in(:password_user_password_confirmation, with: "decidim123456") find("*[type=submit]").click end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index d7beb130d..c06fa2dfc 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -5,7 +5,7 @@ require File.expand_path("../config/environment", __dir__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? -require "spec_helper" +require_relative "spec_helper" require "rspec/rails" # Add additional requires below this line. Rails is not loaded until this point!
- <% if @organization.official_img_header.attached? %> + <% if @organization.official_img_footer.attached? %> <%= link_to @organization.official_url do %> - <%= image_tag @organization.attached_uploader(:official_img_header).url(host: @organization.host), alt: "", style: "max-height: 50px", class: "float-right" %> + <%= image_tag @organization.attached_uploader(:official_img_footer).url(host: @organization.host), alt: "", style: "max-height: 50px", class: "float-right" %> <% end %> <% end %>