|
| 1 | +{% extends 'generic/object.html' %} |
| 2 | +{% load static %} |
| 3 | +{% load custom_object_buttons %} |
| 4 | +{% load custom_links %} |
| 5 | +{% load helpers %} |
| 6 | +{% load perms %} |
| 7 | +{% load plugins %} |
| 8 | +{% load render_table from django_tables2 %} |
| 9 | +{% load tabs %} |
| 10 | +{% load i18n %} |
| 11 | +{% load custom_object_utils %} |
| 12 | +{% block extra_controls %}{% endblock %} |
| 13 | +{% block breadcrumbs %} |
| 14 | + <li class="breadcrumb-item"> |
| 15 | + <a href="{{ object.get_list_url }}">{{ object.custom_object_type.get_verbose_name_plural }}</a> |
| 16 | + </li> |
| 17 | + <li class="breadcrumb-item"> |
| 18 | + <a href="{{ object.custom_object_type.get_absolute_url }}">{{ object.custom_object_type }}</a> |
| 19 | + </li> |
| 20 | +{% endblock breadcrumbs %} |
| 21 | +{% block object_identifier %} |
| 22 | + {{ object|meta:"app_label" }}.{{ object.custom_object_type.slug }}:{{ object.pk }} |
| 23 | + {% if object.slug %}({{ object.slug }}){% endif %} |
| 24 | +{% endblock object_identifier %} |
| 25 | +{% block title %} |
| 26 | + {{ object }} |
| 27 | +{% endblock title %} |
| 28 | +{% block subtitle %} |
| 29 | + <div class="text-secondary fs-5"> |
| 30 | + {% trans "Created" %} {{ object.created|isodatetime:"minutes" }} |
| 31 | + {% if object.last_updated %} |
| 32 | + <span class="separator">·</span> |
| 33 | + {% trans "Updated" %} {{ object.last_updated|isodatetime:"minutes" }} |
| 34 | + {% endif %} |
| 35 | + </div> |
| 36 | +{% endblock subtitle %} |
| 37 | +{% block controls %} |
| 38 | + <div class="btn-list justify-content-end mb-2"> |
| 39 | + {% block control-buttons %} |
| 40 | + {# Default buttons #} |
| 41 | + {% if perms.extras.add_bookmark and object.bookmarks %} |
| 42 | + {% custom_object_bookmark_button object %} |
| 43 | + {% endif %} |
| 44 | + {% if perms.extras.add_subscription and object.subscriptions %} |
| 45 | + {% custom_object_subscribe_button object %} |
| 46 | + {% endif %} |
| 47 | + {% if request.user|can_add:object %} |
| 48 | + {% custom_object_clone_button object %} |
| 49 | + {% endif %} |
| 50 | + {% if request.user|can_change:object %} |
| 51 | + {% custom_object_edit_button object %} |
| 52 | + {% endif %} |
| 53 | + {% if request.user|can_delete:object %} |
| 54 | + {% custom_object_delete_button object %} |
| 55 | + {% endif %} |
| 56 | + {% endblock %} |
| 57 | + </div> |
| 58 | + {# Custom links #} |
| 59 | + <div class="d-flex justify-content-end"> |
| 60 | + <div class="btn-list"> |
| 61 | + {% block custom-links %} |
| 62 | + {% custom_links object %} |
| 63 | + {% endblock custom-links %} |
| 64 | + </div> |
| 65 | + </div> |
| 66 | +{% endblock controls %} |
| 67 | +{% block tabs %} |
| 68 | + <ul class="nav nav-tabs" role="presentation"> |
| 69 | + {# Primary tab #} |
| 70 | + <li class="nav-item"> |
| 71 | + <a class="nav-link{% if not tab %} active{% endif %}" |
| 72 | + href="{{ object.get_absolute_url }}">{{ object.custom_object_type.get_verbose_name }}</a> |
| 73 | + </li> |
| 74 | + {# All other tabs (Journal, Changelog, Custom Objects, typed tabs) come from the registry #} |
| 75 | + {% model_view_tabs object %} |
| 76 | + </ul> |
| 77 | +{% endblock tabs %} |
| 78 | +{% block content %} |
| 79 | + <div class="row"> |
| 80 | + <div class="col col-md-6"> |
| 81 | + <div class="card"> |
| 82 | + <table class="table table-hover attr-table"> |
| 83 | + <tr> |
| 84 | + <th scope="row">{% trans "Type" %}</th> |
| 85 | + <td>{{ object.custom_object_type|linkify:"display_name" }}</td> |
| 86 | + </tr> |
| 87 | + <tr> |
| 88 | + <th scope="row">{% trans "Last activity" %}</th> |
| 89 | + <td> |
| 90 | + {{ latest_change.time|isodatetime|placeholder }} |
| 91 | + {% if latest_change %} |
| 92 | + <div class="small text-muted">{{ latest_change.time|timesince }} {% trans "ago" %}</div> |
| 93 | + {% endif %} |
| 94 | + </td> |
| 95 | + </tr> |
| 96 | + {% for group_name, group_fields in field_groups.items %} |
| 97 | + {% if group_name %} |
| 98 | + <tr class="table-group-header"> |
| 99 | + <th scope="row" colspan="2" class="fw-bold">{{ group_name }}</th> |
| 100 | + </tr> |
| 101 | + {% endif %} |
| 102 | + {% for field in group_fields %} |
| 103 | + {% with is_visible_in_ui=object|get_field_is_ui_visible:field %} |
| 104 | + {% if field.is_single_value and is_visible_in_ui %} |
| 105 | + <tr> |
| 106 | + <th scope="row"> |
| 107 | + {{ field }} |
| 108 | + {% if field.description %} |
| 109 | + <i class="mdi mdi-information text-primary" |
| 110 | + data-bs-toggle="tooltip" |
| 111 | + data-bs-placement="right" |
| 112 | + title="{{ field.description|escape }}"></i> |
| 113 | + {% endif %} |
| 114 | + </th> |
| 115 | + <td> |
| 116 | + {% with customfield=field value=object|get_field_value:field %} |
| 117 | + {% include "builtins/customfield_value.html" %} |
| 118 | + {% endwith %} |
| 119 | + </td> |
| 120 | + </tr> |
| 121 | + {% endif %} |
| 122 | + {% endwith %} |
| 123 | + {% endfor %} |
| 124 | + {% endfor %} |
| 125 | + </table> |
| 126 | + </div> |
| 127 | + {% plugin_left_page object %} |
| 128 | + </div> |
| 129 | + <div class="col col-md-6"> |
| 130 | + {% include 'inc/panels/tags.html' %} |
| 131 | + {% plugin_right_page object %} |
| 132 | + {% for group_name, group_fields in field_groups.items %} |
| 133 | + {% for field in group_fields %} |
| 134 | + {% if field.many %} |
| 135 | + {% with field_values=object|get_child_relations:field is_visible_in_ui=object|get_field_is_ui_visible:field %} |
| 136 | + {% if is_visible_in_ui %} |
| 137 | + <div class="card"> |
| 138 | + <h2 class="card-header"> |
| 139 | + {% if group_name %}{{ group_name }}:{% endif %} |
| 140 | + {{ field }} |
| 141 | + </h2> |
| 142 | + <table class="table table-hover attr-table"> |
| 143 | + {% for relation in field_values.all %} |
| 144 | + <tr> |
| 145 | + <th scope="row">{{ relation|linkify }}</th> |
| 146 | + </tr> |
| 147 | + {% endfor %} |
| 148 | + </table> |
| 149 | + </div> |
| 150 | + {% endif %} |
| 151 | + {% endwith %} |
| 152 | + {% endif %} |
| 153 | + {% endfor %} |
| 154 | + {% endfor %} |
| 155 | + </div> |
| 156 | + </div> |
| 157 | + <div class="row mb-3"> |
| 158 | + <div class="col col-md-12">{% plugin_full_width_page object %}</div> |
| 159 | + </div> |
| 160 | +{% endblock %} |
0 commit comments