Skip to content

Commit

Permalink
Create a new home content block with partner logos (#16)
Browse files Browse the repository at this point in the history
* add content block

* add logos

* add logos

---------

Co-authored-by: Ivan Vergés <ivan@pokecode.net>
  • Loading branch information
antopalidi and microstudi committed Sep 12, 2023
1 parent a586b29 commit b0efca1
Show file tree
Hide file tree
Showing 24 changed files with 110 additions and 5 deletions.
30 changes: 30 additions & 0 deletions app/cells/decidim/content_blocks/partner_logos/show.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<section id="partner-logos" class="extended home-section partner-logos">
<div class="wrapper-home">
<div class="row column text-center">
<h2 class="heading3"><%= I18n.t(".decidim.content_blocks.partner_logos.title1") %></h2>
<div class="row small-up-1 medium-up-<%= [first_row.size, 3].min %> home-bullets">
<% first_row.each do |image_path| %>
<div class="column">
<%= image_tag image_path %>
</div>
<% end %>
</div>
<h2 class="heading3"><%= I18n.t(".decidim.content_blocks.partner_logos.title2") %></h2>
<div class="row small-up-1 medium-up-<%= [second_row.size, 3].min %> home-bullets">
<% second_row.each do |image_path| %>
<div class="column">
<%= image_tag image_path %>
</div>
<% end %>
</div>
<h2 class="heading3"><%= I18n.t(".decidim.content_blocks.partner_logos.title3") %></h2>
<div class="row small-up-1 medium-up-<%= [third_row.size, 3].min %> home-bullets">
<% third_row.each do |image_path| %>
<div class="column">
<%= image_tag image_path %>
</div>
<% end %>
</div>
</div>
</div>
</section>
31 changes: 31 additions & 0 deletions app/cells/decidim/content_blocks/partner_logos_cell.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frozen_string_literal: true

module Decidim
module ContentBlocks
class PartnerLogosCell < Cell::ViewModel
def show
render
end

def partner_images(row)
dir = "partners#{row}/"
image_directory = Rails.public_path.join(dir.to_s)
Dir["#{image_directory}/*.png"].map do |file_path|
"/#{dir}/#{File.basename(file_path)}"
end
end

def first_row
@first_row ||= partner_images(1)
end

def second_row
@second_row ||= partner_images(2)
end

def third_row
@third_row ||= partner_images(3)
end
end
end
end
2 changes: 1 addition & 1 deletion app/cells/decidim/content_blocks/promo_video_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def video_url
case I18n.locale
when :en
# change to "en" when available
"/ecod_ca.mp4"
"/ecod_en.mp4"
else
"/ecod_ca.mp4"
end
Expand Down
31 changes: 27 additions & 4 deletions app/packs/stylesheets/partials/_html_block.scss
Original file line number Diff line number Diff line change
@@ -1,22 +1,45 @@
.promo-video {
background-color: $capitalitat-violet;
background-color: $capitalitat-violet !important;
padding: 4rem 0;
@media print, screen and (max-width: 40em) {
padding: 0;
}
}

.democracy-innovation {
background-color: $capitalitat-violet;
background-color: $capitalitat-violet !important;
padding: 4rem 0;
color: #ffffff;

.button {
color: #ffffff;
border-color: #fff;
}

.heading3 {
margin-bottom: 2rem;
}
}

.partner-logos {
h2 {
color: #fff;
}
.home-bullets {
.column {
margin: 2rem 0;
}
}
background-color: $capitalitat-violet !important;
.column img {
height: 70px;
}
.column {
@media print, screen and (max-width: 40em) {
margin-top: 2rem;
img {
height: 50px;
}
}
}
}
6 changes: 6 additions & 0 deletions config/initializers/conferences_hacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,9 @@
content_block.public_name_key = "decidim.content_blocks.promo_video.name"
content_block.default!
end

Decidim.content_blocks.register(:homepage, :partner_logos) do |content_block|
content_block.cell = "decidim/content_blocks/partner_logos"
content_block.public_name_key = "decidim.content_blocks.partner_logos.name"
content_block.default!
end
5 changes: 5 additions & 0 deletions config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ ca:
text_color: Color del text
extended_hero:
name: Hero ampliat
partner_logos:
name: Logos de partners
title1: Una iniciativa de
title2: Amb el suport de
title3: Amb la col·laboració de
promo_video:
name: Vídeo promocional
extended_hero_settings_form:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ en:
text_color: Text color
extended_hero:
name: Extended hero
partner_logos:
name: Partner logos
title1: An initiative of
title2: Supported by
title3: In collaboration with
promo_video:
name: Promo video
extended_hero_settings_form:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ es:
text_color: Color del texto
extended_hero:
name: Héroe extendido
partner_logos:
name: Logos de partners
title1: Una iniciativa de
title2: Con el apoyo de
title3: Con la colaboración de
promo_video:
name: Vídeo promocional
extended_hero_settings_form:
Expand Down
Binary file added public/ecod_en.mp4
Binary file not shown.
Binary file added public/partners1/capital.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 public/partners1/logo-ajuntament.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 public/partners1/pemb.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 public/partners2/amb.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 public/partners2/generalitat.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 public/partners3/cccb.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 public/partners3/cruilla.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 public/partners3/decidim.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 public/partners3/eurocities.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 public/partners3/icub.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 public/partners3/konrad.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 public/partners3/manifesta.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 public/partners3/naumann.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 public/partners3/reimagine.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 public/partners3/smatcity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b0efca1

Please sign in to comment.