Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eu platoniq footer #4

Merged
merged 7 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ tailwind.config.js
# Ignore rspec failures
.rspec-failures

# Ignore public/sw.js*
public/sw.js*

# Capistrano
Capfile
config/deploy.rb
Expand Down
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" => "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
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
11 changes: 11 additions & 0 deletions spec/system/platoniq_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 "Visit the home page", perform_enqueued: true do
include_context "when visiting organization homepage"

it "renders the home page" do
expect(page).to have_content("Home")
end
end
HHassig marked this conversation as resolved.
Show resolved Hide resolved
Loading