Merge pull request #113 from medialab-prado/107-social-share-for-annotations

Social share buttons for annotation
This commit is contained in:
Amaia Castro
2017-02-15 13:37:50 +01:00
committed by GitHub
9 changed files with 74 additions and 34 deletions

View File

@@ -525,7 +525,15 @@ $epigraph-line-height: rem-calc(22);
}
.draft-panels {
position: relative;
padding: 2rem 0;
aside.absolute {
@include breakpoint(medium) {
position: absolute;
right: 0;
}
}
.draft-chooser {
margin-bottom: 2rem;

View File

@@ -298,7 +298,8 @@
.proposal-show,
.investment-project-show,
.debate-quiz,
.budget-investment-show {
.budget-investment-show,
.draft-panels {
p {
word-wrap: break-word;

View File

@@ -0,0 +1,23 @@
<div class="row draft-chooser">
<div class="small-12 medium-6 column">
<h3><%= t('legislation.annotations.version_chooser.seeing_version') %></h3>
<div class="select-box">
<%= form_tag go_to_version_legislation_process_draft_versions_path(process), method: :get, id: "draft_version_go_to_version" do %>
<%= select_tag "draft_version_id", options_from_collection_for_select(process.draft_versions.published, 'id', 'display_title', draft_version.id), "aria-label": t('legislation.draft_versions.show.select_draft_version') %>
<%= hidden_field_tag "redirect_action", "annotations" %>
<%= submit_tag t('legislation.draft_versions.show.select_version_submit'), class: "button" %>
<% end %>
</div>
<span><%= t('legislation.draft_versions.show.updated_at', date: format_date(@draft_version.updated_at)) %></span>
</div>
<div class="small-12 medium-3 column">
<%= link_to t('legislation.annotations.version_chooser.see_text'), legislation_process_draft_version_path(process, draft_version), title: t('legislation.annotations.version_chooser.see_text'), class: "button strong" %>
</div>
<aside class="small-12 medium-3 column">
<div class="sidebar-divider"></div>
<h2>Compartir</h2>
<div class="social-share-full">
<%= render '/legislation/shared/share_buttons', title: @draft_version.title %>
</div>
</aside>
</div>

View File

@@ -8,28 +8,33 @@
<div class="draft-panels small-12 column row">
<%= render 'version_chooser', process: @process, draft_version: @draft_version %>
<div class="row">
<div class="small-12 medium-8 column legislation-comments">
<% @annotations.each do |annotation| %>
<div class="comment">
<strong><%= t('.comments_about') %></strong>
<span class="pull-right">
<%= link_to legislation_process_draft_version_path(@process, @draft_version, anchor: "annotation-id-#{annotation.id}") do %>
<span><%= t('.see_in_context') %></span> <span class="icon-expand" aria-hidden="true"></span>
<% end %>
</span>
<div class="comment-section">
<%= annotation.context.try(:html_safe).presence || annotation.quote %>
</div>
<%= link_to legislation_process_draft_version_annotation_path(@process, @draft_version, annotation) do %>
<span class="icon-comments" aria-hidden="true"></span> <span><%= t('.comments_count', count: annotation.comments_count) %></span></a>
<% end %>
</div>
<% end %>
<aside class="small-12 medium-3 column absolute">
<div class="sidebar-divider"></div>
<h2>Compartir</h2>
<div class="social-share-full">
<%= render '/legislation/shared/share_buttons', title: "#{@draft_version.title} - #{@process.title}" %>
</div>
</div>
</aside>
</div>
<div class="small-12 medium-8 column row legislation-comments end">
<% @annotations.each do |annotation| %>
<div class="comment">
<strong><%= t('.comments_about') %></strong>
<span class="pull-right">
<%= link_to legislation_process_draft_version_path(@process, @draft_version, anchor: "annotation-id-#{annotation.id}") do %>
<span><%= t('.see_in_context') %></span> <span class="icon-expand" aria-hidden="true"></span>
<% end %>
</span>
<div class="comment-section">
<%= annotation.context.try(:html_safe).presence || annotation.quote %>
</div>
<%= link_to legislation_process_draft_version_annotation_path(@process, @draft_version, annotation) do %>
<span class="icon-comments" aria-hidden="true"></span> <span><%= t('.comments_count', count: annotation.comments_count) %></span></a>
<% end %>
</div>
<% end %>
</div>
</div>

View File

@@ -6,7 +6,7 @@
<div class="column row">
<div class="draft-panels small-12 column row">
<%= render 'version_chooser', process: @process, draft_version: @draft_version %>
<%= render 'slim_version_chooser', process: @process, draft_version: @draft_version %>
<div class="row">
<div class="small-12 medium-12 column legislation-comment">

View File

@@ -39,11 +39,7 @@
<div id="social-share" class="sidebar-divider"></div>
<h3><%= t('.share') %></h3>
<div class="social-share-full">
<div class="social-share-button" data-title="<%= @question.title.truncate(115) %>" data-img="" data-url="" data-desc="" data-via="">
<a rel="nofollow " data-site="twitter" class="ssb-icon ssb-twitter" onclick="return SocialShareButton.share(this);" title="<%= t('.share_twitter') %>" href="#"><span class="sr-only">twitter</span></a>
<a rel="nofollow " data-site="facebook" class="ssb-icon ssb-facebook" onclick="return SocialShareButton.share(this);" title="<%= t('.share_facebook') %>" href="#"><span class="sr-only">facebook</span></a>
<a rel="nofollow " data-site="google_plus" class="ssb-icon ssb-google_plus" onclick="return SocialShareButton.share(this);" title="<%= t('.share_gplus') %>" href="#"><span class="sr-only">google_plus</span></a>
</div>
<%= render '/legislation/shared/share_buttons', title: @question.title %>
</div>
</aside>
</div>

View File

@@ -0,0 +1,5 @@
<div class="social-share-button" data-title="<%= title.truncate(115) %>" data-img="" data-url="" data-desc="" data-via="">
<a rel="nofollow " data-site="twitter" class="ssb-icon ssb-twitter" onclick="return SocialShareButton.share(this);" title="<%= t('legislation.shared.share_twitter') %>" href="#"><span class="sr-only">twitter</span></a>
<a rel="nofollow " data-site="facebook" class="ssb-icon ssb-facebook" onclick="return SocialShareButton.share(this);" title="<%= t('legislation.shared.share_facebook') %>" href="#"><span class="sr-only">facebook</span></a>
<a rel="nofollow " data-site="google_plus" class="ssb-icon ssb-google_plus" onclick="return SocialShareButton.share(this);" title="<%= t('legislation.shared.share_gplus') %>" href="#"><span class="sr-only">google_plus</span></a>
</div>

View File

@@ -98,9 +98,6 @@ en:
next_question: Next question
first_question: First question
share: Share
share_twitter: Share on Twitter
share_facebook: Share on Facebook
share_gplus: Share on Google+
title: Collaborative legislation process
participation:
phase_not_open: This phase is not open
@@ -111,3 +108,7 @@ en:
verified_only: Only verified users can participate, %{verify_account}.
verify_account: verify your account
debate_phase_not_open: Debate phase has finished and answers are not accepted anymore
shared:
share_twitter: Share on Twitter
share_facebook: Share on Facebook
share_gplus: Share on Google+

View File

@@ -98,9 +98,6 @@ es:
next_question: Siguiente pregunta
first_question: Primera pregunta
share: Compartir
share_twitter: Compartir en Twitter
share_facebook: Compartir en Facebook
share_gplus: Compartir en Google+
title: Proceso de legislación colaborativa
participation:
phase_not_open: Esta fase no está abierta
@@ -111,3 +108,7 @@ es:
verified_only: Solo los usuarios verificados pueden participar en el debate, %{verify_account}.
verify_account: verifica tu cuenta
debate_phase_not_open: La fase de debate previo ya ha finalizado y en este momento no se aceptan respuestas
shared:
share_twitter: Compartir en Twitter
share_facebook: Compartir en Facebook
share_gplus: Compartir en Google+