-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom colors and logo to newsletter templates (#124)
* Add custom colors to newsletter settings * Add overrides test * Add custom header logo to newsletters * Some refactor and fix details * Remove overrides locales * Fixes in CI workflows * Update override checksum * Use :test storage service for test env * Apply decidim_decidim_awesome:webpacker:install with updated some packages * Add test for new settings * Fix decorator --------- Co-authored-by: Oliver Valls <199462+tramuntanal@users.noreply.github.com>
- Loading branch information
1 parent
0364ccd
commit 82e89c0
Showing
28 changed files
with
1,386 additions
and
237 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
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
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,24 @@ | ||
<%# START DIBA CUSTOMIZATION %> | ||
<% if organization %> | ||
<% if defined?(custom_url_for_mail_root) && custom_url_for_mail_root.present? %> | ||
<% url = custom_url_for_mail_root %> | ||
<% else %> | ||
<% url = decidim.root_url(host: organization.host) %> | ||
<% end %> | ||
<%= link_to url do %> | ||
<% if has_image?("header_logo") %> | ||
<%= image_tag(header_logo_url("header_logo"), style: "max-height: 50px") %> | ||
<% elsif organization.logo.attached? %> | ||
<%= image_tag( | ||
organization.attached_uploader(:logo).variant_url(:medium, host: organization.host), | ||
style: "max-height: 50px", | ||
alt: "#{organization.name}" | ||
) %> | ||
<% else %> | ||
<span><%= organization.name %></span> | ||
<% end %> | ||
<% end %> | ||
<% else %> | ||
<%= Decidim.application_name %> | ||
<% end %> | ||
<%# END DIBA CUSTOMIZATION %> |
110 changes: 110 additions & 0 deletions
110
app/cells/decidim/newsletter_templates/basic_only_text/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,110 @@ | ||
<%# START DIBA CUSTOMIZATION %> | ||
<style> | ||
table td .decidim-bar { | ||
background-color: <%= header_background_color %> !important; | ||
} | ||
|
||
.newsletter-body { | ||
background-color: <%= body_background_color %> !important; | ||
} | ||
|
||
.newsletter-body p { | ||
color: <%= body_font_color %> !important; | ||
} | ||
</style> | ||
<%# END DIBA CUSTOMIZATION %> | ||
|
||
<table class="main container"> | ||
<tr> | ||
<td class="decidim-bar"> | ||
<table class="row collapse"> | ||
<tr> | ||
<th class="small-3 large-3 first columns decidim-bar"> | ||
<table> | ||
<tr> | ||
<th> | ||
</th> | ||
</tr> | ||
</table> | ||
</th> | ||
<th class="small-6 large-6 columns decidim-bar"> | ||
<table> | ||
<tr> | ||
<th> | ||
<center> | ||
<%# START DIBA CUSTOMIZATION %> | ||
<%= render partial: "mailer_logo", locals: { organization: organization, custom_url_for_mail_root: custom_url_for_mail_root } %> | ||
<%# END DIBA CUSTOMIZATION %> | ||
</center> | ||
</th> | ||
</tr> | ||
</table> | ||
</th> | ||
<th class="small-3 large-3 last columns decidim-bar"> | ||
<table> | ||
<tr> | ||
<th> | ||
<%# START DIBA CUSTOMIZATION %> | ||
<% unless has_image?("header_logo") %> | ||
<% if organization.official_img_header.attached? %> | ||
<%= link_to newsletter.organization_official_url do %> | ||
<%= image_tag organization.attached_uploader(:official_img_header).path, alt: "", style: "max-height: 50px", class: "float-right" %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<%# END DIBA CUSTOMIZATION %> | ||
</th> | ||
</tr> | ||
</table> | ||
</th> | ||
<th class="expander"></th> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
<%# START DIBA CUSTOMIZATION %> | ||
<tr class="newsletter-body"> | ||
<%# END DIBA CUSTOMIZATION %> | ||
<td> | ||
<table class="spacer"> | ||
<tbody> | ||
<tr> | ||
<td height="40px" style="font-size:40px;line-height:40px;"> </td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<table class="row content"> | ||
<tr> | ||
<th class="small-12 first columns"> | ||
<%= body %> | ||
</th> | ||
<th class="expander"></th> | ||
</tr> | ||
</table> | ||
|
||
<table class="row"> | ||
<tr> | ||
<th class="small-12 first columns"> | ||
</th> | ||
<th class="expander"></th> | ||
</tr> | ||
</table> | ||
|
||
<table class="row"> | ||
<tr> | ||
<th class="expander"></th> | ||
<th class="small-12 first columns cityhall-bar"> | ||
<div class="decidim-logo" style="float: right; text-align: right; padding-right: 16px"> | ||
<% if custom_url_for_mail_root.present? %> | ||
<%= link_to organization.name.html_safe, custom_url_for_mail_root %> | ||
<% else %> | ||
<%= link_to organization.name.html_safe, decidim.root_url(host: organization.host) %> | ||
<% end %> | ||
</div> | ||
</th> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> |
18 changes: 18 additions & 0 deletions
18
app/cells/decidim/newsletter_templates/basic_only_text_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,18 @@ | ||
<% form.fields_for :settings, form.object.settings do |settings_fields| %> | ||
<%= settings_fields.translated :editor, :body, label: t(".body") %> | ||
<%# START DIBA CUSTOMIZATION %> | ||
<div class="newsletter-colors-selector"> | ||
<%= settings_fields.text_field :header_background_color, label: t(".header_background_color"), type: "color", value: form.object.settings.header_background_color || "#1a181d" %> | ||
<%= settings_fields.text_field :body_background_color, label: t(".body_background_color"), type: "color", value: form.object.settings.body_background_color || "#fefefe" %> | ||
<%= settings_fields.text_field :body_font_color, label: t(".body_font_color"), type: "color" %> | ||
</div> | ||
<% form.fields_for :images, form.object.images do |images_fields| %> | ||
<%= images_fields.upload :header_logo, label: t(".header_logo") %> | ||
<% end %> | ||
<%# END DIBA CUSTOMIZATION %> | ||
<% end %> | ||
|
||
<div class="row column"> | ||
<%= t(".interpolations_hint") %> | ||
</div> |
147 changes: 147 additions & 0 deletions
147
app/cells/decidim/newsletter_templates/image_text_cta/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,147 @@ | ||
<style> | ||
<% if organization_primary_color %> | ||
table.button table td { | ||
background: <%= organization_primary_color %> !important | ||
} | ||
<% end %> | ||
|
||
/* START DIBA CUSTOMIZATION */ | ||
table td .decidim-bar { | ||
background-color: <%= header_background_color %> !important; | ||
} | ||
|
||
.newsletter-body { | ||
background-color: <%= body_background_color %> !important; | ||
} | ||
|
||
.newsletter-body p { | ||
color: <%= body_font_color %> !important; | ||
} | ||
/* END DIBA CUSTOMIZATION */ | ||
</style> | ||
|
||
<table class="main container"> | ||
<tr> | ||
<td class="decidim-bar"> | ||
<table class="row collapse"> | ||
<tr> | ||
<th class="small-3 large-3 first columns decidim-bar"> | ||
<table> | ||
<tr> | ||
<th> | ||
</th> | ||
</tr> | ||
</table> | ||
</th> | ||
<th class="small-6 large-6 columns decidim-bar"> | ||
<table> | ||
<tr> | ||
<th> | ||
<center> | ||
<%# START DIBA CUSTOMIZATION %> | ||
<%= render partial: "mailer_logo", locals: { organization: organization, custom_url_for_mail_root: custom_url_for_mail_root } %> | ||
<%# END DIBA CUSTOMIZATION %> | ||
</center> | ||
</th> | ||
</tr> | ||
</table> | ||
</th> | ||
<th class="small-3 large-3 last columns decidim-bar"> | ||
<table> | ||
<tr> | ||
<th> | ||
<%# START DIBA CUSTOMIZATION %> | ||
<% unless has_image?("header_logo") %> | ||
<% if organization.official_img_header.attached? %> | ||
<%= link_to newsletter.organization_official_url do %> | ||
<%= image_tag organization.attached_uploader(:official_img_header).path, alt: "", style: "max-height: 50px", class: "float-right" %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<%# END DIBA CUSTOMIZATION %> | ||
</th> | ||
</tr> | ||
</table> | ||
</th> | ||
<th class="expander"></th> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
<%# START DIBA CUSTOMIZATION %> | ||
<tr class="newsletter-body"> | ||
<%# END DIBA CUSTOMIZATION %> | ||
<td> | ||
<table class="spacer"> | ||
<tbody> | ||
<tr> | ||
<td height="40px" style="font-size:40px;line-height:40px;"> </td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<% if has_main_image? %> | ||
<table class="row content image"> | ||
<tr> | ||
<th class="small-12 first columns"> | ||
<%= main_image %> | ||
</th> | ||
<th class="expander"></th> | ||
</tr> | ||
</table> | ||
<% end %> | ||
|
||
<table class="row content"> | ||
<tr> | ||
<th class="small-12 first columns"> | ||
<%= introduction %> | ||
<% if has_cta? %> | ||
<p> </p> | ||
<table class="button expanded radius"> | ||
<tr> | ||
<td> | ||
<table> | ||
<tr> | ||
<td> | ||
<%= link_to cta_text, cta_url, target: :blank %> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
<p> </p> | ||
<% end %> | ||
<%= body %> | ||
</th> | ||
<th class="expander"></th> | ||
</tr> | ||
</table> | ||
|
||
<table class="row"> | ||
<tr> | ||
<th class="small-12 first columns"> | ||
</th> | ||
<th class="expander"></th> | ||
</tr> | ||
</table> | ||
|
||
<table class="row"> | ||
<tr> | ||
<th class="expander"></th> | ||
<th class="small-12 first columns cityhall-bar"> | ||
<div class="decidim-logo" style="float: right; text-align: right; padding-right: 16px"> | ||
<% if custom_url_for_mail_root.present? %> | ||
<%= link_to organization.name.html_safe, custom_url_for_mail_root %> | ||
<% else %> | ||
<%= link_to organization.name.html_safe, decidim.root_url(host: organization.host) %> | ||
<% end %> | ||
</div> | ||
</th> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> |
Oops, something went wrong.