object.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. {% extends 'generic/_base.html' %}
  2. {% load buttons %}
  3. {% load custom_links %}
  4. {% load helpers %}
  5. {% load perms %}
  6. {% load plugins %}
  7. {% load tabs %}
  8. {% load i18n %}
  9. {% comment %}
  10. Blocks:
  11. breadcrumbs: Breadcrumb list items (HTML <li> elements)
  12. object_identifier: Unique identifier for the object
  13. extra_controls: Additional action buttons to display
  14. content: Page content
  15. Context:
  16. object: The object instance being viewed
  17. {% endcomment %}
  18. {% block page-header %}
  19. <div class="container-xl">
  20. <div class="d-flex justify-content-between align-items-center mt-2">
  21. {# Breadcrumbs #}
  22. <ol class="breadcrumb" aria-label="breadcrumbs">
  23. {% block breadcrumbs %}
  24. <li class="breadcrumb-item">
  25. <a href="{% url object|viewname:'list' %}">{{ object|meta:'verbose_name_plural'|bettertitle }}</a>
  26. </li>
  27. {% endblock breadcrumbs %}
  28. </ol>
  29. {# Object identifier #}
  30. <code class="d-block text-muted bg-transparent px-0">
  31. {% block object_identifier %}
  32. {{ object|meta:"app_label" }}.{{ object|meta:"model_name" }}:{{ object.pk }}
  33. {% if object.slug %}({{ object.slug }}){% endif %}
  34. {% endblock object_identifier %}
  35. </code>
  36. </div>
  37. </div>
  38. {{ block.super }}
  39. {% endblock page-header %}
  40. {% block title %}{{ object }}{% endblock %}
  41. {% block subtitle %}
  42. <div class="text-secondary fs-5">
  43. <span>{% trans "Created" %} {{ object.created|annotated_date }}</span>
  44. {% if object.last_updated %}
  45. <span class="separator">&middot;</span>
  46. <span>{% trans "Updated" %} <span title="{{ object.last_updated }}">{{ object.last_updated|timesince }}</span> {% trans "ago" %}</span>
  47. {% endif %}
  48. </div>
  49. {% endblock subtitle %}
  50. {% block controls %}
  51. <div class="btn-list justify-content-end mb-2">
  52. {% plugin_buttons object %}
  53. {# Add/edit/delete/etc. buttons #}
  54. {% block control-buttons %}
  55. {# Extra buttons #}
  56. {% block extra_controls %}{% endblock %}
  57. {# Default buttons #}
  58. {% if perms.extras.add_bookmark and object.bookmarks %}
  59. {% bookmark_button object %}
  60. {% endif %}
  61. {% if request.user|can_add:object %}
  62. {% clone_button object %}
  63. {% endif %}
  64. {% if request.user|can_change:object %}
  65. {% edit_button object %}
  66. {% endif %}
  67. {% if request.user|can_delete:object %}
  68. {% delete_button object %}
  69. {% endif %}
  70. {% endblock control-buttons %}
  71. </div>
  72. {# Custom links #}
  73. <div class="d-flex justify-content-end">
  74. <div class="btn-list">
  75. {% block custom-links %}
  76. {% custom_links object %}
  77. {% endblock custom-links %}
  78. </div>
  79. </div>
  80. {% endblock controls %}
  81. {% block tabs %}
  82. <ul class="nav nav-tabs">
  83. {# Primary tab #}
  84. <li class="nav-item" role="presentation">
  85. <a class="nav-link{% if not tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
  86. </li>
  87. {# Include tabs for registered model views #}
  88. {% model_view_tabs object %}
  89. </ul>
  90. {% endblock tabs %}
  91. {% block content %}{% endblock %}
  92. {% block modals %}
  93. {% include 'inc/htmx_modal.html' %}
  94. {% endblock modals %}