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 00000000..9c12a765 Binary files /dev/null and b/core/static/com/img/fb-icon.png differ diff --git a/core/static/com/img/twitter-icon.png b/core/static/com/img/twitter-icon.png new file mode 100644 index 00000000..fda93c27 Binary files /dev/null and b/core/static/com/img/twitter-icon.png differ diff --git a/core/static/core/style.scss b/core/static/core/style.scss index 288da489..e18025f8 100644 --- a/core/static/core/style.scss +++ b/core/static/core/style.scss @@ -497,6 +497,15 @@ header { } .news_content { clear: left; + .button_bar { + text-align: right; + .fb { + color: $faceblue; + } + .twitter { + color: $twitblue; + } + } } } } @@ -566,36 +575,60 @@ header { } } -.fb-share-button { - background: $faceblue; - border: none; - color: white; - padding: 0.5em 1em; - text-align: center; - text-decoration: none; +#news_details { display: inline-block; - font-size: 16px; - border-radius: 2px; -} + padding: 0.4em; + width: 80%; + background: $white-color; + h4 { + margin-top: 1em; + text-transform: uppercase; + } + .club_logo { + display: inline-block; + text-align: center; + width: 19%; + float: left; + min-width: 10em; + margin: 0em; + margin-right: 0.5em; + margin-top: 0.5em; + img { + max-height: 15em; + max-width: 12em; + display: block; + margin: 0em auto; + } + } + .share_button { + border: none; + color: white; + padding: 0.5em 1em; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + border-radius: 2px; + float: right; + display: block; + margin-left: 0.3em; + &:hover { + color: lightgrey; + } + } -.fb-share-button:hover { - color: lightgrey; -} + .facebook { + background: $faceblue; + } -.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 { + background: $twitblue; + } -.twitter-share-button:hover { - color: lightgrey; + .news_meta { + margin-top: 10em; + font-size: small; + } } .helptext { diff --git a/core/templates/core/macros.jinja b/core/templates/core/macros.jinja index 8c4cadb4..8a9bfcbe 100644 --- a/core/templates/core/macros.jinja +++ b/core/templates/core/macros.jinja @@ -12,17 +12,43 @@ {%- 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 %} +{% trans %}Share on Facebook{% endtrans %} {%- endmacro %} {% macro tweet(news) -%} -{% trans %}Tweet{% endtrans %} +{% trans %}Tweet{% endtrans %} +{%- 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