Add optional image_url parameter to social sharing partial.

This commit is contained in:
Senén Rodero Rodríguez
2017-06-21 20:57:46 +02:00
parent 4f5a552486
commit 534aa4146e
2 changed files with 6 additions and 3 deletions

View File

@@ -120,6 +120,7 @@
<%= render partial: 'shared/social_share', locals: { <%= render partial: 'shared/social_share', locals: {
share_title: t("budgets.investments.show.share"), share_title: t("budgets.investments.show.share"),
title: investment.title, title: investment.title,
image_url: investment.image.exists? ? URI(request.url) + investment.image.url(:thumb) : '',
url: budget_investment_url(budget_id: investment.budget_id, id: investment.id) url: budget_investment_url(budget_id: investment.budget_id, id: investment.id)
} %> } %>

View File

@@ -1,9 +1,11 @@
<% if local_assigns[:share_title].present? %> <% if local_assigns[:share_title].present? %>
<div id="social-share" class="sidebar-divider"></div> <div id="social-share" class="sidebar-divider"></div>
<p class="sidebar-title"><%= share_title %></p> <p class="sidebar-title"><%= share_title %></p>
<% end %> <% end %>
<div class="social-share-full"> <div class="social-share-full">
<%= social_share_button_tag("#{title} #{setting['twitter_hashtag']}") %> <%= social_share_button_tag("#{title} #{setting['twitter_hashtag']}",
:url => local_assigns[:url],
:image => local_assigns[:image_url].present? ? local_assigns[:image_url] : '' ) %>
<a href="whatsapp://send?text=<%= CGI.escape(title) %>&nbsp;<%= url %>" <a href="whatsapp://send?text=<%= CGI.escape(title) %>&nbsp;<%= url %>"
class="show-for-small-only" data-action="share/whatsapp/share"> class="show-for-small-only" data-action="share/whatsapp/share">
<span class="icon-whatsapp whatsapp"></span> <span class="icon-whatsapp whatsapp"></span>