Adds new social share partial for proposals
This commit is contained in:
10
app/views/proposals/_social_share.html.erb
Normal file
10
app/views/proposals/_social_share.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<%= render 'shared/social_share',
|
||||
share_title: share_title,
|
||||
title: proposal.title,
|
||||
url: proposal_url(proposal),
|
||||
description: t("proposals.share.message",
|
||||
summary: proposal.summary,
|
||||
org: setting['org_name']),
|
||||
mobile: t("proposals.share.message_mobile",
|
||||
summary: proposal.summary,
|
||||
handle: setting['twitter_handle']) %>
|
||||
@@ -10,7 +10,8 @@
|
||||
<%= t("proposals.proposal.supports", count: proposal.total_votes) %>
|
||||
<span>
|
||||
<abbr>
|
||||
<%= t("proposals.proposal.supports_necessary", number: number_with_delimiter(Proposal.votes_needed_for_success)) %>
|
||||
<%= t("proposals.proposal.supports_necessary",
|
||||
number: number_with_delimiter(Proposal.votes_needed_for_success)) %>
|
||||
</abbr>
|
||||
</span>
|
||||
</span>
|
||||
@@ -60,11 +61,7 @@
|
||||
|
||||
<% if voted_for?(@proposal_votes, proposal) && setting['twitter_handle'] %>
|
||||
<div class="share-supported">
|
||||
<%= render partial: 'shared/social_share', locals: {
|
||||
title: proposal.title,
|
||||
url: proposal_url(proposal),
|
||||
description: proposal.summary
|
||||
} %>
|
||||
<%= render 'proposals/social_share', proposal: proposal, share_title: false %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -192,12 +192,8 @@
|
||||
{ proposal: @proposal, vote_url: vote_proposal_path(@proposal, value: 'yes') } %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render partial: 'shared/social_share', locals: {
|
||||
share_title: t("proposals.show.share"),
|
||||
title: @proposal.title,
|
||||
url: proposal_url(@proposal),
|
||||
description: @proposal.summary
|
||||
} %>
|
||||
|
||||
<%= render 'proposals/social_share', proposal: @proposal, share_title: t("proposals.show.share") %>
|
||||
|
||||
<% if current_user %>
|
||||
<div class="sidebar-divider"></div>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
<% description = local_assigns.fetch(:description, '') %>
|
||||
<% description = truncate(ActionView::Base.full_sanitizer.sanitize(description), length: 140) %>
|
||||
<% if local_assigns[:share_title].present? %>
|
||||
<div id="social-share" class="sidebar-divider"></div>
|
||||
<p class="sidebar-title"><%= share_title %></p>
|
||||
<% end %>
|
||||
<div class="social-share-full">
|
||||
<%= social_share_button_tag("#{title} #{setting['twitter_hashtag']}",
|
||||
:url => local_assigns[:url],
|
||||
:image => local_assigns[:image_url].present? ? local_assigns[:image_url] : '',
|
||||
:desc => local_assigns[:description].present? ? local_assigns[:description] : '' ) %>
|
||||
<a href="whatsapp://send?text=<%= CGI.escape(title) %> <%= url %>"
|
||||
<%= social_share_button_tag("#{title} #{setting['twitter_hashtag']} #{setting['twitter_handle']}",
|
||||
url: local_assigns[:url],
|
||||
image: local_assigns.fetch(:image_url, ''),
|
||||
desc: description,
|
||||
'data-twitter-title': local_assigns[:mobile],
|
||||
'data-telegram-title': local_assigns[:mobile])%>
|
||||
<a href="whatsapp://send?text=<%= local_assigns[:mobile]%> <%= url %>"
|
||||
class="show-for-small-only" data-action="share/whatsapp/share">
|
||||
<span class="icon-whatsapp whatsapp"></span>
|
||||
<span class="show-for-sr"><%= t("social.whatsapp") %></span>
|
||||
|
||||
@@ -450,6 +450,9 @@ en:
|
||||
update:
|
||||
form:
|
||||
submit_button: Save changes
|
||||
share:
|
||||
message: "I supported the proposal %{summary} in %{org}. If you're interested, support it too!"
|
||||
message_mobile: "I supported the proposal %{summary} in %{handle}. If you're interested, support it too!"
|
||||
polls:
|
||||
all: "All"
|
||||
no_dates: "no date assigned"
|
||||
|
||||
Reference in New Issue
Block a user