object.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. {% extends 'base/layout.html' %}
  2. {% load buttons %}
  3. {% load custom_links %}
  4. {% load helpers %}
  5. {% load perms %}
  6. {% load plugins %}
  7. {% load tabs %}
  8. {% comment %}
  9. Blocks:
  10. breadcrumbs: Breadcrumb list items (HTML <li> elements)
  11. object_identifier: Unique identifier for the object
  12. extra_controls: Additional action buttons to display
  13. extra_tabs: Additional tabs to include
  14. content: Page content
  15. Context:
  16. object: The object instance being viewed
  17. {% endcomment %}
  18. {% block header %}
  19. <div class="d-flex justify-content-between align-items-center">
  20. {# Breadcrumbs #}
  21. <nav class="breadcrumb-container px-3" aria-label="breadcrumb">
  22. <ol class="breadcrumb">
  23. {% block breadcrumbs %}
  24. <li class="breadcrumb-item"><a href="{% url object|viewname:'list' %}">{{ object|meta:'verbose_name_plural'|bettertitle }}</a></li>
  25. {% endblock breadcrumbs %}
  26. </ol>
  27. </nav>
  28. {# Object identifier #}
  29. <div class="float-end px-3">
  30. <code class="text-muted">
  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 %}
  40. {% block title %}{{ object }}{% endblock %}
  41. {% block subtitle %}
  42. <div class="object-subtitle">
  43. <span>Created {{ object.created|annotated_date }}</span>
  44. <span class="separator">&middot;</span>
  45. <span>Updated <span title="{{ object.last_updated }}">{{ object.last_updated|timesince }}</span> ago</span>
  46. </div>
  47. {% endblock %}
  48. {% block controls %}
  49. {# Clone/Edit/Delete Buttons #}
  50. <div class="controls">
  51. <div class="control-group">
  52. {% plugin_buttons object %}
  53. {# Extra buttons #}
  54. {% block extra_controls %}{% endblock %}
  55. {% if request.user|can_add:object %}
  56. {% clone_button object %}
  57. {% endif %}
  58. {% if request.user|can_change:object %}
  59. {% edit_button object %}
  60. {% endif %}
  61. {% if request.user|can_delete:object %}
  62. {% delete_button object %}
  63. {% endif %}
  64. </div>
  65. <div class="control-group">
  66. {% custom_links object %}
  67. </div>
  68. </div>
  69. {% endblock controls %}
  70. {% block tabs %}
  71. <ul class="nav nav-tabs px-3">
  72. {# Primary tab #}
  73. <li class="nav-item" role="presentation">
  74. <a class="nav-link{% if not active_tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
  75. </li>
  76. {# Include any extra tabs passed by the view #}
  77. {% block extra_tabs %}{% endblock %}
  78. {# Include tabs for registered model views #}
  79. {% model_view_tabs object %}
  80. </ul>
  81. {% endblock tabs %}
  82. {% block content-wrapper %}
  83. <div class="tab-content">
  84. {% block content %}{% endblock %}
  85. </div>
  86. {% endblock content-wrapper %}
  87. {% block modals %}
  88. {% include 'inc/htmx_modal.html' %}
  89. {% endblock modals %}