diff --git a/scipost_django/journals/templates/journals/_publication_actions.html b/scipost_django/journals/templates/journals/_publication_actions.html index 8e5ddef486fec04c8057c7f3449ecb16dff8a1a1..5eff3be7d98a92eb47b3b3235db332ca5217df2d 100644 --- a/scipost_django/journals/templates/journals/_publication_actions.html +++ b/scipost_django/journals/templates/journals/_publication_actions.html @@ -94,20 +94,22 @@ </li> </ul> - {% if journal.autogeneratedfilecontenttemplate_set.all %} - Autogenerated files - <ul> + {% with journal=publication.get_journal %} + {% if journal.autogeneratedfilecontenttemplate_set.all %} + Autogenerated files + <ul> - {% for autotemplate in journal.autogeneratedfilecontenttemplate_set.all %} - <li> - <a href="{% url 'journals:view_autogenerated_file' doi_label=publication.doi_label autotemplate_id=autotemplate.id %}" - target="_blank">{{ autotemplate.name }} ({{ autotemplate.description }})</a> - </li> - {% endfor %} + {% for autotemplate in journal.autogeneratedfilecontenttemplate_set.all %} + <li> + <a href="{% url 'journals:view_autogenerated_file' doi_label=publication.doi_label autotemplate_id=autotemplate.id %}" + target="_blank">{{ autotemplate.name }} ({{ autotemplate.description }})</a> + </li> + {% endfor %} - </ul> - {% endif %} + </ul> + {% endif %} + {% endwith %} </div> </div> diff --git a/scipost_django/journals/templates/journals/publication_detail.html b/scipost_django/journals/templates/journals/publication_detail.html index dde0f5ade81466022e1a7df760efcdfe337e1fd0..d41156f277c175bf7acb696629a9ef76f9682404 100644 --- a/scipost_django/journals/templates/journals/publication_detail.html +++ b/scipost_django/journals/templates/journals/publication_detail.html @@ -43,6 +43,7 @@ {% block content %} {% is_scipost_admin request.user as is_scipost_admin %} {% is_ed_admin request.user as is_ed_admin %} + {% is_pub_officer request.user as is_pub_officer %} {{ block.super }} @@ -249,7 +250,7 @@ </div> </div> {% endif %} - {% if is_ed_admin %} + {% if is_ed_admin or is_pub_officer %} <hr class="divider"> <div class="row"> <div class="col-12"> diff --git a/scipost_django/scipost/templatetags/user_groups.py b/scipost_django/scipost/templatetags/user_groups.py index f05b154fdc12505f653bb993da32a32a3195ea59..1f6f95c809651cd7154ffa4f0eb89e3735b1d0ba 100644 --- a/scipost_django/scipost/templatetags/user_groups.py +++ b/scipost_django/scipost/templatetags/user_groups.py @@ -132,6 +132,15 @@ def is_editor_in_charge(user, submission): return submission.editor_in_charge == user.contributor +@register.simple_tag +def is_pub_officer(user): + """ + Assign template variable (boolean) to check if user is Publication Officer. + This assignment is limited to a certain context block! + """ + return user.groups.filter(name="Publication Officers").exists() or user.is_superuser + + @register.simple_tag def recommend_new_totp_device(user): """