Add Twitter button

This commit is contained in:
Pierre Brunet 2017-09-12 19:11:52 +02:00
parent a40c48a792
commit d888a6b68a
3 changed files with 25 additions and 3 deletions

View File

@ -1,5 +1,5 @@
{% extends "core/base.jinja" %} {% extends "core/base.jinja" %}
{% from 'core/macros.jinja' import user_profile_link, facebook_share %} {% from 'core/macros.jinja' import user_profile_link, facebook_share, tweet %}
{% block title %} {% block title %}
{% trans %}News{% endtrans %} - {% trans %}News{% endtrans %} -
@ -31,6 +31,7 @@
{% endif %} {% endif %}
</br> </br>
{{ facebook_share(news) }} {{ facebook_share(news) }}
{{ tweet(news) }}
</section> </section>
{% endblock %} {% endblock %}

View File

@ -23,7 +23,8 @@ $secondary-neutral-dark-color: hsl(40, 57.6%, 17%);
$white-color: hsl(219.6, 20.8%, 98%); $white-color: hsl(219.6, 20.8%, 98%);
$black-color: hsl(40.0, 0%, 17%); $black-color: hsl(40.0, 0%, 17%);
$faceblue : #3B5998; $faceblue: #3B5998;
$twitblue: #55acee;
@ -416,6 +417,22 @@ header {
color: lightgrey; color: lightgrey;
} }
.twitter-share-button {
background: $twitblue;
border: none;
color: white;
padding: 0.5em 1em;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
border-radius: 2px;
}
.twitter-share-button:hover {
color: lightgrey;
}
.helptext { .helptext {
display: block; display: block;
} }

View File

@ -13,7 +13,11 @@
{%- endmacro %} {%- endmacro %}
{% macro facebook_share(news) -%} {% macro facebook_share(news) -%}
<a class="fb-share-button" href="https://www.facebook.com/sharer/sharer.php?u={{ news.get_full_url() }}">{% trans %}Share on Facebook{% endtrans %}</a> <a rel="nofollow" target="#" class="fb-share-button" href="https://www.facebook.com/sharer/sharer.php?u={{ news.get_full_url() }}">{% trans %}Share on Facebook{% endtrans %}</a>
{%- endmacro %}
{% macro tweet(news) -%}
<a rel="nofollow" target="#" class="twitter-share-button" href="https://twitter.com/intent/tweet?text={{ news.get_full_url() }}">{% trans %}Tweet{% endtrans %}</a>
{%- endmacro %} {%- endmacro %}
{% macro user_mini_profile(user) %} {% macro user_mini_profile(user) %}