Skip to content

Commit

Permalink
add link settings for intro
Browse files Browse the repository at this point in the history
  • Loading branch information
antopalidi committed Aug 8, 2023
1 parent fd59863 commit fbb66bc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
</tr>
<tr>
<td align="center" style="padding: 20px;" class="intro-button">
<%= link_to "Read more", "#", class: "button expanded small" %>
<% link = link_for(:intro_link_url) %>
<%= link_to translated_text_for(:intro_link_text), link, target: :blank if link %>
</td>
</tr>
</table>
6 changes: 3 additions & 3 deletions app/cells/decidim/newsletter_agenda/agenda_events_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ def representation_url(image)

def host_options
@host_options ||= begin
options = Rails.configuration.action_mailer.default_url_options || {}
options.merge(host: decidim.root_url(host: organization.host))
end
options = Rails.configuration.action_mailer.default_url_options || {}
options.merge(host: decidim.root_url(host: organization.host))
end
end

def organization_handler_attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<% form.fields_for :settings, settings do |settings_fields| %>
<%= settings_fields.translated :text_field, :intro_title, label: t(".intro_title") %>
<%= settings_fields.translated :editor, :intro_text, label: t(".intro_text") %>
<%= settings_fields.translated :text_field, :intro_link_text, label: t(".intro_link_text") %>
<%= settings_fields.text_field :intro_link_url, label: t(".intro_link_url") %>
<% end %>
<% form.fields_for :images, form.object.images do |images_fields| %>
<%= images_fields.upload :main_image, label: t(".main_image") %>
Expand Down
3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ en:
instagram: Instagram
interpolations_hint: 'Hint: You can use "%{name}" anywhere in the body or
subject and it will be replaced by the recipient''s name.'
intro_link_text: Introduction link text
intro_link_url: Introduction link URL
intro_text: Introduction text
intro_title: Introduction title
introduction: Introduction
Expand Down Expand Up @@ -85,6 +87,7 @@ en:
footer_social_links_title_preview: Follow us on social networks
footer_title_preview: Whether you want to see what you missed or you want
to remember it
intro_link_text_preview: Read more
intro_text_preview: 'Dummy text for body: Maecenas ac nisl vitae lectus pretium
facilisis. Etiam facilisis sem nibh, sit amet rutrum mi aliquam nec. Sed
id urna at nisl pretium mollis eu vel velit. Proin vitae suscipit urna,
Expand Down
11 changes: 11 additions & 0 deletions lib/decidim/newsletter_agenda/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ class Engine < ::Rails::Engine
translated: true,
preview: -> { I18n.t("decidim.newsletter_templates.agenda_events.intro_text_preview") }
)
settings.attribute(
:intro_link_text,
type: :text,
translated: true,
preview: -> { I18n.t("decidim.newsletter_templates.agenda_events.intro_link_text_preview") }
)
settings.attribute(
:intro_link_url,
type: :text,
preview: -> { "https://example.com" }
)
settings.attribute(
:body_title,
type: :text,
Expand Down

0 comments on commit fbb66bc

Please sign in to comment.