object.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. - page-header: Content displayed above the primary page content
  12. - breadcrumbs: Breadcrumb list items (HTML <li> elements)
  13. - object_identifier: Unique identifier for the object
  14. - title: Page title
  15. - subtitle: Additional context displayed below the title
  16. - controls: Control elements displayed between the header and content
  17. - control-buttons: Action buttons (add/edit/delete/etc.)
  18. - extra_controls: Any additional action buttons to display
  19. - tabs: Page tabs
  20. - content: Primary page content
  21. - modals: Any pre-loaded modals
  22. Context:
  23. - object: The object being viewed
  24. {% endcomment %}
  25. {% block page-header %}
  26. <div class="container-fluid">
  27. <div class="d-flex justify-content-between align-items-center mt-2">
  28. {# Breadcrumbs #}
  29. <ol class="breadcrumb" aria-label="breadcrumbs">
  30. {% block breadcrumbs %}
  31. <li class="breadcrumb-item">
  32. <a href="{% action_url object 'list' %}">{{ object|meta:'verbose_name_plural'|bettertitle }}</a>
  33. </li>
  34. {% endblock breadcrumbs %}
  35. </ol>
  36. {# Object identifier #}
  37. <code class="d-block text-muted bg-transparent px-0">
  38. {% block object_identifier %}
  39. {{ object|meta:"app_label" }}.{{ object|meta:"model_name" }}:{{ object.pk }}
  40. {% if object.slug %}({{ object.slug }}){% endif %}
  41. {% endblock object_identifier %}
  42. </code>
  43. </div>
  44. </div>
  45. {{ block.super }}
  46. {% endblock page-header %}
  47. {% block title %}{{ object }}{% endblock %}
  48. {% block subtitle %}
  49. <div class="text-secondary fs-5">
  50. <ul class="list-inline">
  51. {% if object.owner %}
  52. <li class="list-inline-item">
  53. <i class="mdi mdi-account-outline" title="{% trans "Owner" %}"></i> {{ object.owner|linkify }}
  54. </li>
  55. {% endif %}
  56. <li class="list-inline-item">
  57. <i class="mdi mdi-calendar-plus" title="{% trans "Created" %}"></i>
  58. {{ object.created|isodatetime:"minutes" }}
  59. </li>
  60. {% if object.last_updated %}
  61. <li class="list-inline-item">
  62. <i class="mdi mdi-calendar-edit" title="{% trans "Last updated" %}"></i>
  63. {{ object.last_updated|isodatetime:"minutes" }}
  64. </li>
  65. {% endif %}
  66. </ul>
  67. </div>
  68. {% endblock subtitle %}
  69. {% block controls %}
  70. <div class="btn-list justify-content-end mb-2">
  71. {% plugin_buttons object %}
  72. {# Add/edit/delete/etc. buttons #}
  73. {% block control-buttons %}
  74. {# Extra buttons #}
  75. {% block extra_controls %}{% endblock %}
  76. {# Default buttons #}
  77. {% if perms.extras.add_bookmark and object.bookmarks %}
  78. {% bookmark_button object %}
  79. {% endif %}
  80. {% if perms.extras.add_subscription and object.subscriptions %}
  81. {% subscribe_button object %}
  82. {% endif %}
  83. {% action_buttons actions object %}
  84. {% endblock control-buttons %}
  85. </div>
  86. {# Custom links #}
  87. <div class="d-flex justify-content-end">
  88. <div class="btn-list">
  89. {% block custom-links %}
  90. {% custom_links object %}
  91. {% endblock custom-links %}
  92. </div>
  93. </div>
  94. {% endblock controls %}
  95. {% block tabs %}
  96. <ul class="nav nav-tabs" role="presentation">
  97. {# Primary tab #}
  98. <li class="nav-item">
  99. <a class="nav-link{% if not tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
  100. </li>
  101. {# Include tabs for registered model views #}
  102. {% model_view_tabs object %}
  103. </ul>
  104. {% endblock tabs %}
  105. {% block alerts %}
  106. {% plugin_alerts object %}
  107. {% endblock alerts %}
  108. {% block content %}
  109. {# Render panel layout declared on view class #}
  110. {% for row in layout.rows %}
  111. <div class="row">
  112. {% for column in row.columns %}
  113. <div class="col">
  114. {% for panel in column.panels %}
  115. {% render_panel panel %}
  116. {% endfor %}
  117. </div>
  118. {% endfor %}
  119. </div>
  120. {% endfor %}
  121. {% endblock %}
  122. {% block modals %}
  123. {% include 'inc/htmx_modal.html' %}
  124. {% endblock modals %}