-
+ |
-
+ |
@@ -19,7 +16,7 @@ table.button table td {
|
|
-
+ |
@@ -30,7 +27,7 @@ table.button table td {
|
|
-
+ |
@@ -94,11 +91,7 @@ table.button table td {
<%= body %>
-
- <% fields.each do |field| %>
- <%= field %>
-
- <% end %>
+ <%= color %>
|
|
diff --git a/app/cells/decidim_zuerich/newsletter_templates/test_cell.rb b/app/cells/decidim_zuerich/newsletter_templates/test_cell.rb
index b1edc9fa..1e0a40ae 100644
--- a/app/cells/decidim_zuerich/newsletter_templates/test_cell.rb
+++ b/app/cells/decidim_zuerich/newsletter_templates/test_cell.rb
@@ -19,14 +19,6 @@ def body
parse_interpolations(uninterpolated_body, recipient_user, newsletter.id)
end
- def fields
- %i[boolean integer string text].map do |type|
- field = model.settings.send("field_#{type}")
- translated = translated_attribute(field)
- parse_interpolations(translated, recipient_user, newsletter.id)
- end
- end
-
def uninterpolated_body
translated_attribute(model.settings.body)
end
@@ -43,6 +35,10 @@ def cta_text
)
end
+ def color
+ model.settings.color
+ end
+
def cta_url
translated_attribute(model.settings.cta_url)
end
@@ -59,8 +55,12 @@ def main_image_url
newsletter.template.images_container.attached_uploader(:main_image).url(host: organization.host)
end
- def organization_primary_color
- organization.colors["primary"]
+ def custom_logo
+ image_tag custom_logo_url
+ end
+
+ def custom_logo_url
+ newsletter.template.images_container.attached_uploader(:custom_logo).url(host: organization.host)
end
end
end
diff --git a/app/cells/decidim_zuerich/newsletter_templates/test_settings_form/show.erb b/app/cells/decidim_zuerich/newsletter_templates/test_settings_form/show.erb
index 61dfb1e2..30c07b62 100644
--- a/app/cells/decidim_zuerich/newsletter_templates/test_settings_form/show.erb
+++ b/app/cells/decidim_zuerich/newsletter_templates/test_settings_form/show.erb
@@ -5,15 +5,13 @@
<%= settings_fields.text_field :cta_url, label: t(".cta_url") %>
- <%= settings_fields.translated :editor, :body, label: t(".body") %>
+ <%= settings_fields.color_field :color, label: t(".color") %>
- <%= settings_fields.check_box :field_boolean, label: "Boolean" %>
- <%= settings_fields.number_field :field_integer, label: "Integer" %>
- <%= settings_fields.translated :text_field, :field_string, label: "String" %>
- <%= settings_fields.translated :editor, :field_text, label: "Text" %>
+ <%= settings_fields.translated :editor, :body, label: t(".body") %>
<% end %>
<% form.fields_for :images, form.object.images do |images_fields| %>
+ <%= images_fields.upload :custom_logo, label: t(".custom_logo") %>
<%= images_fields.upload :main_image, label: t(".main_image") %>
<% end %>
diff --git a/config/initializers/newsletter_templates/test.rb b/config/initializers/newsletter_templates/test.rb
index 63323290..c66bfc19 100644
--- a/config/initializers/newsletter_templates/test.rb
+++ b/config/initializers/newsletter_templates/test.rb
@@ -4,6 +4,11 @@
content_block.public_name_key = "decidim_zuerich.newsletter_templates.test.name"
content_block.images = [
+ {
+ name: :custom_logo,
+ uploader: "Decidim::NewsletterTemplateImageUploader",
+ preview: -> { organization.logo }
+ },
{
name: :main_image,
uploader: "Decidim::NewsletterTemplateImageUploader",
@@ -15,18 +20,10 @@
opts = -> (map) { {type: :text, translated: true, preview: "-"}.merge(map) }
content_block.settings do |settings|
- settings.attribute(:introduction, opts.(preview: -> { t.("introduction_preview") }))
- settings.attribute(:body, opts.(preview: -> { t.("body_preview") } ))
- settings.attribute(:cta_text, opts.(preview: -> { t.("cta_text_preview") } ))
- settings.attribute(:cta_url, opts.(preview: "http://google.com" ))
- settings.attribute(:field_boolean, opts.(type: :boolean, preview: "Wahrheit" ))
- settings.attribute(:field_integer, opts.(type: :integer, preview: "Zahl" ))
- settings.attribute(:field_string, opts.(type: :string, preview: "String" ))
- settings.attribute(:field_text, opts.(type: :text, preview: "Text" ))
- settings.attribute(:field_array, opts.(type: :array, preview: "Array" ))
- settings.attribute(:field_enum, opts.(type: :enum, preview: "Enum" ))
- settings.attribute(:field_select, opts.(type: :select, preview: "Select" ))
- settings.attribute(:field_scope, opts.(type: :scope, preview: "Scope" ))
- settings.attribute(:field_time, opts.(type: :time, preview: "Zeit" ))
+ settings.attribute(:introduction, opts.(preview: -> { t.("introduction_preview") }))
+ settings.attribute(:body, opts.(preview: -> { t.("body_preview") } ))
+ settings.attribute(:cta_text, opts.(preview: -> { t.("cta_text_preview") } ))
+ settings.attribute(:cta_url, opts.(preview: "http://google.com", translated: false ))
+ settings.attribute(:color, opts.(preview: "Farbe", translated: false ))
end
end
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 64419d23..285d226e 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -44,7 +44,7 @@ de:
not_found:
content_doesnt_exist: Diese Seite wurde leider nicht gefunden. Wir bitten um Verständnis.
title: Ups!
- decidim:
+ decidim:
admin:
menu:
clean: Datenbereinigung
| |