Merge pull request #4101 from consul/dependabot/bundler/social-share-button-1.2.3

Bump social-share-button from 1.1.0 to 1.2.3
This commit is contained in:
Javi Martín
2021-02-08 17:00:06 +01:00
committed by GitHub
15 changed files with 149 additions and 201 deletions

View File

@@ -53,7 +53,7 @@ gem "rollbar", "~> 3.0.1"
gem "sassc-rails", "~> 2.1.2" gem "sassc-rails", "~> 2.1.2"
gem "savon", "~> 2.12.1" gem "savon", "~> 2.12.1"
gem "sitemap_generator", "~> 6.1.2" gem "sitemap_generator", "~> 6.1.2"
gem "social-share-button", "~> 1.1" gem "social-share-button", "~> 1.2.3"
gem "sprockets", "~> 3.7.2" gem "sprockets", "~> 3.7.2"
gem "translator-text", "~> 0.1.0" gem "translator-text", "~> 0.1.0"
gem "turbolinks", "~> 5.2.1" gem "turbolinks", "~> 5.2.1"

View File

@@ -557,7 +557,7 @@ GEM
sitemap_generator (6.1.2) sitemap_generator (6.1.2)
builder (~> 3.0) builder (~> 3.0)
smart_properties (1.15.0) smart_properties (1.15.0)
social-share-button (1.1.0) social-share-button (1.2.3)
coffee-rails coffee-rails
socksify (1.7.1) socksify (1.7.1)
spring (2.1.1) spring (2.1.1)
@@ -724,7 +724,7 @@ DEPENDENCIES
scss_lint (~> 0.59.0) scss_lint (~> 0.59.0)
selenium-webdriver (~> 3.142) selenium-webdriver (~> 3.142)
sitemap_generator (~> 6.1.2) sitemap_generator (~> 6.1.2)
social-share-button (~> 1.1) social-share-button (~> 1.2.3)
spring (~> 2.1.1) spring (~> 2.1.1)
spring-commands-rspec (~> 1.0.4) spring-commands-rspec (~> 1.0.4)
sprockets (~> 3.7.2) sprockets (~> 3.7.2)

View File

@@ -3,7 +3,7 @@
App.SocialShare = { App.SocialShare = {
initialize: function() { initialize: function() {
$(".social-share-button a").each(function() { $(".social-share-button a").each(function() {
$(this).append("<span class='show-for-sr'>" + ($(this).data("site")) + "</span>"); $(this).append("<span class='show-for-sr'>" + ($(this).data("site").replace(/_app$/, "")) + "</span>");
}); });
}, },
destroy: function() { destroy: function() {

View File

@@ -186,10 +186,6 @@
font-weight: normal; font-weight: normal;
} }
.icon-whatsapp::before {
content: "\f232";
}
.icon-zip::before { .icon-zip::before {
content: "\f1c6"; content: "\f1c6";
font-weight: normal; font-weight: normal;
@@ -285,7 +281,6 @@
.icon-instagram, .icon-instagram,
.icon-telegram, .icon-telegram,
.icon-twitter, .icon-twitter,
.icon-whatsapp,
.icon-youtube { .icon-youtube {
&::before { &::before {

View File

@@ -1569,17 +1569,15 @@ table {
} }
} }
.ssb-twitter { .social-share-button .ssb-icon {
background: #45b0e3; background-image: none;
background-image: none !important;
color: #fff; color: #fff;
height: $line-height * 2 !important; height: $icon-width;
position: relative; position: relative;
width: $line-height * 2 !important; width: $icon-width;
&::before { &::before {
content: "f"; font-family: "icons";
font-family: "icons" !important;
font-size: rem-calc(24); font-size: rem-calc(24);
left: 50%; left: 50%;
line-height: $line-height * 2; line-height: $line-height * 2;
@@ -1591,6 +1589,18 @@ table {
&:hover, &:hover,
&:focus { &:focus {
background: #fff; background: #fff;
}
}
.ssb-twitter {
background: #45b0e3;
&::before {
content: "f";
}
&:hover,
&:focus {
color: #40a2d1; color: #40a2d1;
} }
} }
@@ -1607,26 +1617,13 @@ table {
.ssb-facebook { .ssb-facebook {
background: #3b5998; background: #3b5998;
background-image: none !important;
color: #fff;
height: rem-calc(48) !important;
position: relative;
width: rem-calc(48) !important;
&::before { &::before {
content: "A"; content: "A";
font-family: "icons" !important;
font-size: rem-calc(24);
left: 50%;
line-height: $line-height * 2;
margin-left: rem-calc(-11);
position: absolute;
top: 0;
} }
&:hover, &:hover,
&:focus { &:focus {
background: #fff;
color: #354f88; color: #354f88;
} }
} }
@@ -1663,34 +1660,35 @@ table {
.ssb-telegram { .ssb-telegram {
background: #08c; background: #08c;
background-image: none !important;
color: #fff;
height: $line-height * 2 !important;
position: relative;
width: $line-height * 2 !important;
&::before { &::before {
content: "1"; content: "1";
font-family: "icons" !important;
font-size: rem-calc(24);
left: 50%;
line-height: $line-height * 2;
margin-left: rem-calc(-11);
position: absolute;
top: 0;
} }
&:hover, &:hover,
&:focus { &:focus {
background: #fff;
color: #40a2d1; color: #40a2d1;
} }
} }
.ssb-whatsapp_app {
background: #43d854;
&::before {
content: "P";
}
&:hover,
&:focus {
color: #43d854;
}
}
@include breakpoint(medium) { @include breakpoint(medium) {
.button.button-telegram, .button.button-telegram,
.ssb-telegram { .ssb-telegram,
.ssb-whatsapp_app {
display: none !important; display: none !important;
} }
} }
@@ -1718,81 +1716,6 @@ table {
.social-share-button { .social-share-button {
display: inline-block; display: inline-block;
} }
.ssb-twitter {
background: #45b0e3;
color: #fff;
height: $line-height;
position: relative;
width: $line-height * 2;
&::before {
content: "f";
font-family: "icons" !important;
font-size: rem-calc(24);
left: 50%;
line-height: $line-height * 2;
margin-left: rem-calc(-11);
position: absolute;
top: 0;
}
&:hover,
&:focus {
background: #fff;
color: #40a2d1;
}
}
.ssb-facebook {
background: #3b5998;
color: #fff;
height: rem-calc(24);
position: relative;
width: rem-calc(48);
&::before {
content: "A";
font-family: "icons" !important;
font-size: rem-calc(24);
left: 50%;
line-height: $line-height * 2;
margin-left: rem-calc(-11);
position: absolute;
top: 0;
}
&:hover,
&:focus {
background: #fff;
color: #354f88;
}
}
.ssb-telegram {
background: #08c;
color: #fff;
height: $line-height;
position: relative;
width: $line-height * 2;
&::before {
content: "1";
font-family: "icons" !important;
font-size: rem-calc(24);
left: 50%;
line-height: $line-height * 2;
margin-left: rem-calc(-11);
position: absolute;
top: 0;
}
&:hover,
&:focus {
background: #fff;
color: #40a2d1;
}
}
} }
// 13. Pages // 13. Pages

View File

@@ -355,18 +355,6 @@
display: inline; display: inline;
} }
.whatsapp::before {
background-color: #43d854;
color: #fff;
display: inline-block;
font-size: rem-calc(30);
height: rem-calc(48);
padding-top: rem-calc(9);
text-align: center;
vertical-align: top;
width: rem-calc(48);
}
.debate-info, .debate-info,
.proposal-info, .proposal-info,
.investment-project-info, .investment-project-info,
@@ -1126,12 +1114,10 @@
.share-supported { .share-supported {
.ssb-twitter, .social-share-button .ssb-icon {
.ssb-facebook {
background: none; background: none;
color: $text; color: $text;
height: rem-calc(33) !important; height: rem-calc(33);
&::before { &::before {
font-size: rem-calc(18); font-size: rem-calc(18);
@@ -1238,22 +1224,6 @@
margin-bottom: rem-calc(3); margin-bottom: rem-calc(3);
text-decoration: none; text-decoration: none;
} }
.social-share-button a {
color: #fff;
&.social-share-button-twitter:hover {
color: #40a2d1;
}
&.social-share-button-facebook:hover {
color: #354f88;
}
&.social-share-button-telegram:hover {
color: #ce3e26;
}
}
} }
.groups-and-headings { .groups-and-headings {

View File

@@ -10,47 +10,45 @@
<% end %> <% end %>
<% cache [locale_and_user_status(@proposal), @proposal, @proposal.author, Flag.flagged?(current_user, @proposal), @proposal_votes] do %> <% cache [locale_and_user_status(@proposal), @proposal, @proposal.author, Flag.flagged?(current_user, @proposal), @proposal_votes] do %>
<div class="proposal-show"> <div id="<%= dom_id(@proposal) %>" class="row">
<div id="<%= dom_id(@proposal) %>" class="row"> <div class="small-12 medium-8 column">
<div class="small-12 medium-8 column">
<h1><%= t("proposals.proposal.created") %></h1> <h1><%= t("proposals.proposal.created") %></h1>
<p> <p>
<span class="lead"><%= t("proposals.proposal.share.guide") %></span><br> <span class="lead"><%= t("proposals.proposal.share.guide") %></span><br>
<%= t("proposals.proposal.share.edit") %> <%= t("proposals.proposal.share.edit") %>
</p> </p>
<%= render "shared/social_share", <%= render "shared/social_share",
title: @proposal.title, title: @proposal.title,
url: proposal_url(@proposal), url: proposal_url(@proposal),
description: @proposal.summary, description: @proposal.summary,
mobile: @proposal.title %> mobile: @proposal.title %>
<% if can?(:dashboard, @proposal) %> <% if can?(:dashboard, @proposal) %>
<div class="callout light margin"> <div class="callout light margin">
<p class="text-center"> <p class="text-center">
<strong><%= t("proposals.share.improve_it") %></strong> <strong><%= t("proposals.share.improve_it") %></strong>
</p>
<div class="small-12 medium-6 large-4 column small-centered">
<%= link_to t("proposals.share.dashboard"),
progress_proposal_dashboard_path(@proposal), class: "button expanded" %>
</div>
</div>
<% end %>
<div class="small margin-bottom">
<%= link_to t("proposals.proposal.share.view_proposal"), proposal_path(@proposal) %>
</div>
</div>
<div class="small-12 medium-4 column">
<div class="callout light">
<p>
<strong><%= @proposal.title %></strong><br>
<%= t("proposals.show.code") %> <%= @proposal.code %>
</p> </p>
<div class="small-12 medium-6 large-4 column small-centered">
<%= link_to t("proposals.share.dashboard"),
progress_proposal_dashboard_path(@proposal), class: "button expanded" %>
</div>
</div> </div>
<% end %>
<div class="small margin-bottom">
<%= link_to t("proposals.proposal.share.view_proposal"), proposal_path(@proposal) %>
</div>
</div>
<div class="small-12 medium-4 column">
<div class="callout light">
<p>
<strong><%= @proposal.title %></strong><br>
<%= t("proposals.show.code") %> <%= @proposal.code %>
</p>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,7 +1,5 @@
<% description = local_assigns.fetch(:description, "") %> <% description = local_assigns.fetch(:description, "") %>
<% description = truncate(ActionView::Base.full_sanitizer.sanitize(description), length: 140) %> <% description = truncate(ActionView::Base.full_sanitizer.sanitize(description), length: 140) %>
<% mobile = local_assigns[:mobile] %>
<% mobile_url = mobile.present? ? "#{mobile.gsub(/\s+/, "%20")}%20" : "" %>
<% 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>
@@ -13,10 +11,6 @@
image: local_assigns.fetch(:image_url, ""), image: local_assigns.fetch(:image_url, ""),
desc: description, desc: description,
"data-twitter-title": local_assigns[:mobile], "data-twitter-title": local_assigns[:mobile],
"data-telegram-title": local_assigns[:mobile]) %> "data-telegram-title": local_assigns[:mobile],
<a href="whatsapp://send?text=<%= mobile_url %><%= url %>" "data-whatsapp_app-title": local_assigns[:mobile]) %>
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>
</a>
</div> </div>

View File

@@ -1,3 +1,3 @@
SocialShareButton.configure do |config| SocialShareButton.configure do |config|
config.allow_sites = %w[twitter facebook telegram] config.allow_sites = %w[twitter facebook telegram whatsapp_app]
end end

View File

@@ -784,7 +784,6 @@ en:
facebook: "%{org} Facebook" facebook: "%{org} Facebook"
twitter: "%{org} Twitter" twitter: "%{org} Twitter"
youtube: "%{org} YouTube" youtube: "%{org} YouTube"
whatsapp: WhatsApp
telegram: "%{org} Telegram" telegram: "%{org} Telegram"
instagram: "%{org} Instagram" instagram: "%{org} Instagram"
stats: stats:

View File

@@ -17,3 +17,4 @@ en:
pinterest: "Pinterest" pinterest: "Pinterest"
email: "Email" email: "Email"
telegram: "Telegram" telegram: "Telegram"
whatsapp_app: "WhatsApp"

View File

@@ -784,7 +784,6 @@ es:
facebook: "Facebook de %{org}" facebook: "Facebook de %{org}"
twitter: "Twitter de %{org}" twitter: "Twitter de %{org}"
youtube: "YouTube de %{org}" youtube: "YouTube de %{org}"
whatsapp: WhatsApp
telegram: "Telegram de %{org}" telegram: "Telegram de %{org}"
instagram: "Instagram de %{org}" instagram: "Instagram de %{org}"
stats: stats:

View File

@@ -17,3 +17,4 @@ es:
pinterest: "Pinterest" pinterest: "Pinterest"
email: "Correo electrónico" email: "Correo electrónico"
telegram: "Telegram" telegram: "Telegram"
whatsapp_app: "WhatsApp"

View File

@@ -93,9 +93,43 @@ describe "Debates" do
expect(page).to have_content I18n.l(debate.created_at.to_date) expect(page).to have_content I18n.l(debate.created_at.to_date)
expect(page).to have_selector(avatar(debate.author.name)) expect(page).to have_selector(avatar(debate.author.name))
expect(page.html).to include "<title>#{debate.title}</title>" expect(page.html).to include "<title>#{debate.title}</title>"
end
within(".social-share-button") do describe "Social share buttons", :js do
expect(page.all("a").count).to be(3) # Twitter, Facebook, Telegram context "On desktop browsers" do
scenario "Shows links to share on facebook and twitter" do
visit debate_path(create(:debate))
within(".social-share-button") do
expect(page.all("a").count).to be(2)
expect(page).to have_link "Share to Facebook"
expect(page).to have_link "Share to Twitter"
end
end
end
context "On small devices" do
let!(:window_size) { Capybara.current_window.size }
before do
Capybara.current_window.resize_to(639, 479)
end
after do
Capybara.current_window.resize_to(*window_size)
end
scenario "Shows links to share on telegram and whatsapp too" do
visit debate_path(create(:debate))
within(".social-share-button") do
expect(page.all("a").count).to be(4)
expect(page).to have_link "Share to Facebook"
expect(page).to have_link "Share to Twitter"
expect(page).to have_link "Share to Telegram"
expect(page).to have_link "Share to WhatsApp"
end
end
end end
end end

View File

@@ -138,9 +138,43 @@ describe "Proposals" do
expect(page.html).to include "<title>#{proposal.title}</title>" expect(page.html).to include "<title>#{proposal.title}</title>"
expect(page).not_to have_selector ".js-flag-actions" expect(page).not_to have_selector ".js-flag-actions"
expect(page).not_to have_selector ".js-follow" expect(page).not_to have_selector ".js-follow"
end
within(".social-share-button") do describe "Social share buttons", :js do
expect(page.all("a").count).to be(3) # Twitter, Facebook, Telegram context "On desktop browsers" do
scenario "Shows links to share on facebook and twitter" do
visit proposal_path(create(:proposal))
within(".social-share-button") do
expect(page.all("a").count).to be(2)
expect(page).to have_link "Share to Facebook"
expect(page).to have_link "Share to Twitter"
end
end
end
context "On small devices" do
let!(:window_size) { Capybara.current_window.size }
before do
Capybara.current_window.resize_to(639, 479)
end
after do
Capybara.current_window.resize_to(*window_size)
end
scenario "Shows links to share on telegram and whatsapp too" do
visit proposal_path(create(:proposal))
within(".social-share-button") do
expect(page.all("a").count).to be(4)
expect(page).to have_link "Share to Facebook"
expect(page).to have_link "Share to Twitter"
expect(page).to have_link "Share to Telegram"
expect(page).to have_link "Share to WhatsApp"
end
end
end end
end end