{% load i18n lucide ui %} {% comment %} The D8 "Editor" pane -- shared by news_list.html's split-view preview and news_detail.html's standalone permalink page, so this article/photos/ publish markup exists in exactly one place. Expects the context both views already build identically: news_item, can_edit, can_publish, publish_form, photo_upload_form. Pass show_header=False from a page that already renders its own status/Edit/Publish row elsewhere (news_detail.html puts them in the topbar, same as every other detail page in this app) -- news_list.html's split view has no such per-item topbar, so it needs this include to carry that row itself. {% endcomment %}
{% if show_header|default:True %}
{% if news_item.status == "draft" %} {% trans "Draft" %} {% elif news_item.status == "pending_review" %} {% trans "Pending review" %} {% elif news_item.is_scheduled %} {% blocktrans with date=news_item.published_at %}Scheduled for {{ date }}{% endblocktrans %} {% else %} {% blocktrans with date=news_item.published_at %}Published {{ date }}{% endblocktrans %} {% endif %} {{ news_item.get_visibility_display }}
{% if can_edit %} {% lucide "pencil" size=14 %} {% trans "Edit" %} {% endif %} {% if can_publish %} {% if news_item.status == "published" %} {% else %} {% endif %} {% elif can_edit and news_item.status == "draft" %} {# Whoever can edit but not publish (a coach_manager, not an editor/admin -- see club.services.access.can_add_news vs can_publish_news) hands it off instead. #}
{% csrf_token %}
{% endif %}
{% endif %}
{% if news_item.main_photo %} {% endif %}
{% if not news_item.title_en and not news_item.body_en %} {% endif %}
{% if news_item.teams.all %}
{% for team in news_item.teams.all %} {{ team.short_name }} {% endfor %}
{% else %}
{% trans "Club-wide" %}
{% endif %}

{{ news_item.title }}

{{ news_item.body }}

{% if news_item.created_by %}
{{ news_item.created_by.first_name|slice:":1" }}{{ news_item.created_by.last_name|slice:":1" }} {% blocktrans with name=news_item.created_by %}Posted by {{ name }}{% endblocktrans %}
{% endif %}

{% lucide "image" size=18 %} {% trans "Photos" %}

{% if can_edit %} {% endif %}
{% for photo in news_item.photos.all %}
{% if photo.is_main %} {% trans "Main" %} {% endif %} {% if can_edit %}
{% if not photo.is_main %}
{% csrf_token %}
{% endif %}
{% url 'management:news_photo_delete' news_item.pk photo.pk as delete_photo_url %} {% trans "Delete photo" as delete_photo_title %} {% trans "This photo will be permanently removed." as delete_photo_body %} {% trans "Delete" as delete_label %} {% include "controlpanel/_confirm_modal.html" with modal_id=photo.pk|dom_id:"delete_photo_modal" title=delete_photo_title body=delete_photo_body action_url=delete_photo_url submit_label=delete_label submit_icon="trash-2" %} {% endif %}
{% empty %}

{% trans "No photos yet." %}

{% endfor %}
{% if can_edit %} {% trans "Add photos" as add_photos_label %} {% url 'management:news_photo_upload' news_item.pk as add_photos_url %} {% include "controlpanel/_modal_form.html" with modal_id="add_photos_modal" title=add_photos_label form=photo_upload_form action_url=add_photos_url submit_label=add_photos_label submit_icon="image-plus" %} {% trans "Delete news item" as delete_news_title %} {% blocktrans asvar delete_news_body %}Delete “{{ news_item }}”? Its photos go with it. This cannot be undone.{% endblocktrans %} {% trans "Delete" as delete_label %} {% url 'management:news_delete' news_item.pk as delete_news_url %} {% include "controlpanel/_confirm_modal.html" with modal_id="delete_news_modal" title=delete_news_title body=delete_news_body action_url=delete_news_url submit_label=delete_label %} {% endif %} {% if can_publish %} {% if news_item.status == "draft" %} {% trans "Publish" as publish_label %} {% url 'management:news_publish' news_item.pk as publish_url %} {% trans "Leave as now to publish immediately, or pick a future date/time to schedule it." as publish_blurb %} {% include "controlpanel/_modal_form.html" with modal_id="publish_modal" title=publish_label form=publish_form action_url=publish_url submit_label=publish_label submit_icon="upload" blurb=publish_blurb %} {% else %} {% trans "Unpublish" as unpublish_label %} {% blocktrans asvar unpublish_body %}This pulls “{{ news_item }}” back to a draft. It won't be visible anywhere until it's published again.{% endblocktrans %} {% url 'management:news_unpublish' news_item.pk as unpublish_url %} {% include "controlpanel/_confirm_modal.html" with modal_id="unpublish_modal" title=unpublish_label body=unpublish_body action_url=unpublish_url submit_label=unpublish_label submit_icon="eye-off" %} {% endif %} {% endif %}