diff --git a/.gitignore b/.gitignore index 038b992..88af8e5 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,9 @@ tailwind.config.js # Ignore rspec failures .rspec-failures +# Ignore public/sw.js* +public/sw.js* + # Capistrano Capfile config/deploy.rb diff --git a/app/packs/images/eu-logo.png b/app/packs/images/eu-logo.png new file mode 100644 index 0000000..accf0d6 Binary files /dev/null and b/app/packs/images/eu-logo.png differ diff --git a/app/packs/images/platoniq-logo.png b/app/packs/images/platoniq-logo.png new file mode 100644 index 0000000..76032c5 Binary files /dev/null and b/app/packs/images/platoniq-logo.png differ diff --git a/app/views/layouts/decidim/footer/_mini.html.erb b/app/views/layouts/decidim/footer/_mini.html.erb new file mode 100644 index 0000000..d197a9d --- /dev/null +++ b/app/views/layouts/decidim/footer/_mini.html.erb @@ -0,0 +1,32 @@ + diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml new file mode 100644 index 0000000..621c5a1 --- /dev/null +++ b/config/i18n-tasks.yml @@ -0,0 +1,13 @@ +--- + +base_locale: en +locales: [en] + +data: + read: + - 'config/locales/*.%{locale}.yml' + +ignore_missing: + - layouts.decidim.footer.cc_by_license + - layouts.decidim.footer.decidim_logo + - layouts.decidim.footer.made_with_open_source diff --git a/config/locales/eu.en.yml b/config/locales/eu.en.yml new file mode 100644 index 0000000..20e7150 --- /dev/null +++ b/config/locales/eu.en.yml @@ -0,0 +1,9 @@ +--- +en: + eu: + footer: + logo: 'European Union flag: Funded by the European Union' + text: Views and opinions expressed are however those of the author(s) only and + do not necessarily reflect those of the European Union or the European Research + Executive Agency. Neither the European Union nor the granting authority can + be held responsible for them. diff --git a/config/locales/platoniq.en.yml b/config/locales/platoniq.en.yml new file mode 100644 index 0000000..c426b46 --- /dev/null +++ b/config/locales/platoniq.en.yml @@ -0,0 +1,6 @@ +--- +en: + platoniq: + footer: + logo: Platoniq Foundation - Creativity and Democracy + text: Made with ♥ by diff --git a/spec/lib/overrides_spec.rb b/spec/lib/overrides_spec.rb new file mode 100644 index 0000000..57d1d76 --- /dev/null +++ b/spec/lib/overrides_spec.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +require "rails_helper" + +# We make sure that the checksum of the file overridden is the same +# as the expected. If this test fails, it means that the overridden +# file should be updated to match any change/bug fix introduced in the core +checksums = [ + { + package: "decidim-core", + files: { + # views + "/app/views/layouts/decidim/footer/_mini.html.erb" => "ccead2f5f20557ea4db1501de943f82b" + } + } +] + +describe "Overridden files", type: :view do + checksums.each do |item| + spec = Gem::Specification.find_by_name(item[:package]) + item[:files].each do |file, signature| + next unless spec + + it "#{spec.gem_dir}#{file} matches checksum" do + expect(md5("#{spec.gem_dir}#{file}")).to eq(signature) + end + end + end + + private + + def md5(file) + Digest::MD5.hexdigest(File.read(file)) + end +end diff --git a/spec/shared/visiting_organization_homepage.rb b/spec/shared/visiting_organization_homepage.rb new file mode 100644 index 0000000..7d980be --- /dev/null +++ b/spec/shared/visiting_organization_homepage.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +shared_context "when visiting organization homepage" do + let(:organization) { create(:organization) } + + before do + switch_to_host(organization.host) + visit decidim.root_path + end +end diff --git a/spec/system/eu_footer_spec.rb b/spec/system/eu_footer_spec.rb new file mode 100644 index 0000000..11b4c74 --- /dev/null +++ b/spec/system/eu_footer_spec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +require "rails_helper" + +describe "Has EU footer", perform_enqueued: true do + include_context "when visiting organization homepage" + + it "renders the eu flag in the footer" do + expect(page).to have_xpath("//img[@alt='European Union flag: Funded by the European Union']") + end +end diff --git a/spec/system/homepage_spec.rb b/spec/system/homepage_spec.rb index 80a86f7..3ec4c1b 100644 --- a/spec/system/homepage_spec.rb +++ b/spec/system/homepage_spec.rb @@ -3,12 +3,7 @@ require "rails_helper" describe "Visit the home page", perform_enqueued: true do - let(:organization) { create(:organization) } - - before do - switch_to_host(organization.host) - visit decidim.root_path - end + include_context "when visiting organization homepage" it "renders the home page" do expect(page).to have_content("Home") diff --git a/spec/system/platoniq_footer_spec.rb b/spec/system/platoniq_footer_spec.rb new file mode 100644 index 0000000..9a09705 --- /dev/null +++ b/spec/system/platoniq_footer_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require "rails_helper" + +describe "Has Platoniq footer", perform_enqueued: true do + include_context "when visiting organization homepage" + + it "renders the platoniq logo in the footer" do + expect(page).to have_content("Made with ♥ by") + expect(page).to have_xpath("//img[@alt='Platoniq Foundation - Creativity and Democracy']") + end +end