diff --git a/scipost_django/comments/templates/comments/_comment_identifier.html b/scipost_django/comments/templates/comments/_comment_identifier.html index 3ee239cac7b672eed5903f6cd7deabb500d5b553..8778fa5ca2d6fbec7e2242ad79d26bd37f1b39ac 100644 --- a/scipost_django/comments/templates/comments/_comment_identifier.html +++ b/scipost_django/comments/templates/comments/_comment_identifier.html @@ -16,6 +16,7 @@ on {{ comment.date_submitted|date:'Y-m-d' }} {% endif %} <small>[id {{ comment.id }}]</small> + <span class="ms-2">{% include 'permalink.html' with object=comment %}</span> {% if user.is_authenticated %} {% include 'helpdesk/_ticket_for_object_link.html' with object=comment %} {% endif %} diff --git a/scipost_django/common/templates/permalink.html b/scipost_django/common/templates/permalink.html new file mode 100644 index 0000000000000000000000000000000000000000..7b640d6415bd150b6eab8a8af49d0c8258d23b55 --- /dev/null +++ b/scipost_django/common/templates/permalink.html @@ -0,0 +1,5 @@ +{% load scipost_extras %} + +{% if object.get_absolute_url %} + <a href="{{ object.get_absolute_url }}"><span title="Permalink to this {{ object|object_name }}">{% include 'bi/link.html' %}</span></a> +{% endif %} diff --git a/scipost_django/forums/templates/forums/post_card.html b/scipost_django/forums/templates/forums/post_card.html index 37baf905d8c5d4b60133e149fc27dca18131b0fb..48a05a697932cdee747e851461170bce9f58111f 100644 --- a/scipost_django/forums/templates/forums/post_card.html +++ b/scipost_django/forums/templates/forums/post_card.html @@ -9,7 +9,7 @@ {{ post.subject }} <div class="postInfo"> {{ post.posted_by.first_name }} {{ post.posted_by.last_name }} on {{ post.posted_on|date:"Y-m-d" }} - - <a href="{{ post.get_absolute_url }}"><span title="permalink to this Post">{% include 'bi/link.html' %}</span></a> + - {% include 'permalink.html' with object=post %} {% if post.parent and not post.motion %} - regarding <a href="{{ post.parent.get_absolute_url }}">{{ post.parent }}</a> {% endif %} diff --git a/scipost_django/news/templates/news/news_card_content.html b/scipost_django/news/templates/news/news_card_content.html index 7835c8bf50f4a104c9c3b0f06c54053a66fb00c8..8acd253102cc76f6636fffc32b5acb14e3ea546d 100644 --- a/scipost_django/news/templates/news/news_card_content.html +++ b/scipost_django/news/templates/news/news_card_content.html @@ -1,12 +1,19 @@ -<div class="p-3 mb-3 bg-light news-item scipost-bar" id="news_{{ news.id }}"> +<div class="p-3 mb-3 bg-light news-item scipost-bar" + id="news_{{ news.id }}"> <h3 class="title">{{ news.headline }}</h3> - <h5 class="sub-title">{{ news.date|date:'j F Y' }} <a href="{{ news.get_absolute_url }}">{% include 'bi/link.html' %}</a></h5> + <h5 class="sub-title"> + {{ news.date|date:'j F Y' }}  + {% include 'permalink.html' with object=news %} + </h5> + {% if news.image %} <div class="row"> <div class="col-sm-3 col-lg-2"> <img class="mb-3 mb-sm-0 {{ news.image.css_class }}" - style="max-height: 100%; max-width: 100%;" - src="{{ news.image.url }}" alt="image"/> + style="max-height: 100%; + max-width: 100%" + src="{{ news.image.url }}" + alt="image" /> </div> <div class="col-sm-9 col-lg-10"> <p class="mb-0">{{ news.blurb|safe|linebreaksbr }}</p> @@ -15,16 +22,17 @@ {% else %} <p class="mb-0">{{ news.blurb|safe|linebreaksbr }}</p> {% endif %} + {% if news.followup_link %} - <a class="mt-3 d-inline-block" href="{{ news.followup_link }}"> - {{ news.followup_link_text }} - </a> + <a class="mt-3 d-inline-block" href="{{ news.followup_link }}">{{ news.followup_link_text }}</a> {% endif %} + {% if perms.scipost.can_manage_news %} - <br> - <br> + <br /> + <br /> <a href="{% url 'news:newsitem_update' pk=news.id %}">Edit news item</a> · - <a href="{% url 'news:newsitem_delete' pk=news.id %}" class="text-danger">Delete</a> + <a href="{% url 'news:newsitem_delete' pk=news.id %}" + class="text-danger">Delete</a> {% endif %} </div> diff --git a/scipost_django/scipost/templatetags/scipost_extras.py b/scipost_django/scipost/templatetags/scipost_extras.py index 76c9f30aae17c08f176e63ed53e9d6a140a85d7a..2d712a3ca7bfd460b9bac6174bcc8178f4c3681d 100644 --- a/scipost_django/scipost/templatetags/scipost_extras.py +++ b/scipost_django/scipost/templatetags/scipost_extras.py @@ -62,7 +62,13 @@ def content_type_id(obj): @register.filter def object_name(obj): - return obj._meta.object_name if obj else None + import re + + if obj is None: + return None + else: + # Add spaces before capital letters in the object name to make it more readable + return re.sub(r"[^\s]([A-Z])", r" \1", obj._meta.object_name) @register.filter diff --git a/scipost_django/submissions/templates/submissions/_report_public_without_comments.html b/scipost_django/submissions/templates/submissions/_report_public_without_comments.html index 157142f6ab1e9094a7c2fbac6f9ce2870bc1aa15..bea9c166c13afb75a92015992da29f2e0a2eb9fd 100644 --- a/scipost_django/submissions/templates/submissions/_report_public_without_comments.html +++ b/scipost_django/submissions/templates/submissions/_report_public_without_comments.html @@ -17,12 +17,14 @@ <small><label class="label label-outline-primary ms-2">Post-Editorial Recommendation Report</label> <span class="text-primary" data-bs-toggle="tooltip" data-bs-placement="auto" data-bs-html="true" title="Post-Editorial Reports are submitted after the Editorial Recommendation has been formulated.<br>Hence, they have not been part of the College's decision to Publish the Submission." aria-hidden="true">{% include 'bi/question-circle-fill.html' %}</span></small> {% endif %} - {% if report.invited %} - <em class="ms-4">(Invited Report)</em> - {% else %} - <em class="ms-4">(Contributed Report)</em> - {% endif %} - + <em class="ms-2"> + {% if report.invited %} + (Invited Report) + {% else %} + (Contributed Report) + {% endif %} + </em> + <span class="ms-2">{% include 'permalink.html' with object=report %}</span> {% if user.is_authenticated %} {% include 'helpdesk/_ticket_for_object_link.html' with object=report %}