Merge pull request #1578 from bertocq/chore/extract_social_share_partial

Extract social share buttons to shared partial view
This commit is contained in:
Juanjo Bazán
2017-05-31 10:50:56 +02:00
committed by GitHub
6 changed files with 35 additions and 50 deletions

View File

@@ -107,16 +107,11 @@
</p>
</div>
<% end %>
<div id="social-share" class="sidebar-divider"></div>
<h2><%= t("budgets.investments.show.share") %></h2>
<div class="social-share-full">
<%= social_share_button_tag("#{investment.title} #{setting['twitter_hashtag']}") %>
<a href="whatsapp://send?text=<%= investment.title.gsub(/\s/, '%20') %>&nbsp;<%= budget_investment_url(budget_id: investment.budget_id, id: investment.id) %>"
class="show-for-small-only" data-action="share/whatsapp/share">
<span class="icon-whatsapp whatsapp"></span>
<span class="sr-only"><%= t("social.whatsapp") %></span>
</a>
</div>
<%= render partial: 'shared/social_share', locals: {
share_title: t("budgets.investments.show.share"),
title: investment.title,
url: budget_investment_url(budget_id: investment.budget_id, id: investment.id)
} %>
</aside>
</div>
</section>

View File

@@ -52,16 +52,11 @@
<div id="<%= dom_id(@debate) %>_votes">
<%= render 'debates/votes', debate: @debate %>
</div>
<div class="sidebar-divider"></div>
<h2><%= t("debates.show.share") %></h2>
<div class="social-share-full">
<%= social_share_button_tag("#{@debate.title} #{setting['twitter_hashtag']}") %>
<a href="whatsapp://send?text=<%= @debate.title.gsub(/\s/, '%20') %>&nbsp;<%= debate_url(@debate) %>"
class="show-for-small-only" data-action="share/whatsapp/share">
<span class="icon-whatsapp whatsapp"></span>
<span class="sr-only"><%= t("social.whatsapp") %></span>
</a>
</div>
<%= render partial: 'shared/social_share', locals: {
share_title: t("debates.show.share"),
title: @debate.title,
url: debate_url(@debate)
} %>
</aside>
</div>
</div>

View File

@@ -38,16 +38,11 @@
</div>
<aside class="small-12 medium-3 column">
<div id="social-share" class="sidebar-divider"></div>
<h2><%= t("proposals.show.share") %></h2>
<div class="social-share-full">
<%= social_share_button_tag("#{@poll.name} #{setting['twitter_hashtag']}") %>
<% if browser.device.mobile? %>
<a href="whatsapp://send?text=<%= @poll.name %> <%= poll_url %>" data-action="share/whatsapp/share">
<span class="icon-whatsapp whatsapp"></span>
</a>
<% end %>
</div>
<%= render partial: 'shared/social_share', locals: {
share_title: t("proposals.show.share"),
title: @poll.name,
url: poll_url
} %>
</aside>
</div>
</div>

View File

@@ -131,16 +131,11 @@
{ proposal: @proposal, vote_url: vote_proposal_path(@proposal, value: 'yes') } %>
<% end %>
</div>
<div id="social-share" class="sidebar-divider"></div>
<h2><%= t("proposals.show.share") %></h2>
<div class="social-share-full">
<%= social_share_button_tag("#{@proposal.title} #{setting['twitter_hashtag']}") %>
<a href="whatsapp://send?text=<%= @proposal.title.gsub(/\s/, '%20') %>&nbsp;<%= proposal_url(@proposal) %>"
class="show-for-small-only" data-action="share/whatsapp/share">
<span class="icon-whatsapp whatsapp"></span>
<span class="sr-only"><%= t("social.whatsapp") %></span>
</a>
</div>
<%= render partial: 'shared/social_share', locals: {
share_title: t("proposals.show.share"),
title: @proposal.title,
url: proposal_url(@proposal)
} %>
</aside>
</div>
</div>

View File

@@ -0,0 +1,10 @@
<div id="social-share" class="sidebar-divider"></div>
<h2><%= share_title %></h2>
<div class="social-share-full">
<%= social_share_button_tag("#{title} #{setting['twitter_hashtag']}") %>
<a href="whatsapp://send?text=<%= title.gsub(/\s/, '%20') %>&nbsp;<%= url %>"
class="show-for-small-only" data-action="share/whatsapp/share">
<span class="icon-whatsapp whatsapp"></span>
<span class="sr-only"><%= t("social.whatsapp") %></span>
</a>
</div>

View File

@@ -40,16 +40,11 @@
{ spending_proposal: @spending_proposal, vote_url: vote_spending_proposal_path(@spending_proposal, value: 'yes') } %>
</div>
</div>
<div class="sidebar-divider"></div>
<h3><%= t("spending_proposals.show.share") %></h3>
<div class="social-share-full">
<%= social_share_button_tag("#{@spending_proposal.title} #{setting['twitter_hashtag']}") %>
<a href="whatsapp://send?text=<%= @spending_proposal.title.gsub(/\s/, '%20') %>&nbsp;<%= spending_proposal_url(@spending_proposal) %>"
class="show-for-small-only" data-action="share/whatsapp/share">
<span class="icon-whatsapp whatsapp"></span>
<span class="sr-only"><%= t("social.whatsapp") %></span>
</a>
</div>
<%= render partial: 'shared/social_share', locals: {
share_title: t("spending_proposals.show.share"),
title: @spending_proposal.title,
url: spending_proposal_url(@spending_proposal)
} %>
</aside>
</div>