Merge branch 'facebook-button' into 'master'

Add facebook button

See merge request !112
This commit is contained in:
Skia 2017-09-17 15:18:07 +02:00
commit 3e769195e3
5 changed files with 122 additions and 65 deletions

View File

@ -81,6 +81,9 @@ class News(models.Model):
def get_absolute_url(self): def get_absolute_url(self):
return reverse('com:news_detail', kwargs={'news_id': self.id}) return reverse('com:news_detail', kwargs={'news_id': self.id})
def get_full_url(self):
return "https://%s%s" % (settings.SITH_URL, self.get_absolute_url())
def __str__(self): def __str__(self):
return "%s: %s" % (self.type, self.title) return "%s: %s" % (self.type, self.title)

View File

@ -1,5 +1,5 @@
{% extends "core/base.jinja" %} {% extends "core/base.jinja" %}
{% from 'core/macros.jinja' import user_profile_link %} {% from 'core/macros.jinja' import user_profile_link, facebook_share, tweet %}
{% block title %} {% block title %}
{% trans %}News{% endtrans %} - {% trans %}News{% endtrans %} -
@ -29,6 +29,9 @@
{% if user.can_edit(news) %} {% if user.can_edit(news) %}
<p> <a href="{{ url('com:news_edit', news_id=news.id) }}">{% trans %}Edit (will be remoderated){% endtrans %}</a></p> <p> <a href="{{ url('com:news_edit', news_id=news.id) }}">{% trans %}Edit (will be remoderated){% endtrans %}</a></p>
{% endif %} {% endif %}
</br>
{{ facebook_share(news) }}
{{ tweet(news) }}
</section> </section>
{% endblock %} {% endblock %}

View File

@ -23,6 +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;
$twitblue: #55acee;
@ -399,6 +401,38 @@ header {
} }
} }
.fb-share-button {
background: $faceblue;
border: none;
color: white;
padding: 0.5em 1em;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
border-radius: 2px;
}
.fb-share-button:hover {
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

@ -12,6 +12,14 @@
</a> </a>
{%- endmacro %} {%- endmacro %}
{% macro facebook_share(news) -%}
<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 %}
{% macro user_mini_profile(user) %} {% macro user_mini_profile(user) %}
<div id="user_profile"> <div id="user_profile">

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-06 13:18+0200\n" "POT-Creation-Date: 2017-09-17 15:00+0200\n"
"PO-Revision-Date: 2016-07-18\n" "PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Skia <skia@libskia.so>\n" "Last-Translator: Skia <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\n" "Language-Team: AE info <ae.info@utbm.fr>\n"
@ -66,7 +66,7 @@ msgid "account number"
msgstr "numero de compte" msgstr "numero de compte"
#: accounting/models.py:113 accounting/models.py:139 club/models.py:189 #: accounting/models.py:113 accounting/models.py:139 club/models.py:189
#: com/models.py:67 com/models.py:175 counter/models.py:148 #: com/models.py:67 com/models.py:178 counter/models.py:148
#: counter/models.py:184 trombi/models.py:149 #: counter/models.py:184 trombi/models.py:149
msgid "club" msgid "club"
msgstr "club" msgstr "club"
@ -357,8 +357,8 @@ msgstr "Compte en banque : "
#: core/templates/core/file_detail.jinja:25 #: core/templates/core/file_detail.jinja:25
#: core/templates/core/file_detail.jinja:62 #: core/templates/core/file_detail.jinja:62
#: core/templates/core/file_moderation.jinja:24 #: core/templates/core/file_moderation.jinja:24
#: core/templates/core/group_list.jinja:13 core/templates/core/macros.jinja:53 #: core/templates/core/group_list.jinja:13 core/templates/core/macros.jinja:61
#: core/templates/core/macros.jinja:72 #: core/templates/core/macros.jinja:80
#: core/templates/core/pagerev_edit.jinja:28 #: core/templates/core/pagerev_edit.jinja:28
#: core/templates/core/user_account_detail.jinja:38 #: core/templates/core/user_account_detail.jinja:38
#: core/templates/core/user_edit.jinja:19 #: core/templates/core/user_edit.jinja:19
@ -1261,7 +1261,7 @@ msgstr "Hebdomadaire"
msgid "Call" msgid "Call"
msgstr "Appel" msgstr "Appel"
#: com/models.py:63 com/models.py:124 com/models.py:172 election/models.py:12 #: com/models.py:63 com/models.py:127 com/models.py:175 election/models.py:12
#: election/models.py:92 election/models.py:128 forum/models.py:189 #: election/models.py:92 election/models.py:128 forum/models.py:189
#: forum/models.py:237 #: forum/models.py:237
msgid "title" msgid "title"
@ -1271,7 +1271,7 @@ msgstr "titre"
msgid "summary" msgid "summary"
msgstr "résumé" msgstr "résumé"
#: com/models.py:65 com/models.py:173 trombi/models.py:135 #: com/models.py:65 com/models.py:176 trombi/models.py:135
msgid "content" msgid "content"
msgstr "contenu" msgstr "contenu"
@ -1281,47 +1281,47 @@ msgstr "contenu"
msgid "type" msgid "type"
msgstr "type" msgstr "type"
#: com/models.py:68 com/models.py:174 trombi/models.py:133 #: com/models.py:68 com/models.py:177 trombi/models.py:133
msgid "author" msgid "author"
msgstr "auteur" msgstr "auteur"
#: com/models.py:112 #: com/models.py:115
msgid "news_date" msgid "news_date"
msgstr "date de la nouvelle" msgstr "date de la nouvelle"
#: com/models.py:113 #: com/models.py:116
msgid "start_date" msgid "start_date"
msgstr "date de début" msgstr "date de début"
#: com/models.py:114 #: com/models.py:117
msgid "end_date" msgid "end_date"
msgstr "date de fin" msgstr "date de fin"
#: com/models.py:125 #: com/models.py:128
msgid "intro" msgid "intro"
msgstr "intro" msgstr "intro"
#: com/models.py:126 #: com/models.py:129
msgid "joke" msgid "joke"
msgstr "blague" msgstr "blague"
#: com/models.py:127 #: com/models.py:130
msgid "protip" msgid "protip"
msgstr "astuce" msgstr "astuce"
#: com/models.py:128 #: com/models.py:131
msgid "conclusion" msgid "conclusion"
msgstr "conclusion" msgstr "conclusion"
#: com/models.py:129 #: com/models.py:132
msgid "sent" msgid "sent"
msgstr "envoyé" msgstr "envoyé"
#: com/models.py:171 #: com/models.py:174
msgid "weekmail" msgid "weekmail"
msgstr "weekmail" msgstr "weekmail"
#: com/models.py:176 #: com/models.py:179
msgid "rank" msgid "rank"
msgstr "rang" msgstr "rang"
@ -1934,7 +1934,7 @@ msgstr "profil visible par les cotisants"
msgid "A user with that username already exists" msgid "A user with that username already exists"
msgstr "Un utilisateur de ce nom d'utilisateur existe déjà" msgstr "Un utilisateur de ce nom d'utilisateur existe déjà"
#: core/models.py:493 core/templates/core/macros.jinja:21 #: core/models.py:493 core/templates/core/macros.jinja:29
#: core/templates/core/user_detail.jinja:14 #: core/templates/core/user_detail.jinja:14
#: core/templates/core/user_detail.jinja:16 #: core/templates/core/user_detail.jinja:16
#: core/templates/core/user_edit.jinja:17 #: core/templates/core/user_edit.jinja:17
@ -2430,41 +2430,49 @@ msgstr "login"
msgid "Lost password?" msgid "Lost password?"
msgstr "Mot de passe perdu ?" msgstr "Mot de passe perdu ?"
#: core/templates/core/macros.jinja:31 core/templates/core/user_detail.jinja:27 #: core/templates/core/macros.jinja:16
msgid "Share on Facebook"
msgstr "Partager sur Facebook"
#: core/templates/core/macros.jinja:20
msgid "Tweet"
msgstr "Tweeter"
#: core/templates/core/macros.jinja:39 core/templates/core/user_detail.jinja:27
msgid "Born: " msgid "Born: "
msgstr "Né le : " msgstr "Né le : "
#: core/templates/core/macros.jinja:35 core/templates/core/user_detail.jinja:48 #: core/templates/core/macros.jinja:43 core/templates/core/user_detail.jinja:48
msgid "Promo: " msgid "Promo: "
msgstr "Promo : " msgstr "Promo : "
#: core/templates/core/macros.jinja:42 #: core/templates/core/macros.jinja:50
#, python-format #, python-format
msgid "Subscribed until %(subscription_end)s" msgid "Subscribed until %(subscription_end)s"
msgstr "Cotisant jusqu'au %(subscription_end)s" msgstr "Cotisant jusqu'au %(subscription_end)s"
#: core/templates/core/macros.jinja:43 core/templates/core/user_edit.jinja:40 #: core/templates/core/macros.jinja:51 core/templates/core/user_edit.jinja:40
msgid "Account number: " msgid "Account number: "
msgstr "Numero de compte : " msgstr "Numero de compte : "
#: core/templates/core/macros.jinja:48 launderette/models.py:155 #: core/templates/core/macros.jinja:56 launderette/models.py:155
msgid "Slot" msgid "Slot"
msgstr "Créneau" msgstr "Créneau"
#: core/templates/core/macros.jinja:61 #: core/templates/core/macros.jinja:69
#: launderette/templates/launderette/launderette_admin.jinja:20 #: launderette/templates/launderette/launderette_admin.jinja:20
msgid "Tokens" msgid "Tokens"
msgstr "Jetons" msgstr "Jetons"
#: core/templates/core/macros.jinja:78 core/templates/core/macros.jinja:80 #: core/templates/core/macros.jinja:86 core/templates/core/macros.jinja:88
msgid "Previous" msgid "Previous"
msgstr "Précédent" msgstr "Précédent"
#: core/templates/core/macros.jinja:84 #: core/templates/core/macros.jinja:92
msgid "current" msgid "current"
msgstr "actuel" msgstr "actuel"
#: core/templates/core/macros.jinja:90 core/templates/core/macros.jinja:92 #: core/templates/core/macros.jinja:98 core/templates/core/macros.jinja:100
msgid "Next" msgid "Next"
msgstr "Suivant" msgstr "Suivant"
@ -4119,12 +4127,12 @@ msgid "Washing and drying"
msgstr "Lavage et séchage" msgstr "Lavage et séchage"
#: launderette/templates/launderette/launderette_book.jinja:27 #: launderette/templates/launderette/launderette_book.jinja:27
#: sith/settings.py:546 #: sith/settings.py:549
msgid "Washing" msgid "Washing"
msgstr "Lavage" msgstr "Lavage"
#: launderette/templates/launderette/launderette_book.jinja:31 #: launderette/templates/launderette/launderette_book.jinja:31
#: sith/settings.py:546 #: sith/settings.py:549
msgid "Drying" msgid "Drying"
msgstr "Séchage" msgstr "Séchage"
@ -4383,145 +4391,146 @@ msgstr "Sevenans"
msgid "Montbéliard" msgid "Montbéliard"
msgstr "Montbéliard" msgstr "Montbéliard"
#: sith/settings.py:428 #: sith/settings.py:431
msgid "One semester" msgid "One semester"
msgstr "Un semestre, 15 €" msgstr "Un semestre, 15 €"
#: sith/settings.py:433 #: sith/settings.py:436
msgid "Two semesters" msgid "Two semesters"
msgstr "Deux semestres, 28 €" msgstr "Deux semestres, 28 €"
#: sith/settings.py:438 #: sith/settings.py:441
msgid "Common core cursus" msgid "Common core cursus"
msgstr "Cursus tronc commun, 45 €" msgstr "Cursus tronc commun, 45 €"
#: sith/settings.py:443 #: sith/settings.py:446
msgid "Branch cursus" msgid "Branch cursus"
msgstr "Cursus branche, 45 €" msgstr "Cursus branche, 45 €"
#: sith/settings.py:448 #: sith/settings.py:451
msgid "Alternating cursus" msgid "Alternating cursus"
msgstr "Cursus alternant, 30 €" msgstr "Cursus alternant, 30 €"
#: sith/settings.py:453 #: sith/settings.py:456
msgid "Honorary member" msgid "Honorary member"
msgstr "Membre honoraire, 0 €" msgstr "Membre honoraire, 0 €"
#: sith/settings.py:458 #: sith/settings.py:461
msgid "Assidu member" msgid "Assidu member"
msgstr "Membre d'Assidu, 0 €" msgstr "Membre d'Assidu, 0 €"
#: sith/settings.py:463 #: sith/settings.py:466
msgid "Amicale/DOCEO member" msgid "Amicale/DOCEO member"
msgstr "Membre de l'Amicale/DOCEO, 0 €" msgstr "Membre de l'Amicale/DOCEO, 0 €"
#: sith/settings.py:468 #: sith/settings.py:471
msgid "UT network member" msgid "UT network member"
msgstr "Cotisant du réseau UT, 0 €" msgstr "Cotisant du réseau UT, 0 €"
#: sith/settings.py:473 #: sith/settings.py:476
msgid "CROUS member" msgid "CROUS member"
msgstr "Membres du CROUS, 0 €" msgstr "Membres du CROUS, 0 €"
#: sith/settings.py:478 #: sith/settings.py:481
msgid "Sbarro/ESTA member" msgid "Sbarro/ESTA member"
msgstr "Membre de Sbarro ou de l'ESTA, 15 €" msgstr "Membre de Sbarro ou de l'ESTA, 15 €"
#: sith/settings.py:483 #: sith/settings.py:486
msgid "One semester Welcome Week" msgid "One semester Welcome Week"
msgstr "Un semestre Welcome Week" msgstr "Un semestre Welcome Week"
#: sith/settings.py:488 #: sith/settings.py:491
msgid "Two month for free" msgid "Two month for free"
msgstr "Deux mois gratuits" msgstr "Deux mois gratuits"
#: sith/settings.py:510 #: sith/settings.py:513
msgid "President" msgid "President"
msgstr "Président" msgstr "Président"
#: sith/settings.py:511 #: sith/settings.py:514
msgid "Vice-President" msgid "Vice-President"
msgstr "Vice-Président" msgstr "Vice-Président"
#: sith/settings.py:512 #: sith/settings.py:515
msgid "Treasurer" msgid "Treasurer"
msgstr "Trésorier" msgstr "Trésorier"
#: sith/settings.py:513 #: sith/settings.py:516
msgid "Communication supervisor" msgid "Communication supervisor"
msgstr "Responsable communication" msgstr "Responsable communication"
#: sith/settings.py:514 #: sith/settings.py:517
msgid "Secretary" msgid "Secretary"
msgstr "Secrétaire" msgstr "Secrétaire"
#: sith/settings.py:515 #: sith/settings.py:518
msgid "IT supervisor" msgid "IT supervisor"
msgstr "Responsable info" msgstr "Responsable info"
#: sith/settings.py:516 #: sith/settings.py:519
msgid "Board member" msgid "Board member"
msgstr "Membre du bureau" msgstr "Membre du bureau"
#: sith/settings.py:517 #: sith/settings.py:520
msgid "Active member" msgid "Active member"
msgstr "Membre actif" msgstr "Membre actif"
#: sith/settings.py:518 #: sith/settings.py:521
msgid "Curious" msgid "Curious"
msgstr "Curieux" msgstr "Curieux"
#: sith/settings.py:553 #: sith/settings.py:556
msgid "A new mailing list needs to be moderated" msgid "A new mailing list needs to be moderated"
msgstr "Une nouvelle mailing list a besoin d'être modérée" msgstr "Une nouvelle mailing list a besoin d'être modérée"
#: sith/settings.py:554 #: sith/settings.py:557
#, python-format
msgid "There are %s fresh news to be moderated" msgid "There are %s fresh news to be moderated"
msgstr "Il y a %s nouvelles toutes fraîches à modérer" msgstr "Il y a %s nouvelles toutes fraîches à modérer"
#: sith/settings.py:555 #: sith/settings.py:558
msgid "New files to be moderated" msgid "New files to be moderated"
msgstr "Nouveaux fichiers à modérer" msgstr "Nouveaux fichiers à modérer"
#: sith/settings.py:556 #: sith/settings.py:559
msgid "New pictures/album to be moderated in the SAS" msgid "New pictures/album to be moderated in the SAS"
msgstr "Nouvelles photos/albums à modérer dans le SAS" msgstr "Nouvelles photos/albums à modérer dans le SAS"
#: sith/settings.py:557 #: sith/settings.py:560
msgid "You've been identified on some pictures" msgid "You've been identified on some pictures"
msgstr "Vous avez été identifié sur des photos" msgstr "Vous avez été identifié sur des photos"
#: sith/settings.py:558 #: sith/settings.py:561
#, python-format #, python-format
msgid "You just refilled of %s €" msgid "You just refilled of %s €"
msgstr "Vous avez rechargé votre compte de %s€" msgstr "Vous avez rechargé votre compte de %s€"
#: sith/settings.py:559 #: sith/settings.py:562
#, python-format #, python-format
msgid "You just bought %s" msgid "You just bought %s"
msgstr "Vous avez acheté %s" msgstr "Vous avez acheté %s"
#: sith/settings.py:560 #: sith/settings.py:563
msgid "You have a notification" msgid "You have a notification"
msgstr "Vous avez une notification" msgstr "Vous avez une notification"
#: sith/settings.py:571 #: sith/settings.py:574
msgid "Success!" msgid "Success!"
msgstr "Succès !" msgstr "Succès !"
#: sith/settings.py:572 #: sith/settings.py:575
msgid "Fail!" msgid "Fail!"
msgstr "Échec !" msgstr "Échec !"
#: sith/settings.py:573 #: sith/settings.py:576
msgid "You successfully posted an article in the Weekmail" msgid "You successfully posted an article in the Weekmail"
msgstr "Article posté avec succès dans le Weekmail" msgstr "Article posté avec succès dans le Weekmail"
#: sith/settings.py:574 #: sith/settings.py:577
msgid "You successfully edited an article in the Weekmail" msgid "You successfully edited an article in the Weekmail"
msgstr "Article édité avec succès dans le Weekmail" msgstr "Article édité avec succès dans le Weekmail"
#: sith/settings.py:575 #: sith/settings.py:578
msgid "You successfully sent the Weekmail" msgid "You successfully sent the Weekmail"
msgstr "Weekmail envoyé avec succès" msgstr "Weekmail envoyé avec succès"