diff --git a/district/templates/district/district_article_page.html b/district/templates/district/district_article_page.html index 67b066cd66d82962e158b40da5890364556cb574..db90ced949f27dbd16773f078724c353e7fed4aa 100644 --- a/district/templates/district/district_article_page.html +++ b/district/templates/district/district_article_page.html @@ -12,6 +12,8 @@ {{ page.title }} </h1> + {% include "shared/article_shared_link.html" %} + <div class="flex flex-col md:flex-row md:items-center"> <div class="inline-flex divide-x flex-grow"> <span class="pr-2">{{ page.date|date:"DATE_FORMAT" }}</span> diff --git a/main/templates/main/main_article_page.html b/main/templates/main/main_article_page.html index 9504db516912014bd1223aa1675c1e35f6032543..36dce37292f2e4256b14c193155947fe6d8ec9d5 100644 --- a/main/templates/main/main_article_page.html +++ b/main/templates/main/main_article_page.html @@ -29,6 +29,7 @@ <div class="grid-content leading-6"> <p class="font-condensed text-xl leading-7 mb-5"> {{ page.perex }} + {% include "shared/article_shared_link.html" %} </p> </div> {% if page.author_page.title or page.author %} diff --git a/shared/models.py b/shared/models.py index 926dc37b8a881b85936768016c41b4cfb117cf04..a3f9cfa40e3aa02fa7efd0fd772cd1539d9c289c 100644 --- a/shared/models.py +++ b/shared/models.py @@ -102,6 +102,10 @@ class ArticleMixin(models.Model): class Meta: abstract = True + @property + def get_original_url(self): + return f"{self.get_parent().get_ancestors().specific().live().last().full_url}{self.slug}" + @property def get_no_index(self): """ diff --git a/shared/templates/shared/article_shared_link.html b/shared/templates/shared/article_shared_link.html new file mode 100644 index 0000000000000000000000000000000000000000..5cb8ee8e97178d9271f95ad367fc21745fee99aa --- /dev/null +++ b/shared/templates/shared/article_shared_link.html @@ -0,0 +1,5 @@ +{% if page.shared_from %} + <div> + Tento článek byl sdílen z externího zdroje. Originál si můžete přečíst <a href="{{ page.get_original_url }}">zde</a>. + </div> +{% endif %} diff --git a/uniweb/templates/uniweb/uniweb_article_page.html b/uniweb/templates/uniweb/uniweb_article_page.html index 63f02a2d40c91f42ee7e2b5cc3616103ec19abab..030fef10ba141cd67251f0cef3bfb8cee7004421 100644 --- a/uniweb/templates/uniweb/uniweb_article_page.html +++ b/uniweb/templates/uniweb/uniweb_article_page.html @@ -11,6 +11,8 @@ <h1 itemprop="headline" class="head-alt-md md:head-alt-lg mb-4">{{ page.title }}</h1> + {% include "shared/article_shared_link.html" %} + <div class="flex flex-col md:flex-row md:items-center"> <div class="inline-flex divide-x flex-grow my-4"> <span class="pr-2">{{ page.date|date:"SHORT_DATE_FORMAT" }}</span>