mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Add facebook button
This commit is contained in:
parent
d797003028
commit
a40c48a792
@ -81,6 +81,9 @@ class News(models.Model):
|
||||
def get_absolute_url(self):
|
||||
return reverse('com:news_detail', kwargs={'news_id': self.id})
|
||||
|
||||
def get_full_url(self):
|
||||
return "https://" + settings.SITH_URL + self.get_absolute_url()
|
||||
|
||||
def __str__(self):
|
||||
return "%s: %s" % (self.type, self.title)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% from 'core/macros.jinja' import user_profile_link %}
|
||||
{% from 'core/macros.jinja' import user_profile_link, facebook_share %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}News{% endtrans %} -
|
||||
@ -29,6 +29,8 @@
|
||||
{% if user.can_edit(news) %}
|
||||
<p> <a href="{{ url('com:news_edit', news_id=news.id) }}">{% trans %}Edit (will be remoderated){% endtrans %}</a></p>
|
||||
{% endif %}
|
||||
</br>
|
||||
{{ facebook_share(news) }}
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -23,6 +23,7 @@ $secondary-neutral-dark-color: hsl(40, 57.6%, 17%);
|
||||
$white-color: hsl(219.6, 20.8%, 98%);
|
||||
$black-color: hsl(40.0, 0%, 17%);
|
||||
|
||||
$faceblue : #3B5998;
|
||||
|
||||
|
||||
|
||||
@ -399,6 +400,22 @@ 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;
|
||||
}
|
||||
|
||||
.helptext {
|
||||
display: block;
|
||||
}
|
||||
|
@ -12,6 +12,10 @@
|
||||
</a>
|
||||
{%- endmacro %}
|
||||
|
||||
{% 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>
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro user_mini_profile(user) %}
|
||||
<div id="user_profile">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user