Skip to content

Commit

Permalink
Custom footer with Platoniq and EU logos (#4)
Browse files Browse the repository at this point in the history
* Custom footer with Platoniq and EU logos

* Lint
  • Loading branch information
fblupi authored Apr 25, 2024
1 parent b4998bf commit d4d26e1
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 6 deletions.
Binary file added app/packs/images/eu-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/packs/images/platoniq-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions app/views/layouts/decidim/footer/_mini.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="mini-footer">
<div class="container flex flex-wrap items-center gap-4 text-white pb-8">
<%= image_pack_tag "media/images/eu-logo.png", alt: t("eu.footer.logo"), class: "max-h-16 flex-none" %>
<p class="text-xs max-w-md">
<%= t("eu.footer.text") %>
</p>
</div>
<div class="mini-footer__content flex-wrap gap-8">
<div class="flex justify-start gap-10 items-center text-white">
<div>
<a rel="decidim noopener noreferrer" href="https://journal.platoniq.net/" target="_blank" data-external-link="false">
<span class="text-xs"><%= t("platoniq.footer.text") %></span>
<%= image_pack_tag("media/images/platoniq-logo.png", alt: t("platoniq.footer.logo"), class: "max-h-8 block") %>
</a>
</div>
<div>
<a rel="decidim noopener noreferrer" href="https://decidim.org/" target="_blank" data-external-link="false">
<%= image_pack_tag("media/images/decidim-logo.svg", alt: t("layouts.decidim.footer.decidim_logo"), class: "max-h-8 block") %>
</a>
<div class="text-xs mt-2 [&_a]:underline">
<%= t("layouts.decidim.footer.made_with_open_source").html_safe %>
</div>
</div>
</div>
<a class="flex gap-1 hover:opacity-50" rel="license noopener noreferrer" href="http://creativecommons.org/licenses/by-sa/4.0/" target="_blank" data-external-link="false">
<span class="sr-only"><%= t("layouts.decidim.footer.cc_by_license") %></span>
<%= icon "creative-commons-line", class: "w-6 h-6 fill-current" %>
<%= icon "creative-commons-by-line", class: "w-6 h-6 fill-current" %>
<%= icon "creative-commons-sa-line", class: "w-6 h-6 fill-current" %>
</a>
</div>
</div>
13 changes: 13 additions & 0 deletions config/i18n-tasks.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions config/locales/eu.en.yml
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 6 additions & 0 deletions config/locales/platoniq.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
en:
platoniq:
footer:
logo: Platoniq Foundation - Creativity and Democracy
text: Made with ♥ by
35 changes: 35 additions & 0 deletions spec/lib/overrides_spec.rb
Original file line number Diff line number Diff line change
@@ -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" => "cf7e273390b5a94b7df7167e37038ec4"
}
}
]

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
10 changes: 10 additions & 0 deletions spec/shared/visiting_organization_homepage.rb
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions spec/system/eu_footer_spec.rb
Original file line number Diff line number Diff line change
@@ -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
7 changes: 1 addition & 6 deletions spec/system/homepage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
12 changes: 12 additions & 0 deletions spec/system/platoniq_footer_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d4d26e1

Please sign in to comment.