-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:PEMB2030/decidim-capitalofdemocracy…
…-barcelona # Conflicts: # package-lock.json
- Loading branch information
Showing
37 changed files
with
894 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module StatisticCellOverride | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
include Decidim::IconHelper | ||
end | ||
end | ||
end |
25 changes: 25 additions & 0 deletions
25
app/cells/decidim/content_blocks/active_processes/show.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<section id="active-processes" class="extended home-section"> | ||
<div class="wrapper-home"> | ||
<div class="row column"> | ||
<h3 class="section-heading"><%= t(".title") %></h3> | ||
<div class="text-center"> | ||
<div class="row small-up-1 medium-up-3"> | ||
<% (1..3).each do |i| %> | ||
<div class="column"> | ||
<div class="card"> | ||
<%= link_to link_url(i) do %> | ||
<% if (image_url = image_url_for(i)) %> | ||
<%= image_tag image_url %> | ||
<% end %> | ||
<h3 class="heading3 card-header text-left ml-s" style="color: <%= text_color(i) %>;"><%= link_text(i) | ||
%></h3> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
<%= button %> | ||
</div> | ||
</div> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module ContentBlocks | ||
class ActiveProcessesCell < Decidim::ViewModel | ||
def show | ||
render | ||
end | ||
|
||
def link_url(attribute) | ||
model.settings["link_url_#{attribute}"] | ||
end | ||
|
||
def link_text(attribute) | ||
translated_attribute(model.settings["link_text_#{attribute}"]) | ||
end | ||
|
||
def image_url_for(attribute) | ||
return unless has_image?(attribute) | ||
|
||
blob = image_blob(attribute) | ||
return if blob.nil? | ||
|
||
variant = blob.variant(resize_to_fit: [400, 300]).processed | ||
url_for(variant) | ||
end | ||
|
||
def text_color(attribute) | ||
model.settings["text_color_#{attribute}"] | ||
end | ||
|
||
def button | ||
return unless button_text && button_url | ||
|
||
link_to button_text, button_url, class: "button hollow" | ||
end | ||
|
||
private | ||
|
||
def image_blob(attribute) | ||
model.images_container.send("image_#{attribute}").blob | ||
end | ||
|
||
def has_image?(attribute) | ||
image = model.images_container.send("image_#{attribute}") | ||
image.present? && image.attached? | ||
end | ||
|
||
def button_text | ||
translated_attribute(model.settings.button_text) | ||
end | ||
|
||
def button_url | ||
model.settings.button_url | ||
end | ||
end | ||
end | ||
end |
33 changes: 33 additions & 0 deletions
33
app/cells/decidim/content_blocks/active_processes_settings_form/show.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<ul class="tabs" data-tabs id="active-processes-tabs"> | ||
<% (1..3).each do |i| %> | ||
<li class="tabs-title <%= 'is-active' if i == 1 %>"> | ||
<a href="#panel<%= i %>" <%= 'aria-selected="true"' if i == 1 %> data-tabs-target="panel<%= i %>">Item <%= i %></a> | ||
</li> | ||
<% end %> | ||
</ul> | ||
|
||
<div class="tabs-content" data-tabs-content="active-processes-tabs"> | ||
<% (1..3).each do |i| %> | ||
<div class="tabs-panel <%= 'is-active' if i == 1 %>" id="panel<%= i %>"> | ||
<fieldset class="fieldset"> | ||
<% form.fields_for :settings, form.object.settings do |settings_fields| %> | ||
<%= settings_fields.translated :text_field, "link_text_#{i}".to_sym, label: t("decidim.content_blocks.active_processes_settings_form.link_text") %> | ||
<%= settings_fields.text_field "link_url_#{i}".to_sym, label: t("decidim.content_blocks.active_processes_settings_form.link_url") %> | ||
<%= settings_fields.text_field "text_color_#{i}", label: t("decidim.content_blocks.active_processes_settings_form.text_color"), type: "color" %> | ||
<% end %> | ||
|
||
<div class="organization-images"> | ||
<% form.fields_for :images, form.object.images do |images_fields| %> | ||
<%= images_fields.upload "image_#{i}".to_sym, label: t("decidim.content_blocks.active_processes_settings_form.image") %> | ||
<% end %> | ||
</div> | ||
</fieldset> | ||
</div> | ||
<% end %> | ||
<fieldset class="fieldset"> | ||
<% form.fields_for :settings, form.object.settings do |settings_fields| %> | ||
<%= settings_fields.translated :text_field, :button_text, label: t("decidim.content_blocks.active_processes_settings_form.button_text") %> | ||
<%= settings_fields.text_field :button_url, label: t("decidim.content_blocks.active_processes_settings_form.button_url") %> | ||
<% end %> | ||
</fieldset> | ||
</div> |
9 changes: 9 additions & 0 deletions
9
app/cells/decidim/content_blocks/active_processes_settings_form_cell.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module ContentBlocks | ||
class ActiveProcessesSettingsFormCell < Decidim::ViewModel | ||
alias form model | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<section id="hero" class="extended hero home-section" style="background-image:url('<%= background_image %>');"> | ||
<div class="hero__container"> | ||
<div class="row"> | ||
<div class="columns small-centered large-10"> | ||
<h1 class="text-highlight heading1 hero-heading"> | ||
<%= welcome_text.html_safe %> | ||
</h1> | ||
<h3 class="text-highlight subtitle-hero"> | ||
<%= subtitle_text.html_safe %> | ||
</h3> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="columns small-centered small-6 medium-4 mediumlarge-3"> | ||
<%= cta_button %> | ||
</div> | ||
</div> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module ContentBlocks | ||
class ExtendedHeroCell < Decidim::ContentBlocks::HeroCell | ||
def show | ||
render | ||
end | ||
|
||
def welcome_text | ||
if translated_welcome_text.blank? | ||
default_welcome_text | ||
else | ||
processed_welcome_text | ||
end | ||
end | ||
|
||
def subtitle_text | ||
decidim_sanitize(translated_subtitle) if translated_subtitle | ||
end | ||
|
||
private | ||
|
||
def translated_welcome_text | ||
translated_attribute(model.settings.welcome_title) | ||
end | ||
|
||
def translated_subtitle | ||
translated_attribute(model.settings.subtitle) | ||
end | ||
|
||
def default_welcome_text | ||
t("decidim.pages.home.hero.welcome", organization: current_organization.name) | ||
end | ||
|
||
def processed_welcome_text | ||
text_parts = translated_welcome_text.split("<br>", 2) | ||
content = content_tag(:span, sanitize(text_parts[0]), class: "no-wrap") | ||
content + (text_parts[1] ? ("<br>".html_safe + sanitize(text_parts[1])) : "") | ||
end | ||
|
||
# A MD5 hash of model attributes because is needed because | ||
# the model doesn't respond to cache_key_with_version nor updated_at method | ||
def cache_hash | ||
hash = [] | ||
hash << "decidim/content_blocks/hero" | ||
hash << Digest::MD5.hexdigest(model.attributes.to_s) | ||
hash << current_organization.cache_key_with_version | ||
hash << I18n.locale.to_s | ||
hash << background_image | ||
|
||
hash.join(Decidim.cache_key_separator) | ||
end | ||
end | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
app/cells/decidim/content_blocks/extended_hero_settings_form/show.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<% form.fields_for :settings, form.object.settings do |settings_fields| %> | ||
<%= settings_fields.translated :text_field, :welcome_title, label: t(".welcome_text") %> | ||
<%= settings_fields.translated :text_field, :subtitle, label: t(".subtitle") %> | ||
<% end %> | ||
<% form.fields_for :images, form.object.images do |images_fields| %> | ||
<%= images_fields.upload :background_image, label: t(".background_image") %> | ||
<% end %> |
13 changes: 13 additions & 0 deletions
13
app/cells/decidim/content_blocks/extended_hero_settings_form_cell.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module ContentBlocks | ||
class ExtendedHeroSettingsFormCell < Decidim::ViewModel | ||
alias form model | ||
|
||
def content_block | ||
options[:content_block] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="statistic__data flex--fsc <%= stat_dom_class %>"> | ||
<div class="statistic__icon flex--cc"> | ||
<%= icon "actions", class: "card--list__icon", role: "img", "aria-hidden": true, remove_icon_class: true %> | ||
</div> | ||
<div> | ||
<span class="statistic__number"> | ||
<%= stat_number %> | ||
</span> | ||
|
||
<h4 class="statistic__title"> | ||
<%= stat_title %> | ||
</h4> | ||
</div> | ||
</div> |
3 changes: 3 additions & 0 deletions
3
app/overrides/layouts/decidim/_logo/replace_logo.html.erb.deface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- replace 'erb[silent]:contains("if organization.logo.attached?")' closing_selector 'erb[silent]:contains("end")' --> | ||
|
||
<%= render partial: "layouts/decidim/header_logo", locals: {organization: organization} %> |
22 changes: 22 additions & 0 deletions
22
app/overrides/layouts/decidim/_main_footer/replace_main_footer_logo.html.erb.deface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- replace ".main-footer" --> | ||
|
||
<div class="main-footer"> | ||
<% if current_organization && current_organization.official_img_footer.attached? %> | ||
<%= link_to current_organization.official_url, class: "main-footer__badge" do %> | ||
<%= image_tag current_organization.attached_uploader(:official_img_footer).path, alt: current_organization.name %> | ||
<% end %> | ||
<% end %> | ||
<div class="row"> | ||
<div class="main-footer__content flex--sbc column"> | ||
<div class="logos flex--sbc"> | ||
<div class="footer-logo"> | ||
<%= image_pack_tag("media/images/logo_capitalitat.png") %> | ||
</div> | ||
<div class="footer-logo"> | ||
<%= image_pack_tag("media/images/logo_footer_2.png") %> | ||
</div> | ||
</div> | ||
<%= render partial: "layouts/decidim/social_media_links" %> | ||
</div> | ||
</div> | ||
</div> |
Oops, something went wrong.