From 3089b484d35e28d94640ece5175b3c80df0ca4d8 Mon Sep 17 00:00:00 2001 From: Krophil Date: Fri, 29 Sep 2017 17:18:06 +0200 Subject: [PATCH] Enhanced news --- club/models.py | 3 + com/templates/com/news_detail.jinja | 27 ++++++--- com/templates/com/news_list.jinja | 8 ++- core/static/com/img/fb-icon.png | Bin 0 -> 1376 bytes core/static/com/img/twitter-icon.png | Bin 0 -> 3564 bytes core/static/core/style.scss | 85 +++++++++++++++++++-------- core/templates/core/macros.jinja | 32 +++++++++- sith/settings.py | 1 + 8 files changed, 118 insertions(+), 38 deletions(-) create mode 100644 core/static/com/img/fb-icon.png create mode 100644 core/static/com/img/twitter-icon.png diff --git a/club/models.py b/club/models.py index 1a63aaca..d2901505 100644 --- a/club/models.py +++ b/club/models.py @@ -138,6 +138,9 @@ class Club(models.Model): """ return user.is_in_group(settings.SITH_MAIN_BOARD_GROUP) + def get_full_logo_url(self): + return "https://%s%s" % (settings.SITH_URL, self.logo.url) + def can_be_edited_by(self, user): """ Method to see if that object can be edited by the given user diff --git a/com/templates/com/news_detail.jinja b/com/templates/com/news_detail.jinja index b0ef41e1..d46d4982 100644 --- a/com/templates/com/news_detail.jinja +++ b/com/templates/com/news_detail.jinja @@ -1,15 +1,23 @@ {% extends "core/base.jinja" %} -{% from 'core/macros.jinja' import user_profile_link, facebook_share, tweet %} +{% from 'core/macros.jinja' import user_profile_link, facebook_share, tweet, link_news_logo, gen_news_metatags %} {% block title %} {% trans %}News{% endtrans %} - {{ object.title }} {% endblock %} +{% block head %} +{{ super() }} +{{ gen_news_metatags(news) }} +{% endblock %} + {% block content %}

{% trans %}Back to news{% endtrans %}

-

{% trans %}News{% endtrans %}

-
+
+

{{ news.title }}

{{ news.dates.first().start_date|localtime|date(DATETIME_FORMAT) }} @@ -17,9 +25,13 @@ {{ news.dates.first().end_date|localtime|date(DATETIME_FORMAT) }} {{ news.dates.first().end_date|localtime|time(DATETIME_FORMAT) }}

-

{{ news.club }}

-
{{ news.summary|markdown }}
+
+
{{ news.summary|markdown }}
+
{{ news.content|markdown }}
+ {{ facebook_share(news) }} + {{ tweet(news) }} +

{% trans %}Author: {% endtrans %}{{ user_profile_link(news.author) }}

{% if news.moderator %}

{% trans %}Moderator: {% endtrans %}{{ user_profile_link(news.moderator) }}

@@ -29,9 +41,8 @@ {% if user.can_edit(news) %}

{% trans %}Edit (will be remoderated){% endtrans %}

{% endif %} -
- {{ facebook_share(news) }} - {{ tweet(news) }} +
+
{% endblock %} diff --git a/com/templates/com/news_list.jinja b/com/templates/com/news_list.jinja index 8c8a21ce..18c4f9e0 100644 --- a/com/templates/com/news_list.jinja +++ b/com/templates/com/news_list.jinja @@ -1,4 +1,5 @@ {% extends "core/base.jinja" %} +{% from 'core/macros.jinja' import tweet_quick, fb_quick %} {% block title %} {% trans %}News{% endtrans %} @@ -112,7 +113,12 @@ {{ news.dates.first().start_date|localtime|time(DATETIME_FORMAT) }} - {{ news.dates.first().end_date|localtime|time(DATETIME_FORMAT) }} -
{{ news.summary|markdown }}
+
{{ news.summary|markdown }} +
+ {{ fb_quick(news) }} + {{ tweet_quick(news) }} +
+
{% endfor %} diff --git a/core/static/com/img/fb-icon.png b/core/static/com/img/fb-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..9c12a7657da7ea34d75936ad8fa02f91183b6d1e GIT binary patch literal 1376 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSEX7WqAsj$Z!;#Vf4nJ za0`PlBg3pY5)2HiOr9=|Ar*7p-o5BQJ5=V_$LF?7buT>BU=|c}n6|;ke7VnEA;;$K zySp+L8CsQ^yBRAMiYNTwH+#HRd1l9*m68{G>>Fn5?()6FJ$=H%qfeN2>!f(MEJ@*1 zU1Pgm+{x+QhQ77$U%tG3|MN~IP0PO%>n!J7+Wz3c;_r{&^X=*@mXhM+-J-cP>E8K; z3>SYja!+L|U{y3Vv%P4)`Da@CidGevo1~~^K zOQG04_vIoN(o3zhc*En*KHqfm%9DaH#shyVe%Q#@ILdr&<2t&Jl_C9a`ahoSwUsgM zrP|jE{XQR@e)8haI@aEnw~i;op0Bv%F#E0H2_g4#ExYs6eO#x!6+EHGrXa&C(8tJe zoS`L|;gBK2Ly3k09tR7s@VZmq7^bdRo2njnZ@+Y`?CuNqg8I{Ey%Jd6xnP@G&#HjJ z`^9^g*L}!5_1}pkp#4En1R z8T>Vb_!j|6)HW2mZ+#oslfcmb;o(PSiwjqCs(F$n92k2)O4$8>AbLAl;wS^xk1u=k zu7tJc_9u!kS9G-firRB``}uDY#|#_VE9^J!SMvWG$CJR_$2_N^cKusJuO`NvhfAMF zUA(j7@HYw7gACg)RIfPvjYIV?!?uDau9oj-q%+8UT%Pse&AS~y)ott9s@}ZK(K-3| z&d%LE+2)sK%-!97n_E&RHEhGKY0h@*y^H=!OEkELAJ<#_`utLHL#v60=GW^=?4AEM zi9zly+xkyCO-#GF#e-G<>*=>JR+yO2sQgu)nI)!d?<*a-Tf&B=%Eau)fAz`FE_LrH zFns!ZS6u>woLby>`MDbFbL)-S9tigS`2G98b@}wu&kk%C1@o(Qc9ki=eO*^9y1;`b~b z1&1BX9NVTu8h*ND#LU4V%3Ug;4+~ zo{;sMUBW?Oh7|)7kAeVDf7&OI!cFN=st6=~)3}m>1w`#-4!L96c=XfnSx)=^UtfP8 zs2*GD#*yeL7oO8}jX#IqaoY>ir%p?A`yHocoY7_o&pGc{w&T>!H3C7&+t?MYr>s7H z^^42@p4Yn`Z);z8smRoA{r{q8%a|DEMoTuWUVlrj%gdR0f9vYShY$R^d;pl+&E}t0 z+bJAk7oKb))H(0R-{a@Q7#CzcZUah*9XOD^{Mi2Tl6~?8eTOd2ZRm=aJ*{TJ^#z9S pwVrP(`uanD|Gb?$e_s2~keH&{YNP8L4J;xVJYD@<);T3K0RSffS%?4t literal 0 HcmV?d00001 diff --git a/core/static/com/img/twitter-icon.png b/core/static/com/img/twitter-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..fda93c273bb18cddee5647d6f8080f9b735e1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X)BTV~Pb3O|#sE5a!4I?0N2pb4 z?RU#r^i|1S6q(fYEU9gB^B5b+0tRS80x&}9>@Ty!B-za3=^Af^5^qu^H60TuCX$2@ z_6ChJq|V*|um8gKo~72dN2SGLQ_^s^11g%_gGI0I)VRIhJQN%q^qu_5%- z#EsVeIHaK%(sM+-yh|4_fE|ScRbs<2IJc2nd#Xxje+2puHxMzE7xA+kTX~U6*RYOE zwEvMzvj2SoS+0t`WXd0pD##S zzy{cJ0tZ5wkV%cl2`YZi5$GKwi~>ohKTN0+_jKc6D3thmCqX6F8>qxR2%|s}>hcIW zv3?Vk!2W?z8mh#)jq^KPw$@GKfGCbBMq8(upCjK|UqvR=BaCv0N~qs?W|1Vm_D(V$ zKENo4xcWQJT0e=3uWQGFQH=P_=P#8e)?QD>*UXUdbqEvDOp%E-i|^xv5C4G!6xpca zYhGS{mrPvEPI4=J854QL)>Z`bZ2Ki-Tx~14wH9F_il*Q<+`vzp%+~}sa1lXlP5H`q zTS0RGHNop-OwBZ$5k{6wsp4v1s#AC8Kt mc7o`6s+j7Hr|0%paQqMRF5`5AYMfpG0000 {%- endmacro %} +{% macro link_news_logo(news) -%} + {% if news.club.logo -%} + {{ news.club.logo.url }} + {% else -%} + {{ static("com/img/news.png") }} + {% endif %} +{%- endmacro %} + +{% macro gen_news_metatags(news) -%} + + + + + + + + +{%- endmacro %} + {% macro facebook_share(news) -%} -{% trans %}Share on Facebook{% endtrans %} + {%- endmacro %} {% macro tweet(news) -%} - + +{%- endmacro %} + +{% macro fb_quick(news) -%} + +{%- endmacro %} + +{% macro tweet_quick(news) -%} + {%- endmacro %} {% macro user_mini_profile(user) %}
-
{% if user.profile_pict %} diff --git a/sith/settings.py b/sith/settings.py index 779eb04e..4fc5e7fb 100644 --- a/sith/settings.py +++ b/sith/settings.py @@ -272,6 +272,7 @@ OLD_MYSQL_INFOS = { SITH_URL = "my.url.git.an" SITH_NAME = "Sith website" +SITH_TWITTER = "@ae_utbm" # AE configuration SITH_MAIN_CLUB_ID = 1 # TODO: keep only that first setting, with the ID, and do the same for the other clubs