Skip to content

Commit

Permalink
🐛 Merge fix for CTA path #488
Browse files Browse the repository at this point in the history
  • Loading branch information
moustachu committed Mar 13, 2019
1 parent 6ae9cfa commit 4ce6f6c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="text-ellipsis"><strong><%= step_title %></strong></div>
</div>
<% end %>
<%= link_to resource_path, class: "card__button button button--sc secondary light small" do %>
<%= link_to step_cta_path, class: "card__button button button--sc secondary light small" do %>
<%= step_cta_text.presence || t("participatory_processes.promoted_process.take_part", scope: "layouts.decidim") %>
<% end %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ def step_cta_text
end
end

def step_cta_path
if model.active_step&.cta_path.present?
model.active_step.cta_path
else
resource_path
end
end

def step_title
translated_attribute model.active_step.title
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
style="background-image:url(<%= promoted_process.hero_image.url %>)">
<div class="card__content row collapse">
<div class="large-6 large-offset-6 columns">
<%= link_to participatory_process_path(promoted_process), class: "button expanded button--sc" do %>
<% if promoted_process.active_step&.cta_path.present? %>
<%= cta_link = participatory_process_path(promoted_process) + "/" + promoted_process.active_step.cta_path %>
<% else %>
<%= cta_link = participatory_process_path(promoted_process) %>
<% end %>
<%= link_to cta_link, class: "button expanded button--sc" do %>
<% if translated_in_current_locale(promoted_process.active_step&.cta_text) %>
<%= translated_attribute(promoted_process.active_step.cta_text) %>
<% else %>
Expand Down

0 comments on commit 4ce6f6c

Please sign in to comment.