tag.html 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. {% extends 'generic/object.html' %}
  2. {% load helpers %}
  3. {% load plugins %}
  4. {% load render_table from django_tables2 %}
  5. {% load i18n %}
  6. {% block content %}
  7. <div class="row">
  8. <div class="col col-md-6">
  9. <div class="card">
  10. <h2 class="card-header">{% trans "Tag" %}</h2>
  11. <table class="table table-hover attr-table">
  12. <tr>
  13. <th scope="row">{% trans "Name" %}</th>
  14. <td>
  15. {{ object.name }}
  16. </td>
  17. </tr>
  18. <tr>
  19. <th scope="row">{% trans "Description" %}</th>
  20. <td>
  21. {{ object.description|placeholder }}
  22. </td>
  23. </tr>
  24. <tr>
  25. <th scope="row">{% trans "Color" %}</th>
  26. <td>
  27. <span class="color-label" style="background-color: #{{ object.color }}">&nbsp;</span>
  28. </td>
  29. </tr>
  30. <tr>
  31. <th scope="row">{% trans "Tagged Items" %}</th>
  32. <td>
  33. {{ taggeditem_table.rows|length }}
  34. </td>
  35. </tr>
  36. </table>
  37. </div>
  38. {% plugin_left_page object %}
  39. </div>
  40. <div class="col col-md-6">
  41. <div class="card">
  42. <h2 class="card-header">{% trans "Allowed Object Types" %}</h2>
  43. <table class="table table-hover attr-table">
  44. {% for ct in object.object_types.all %}
  45. <tr>
  46. <td>{{ ct }}</td>
  47. </tr>
  48. {% empty %}
  49. <tr>
  50. <td class="text-muted">{% trans "Any" %}</td>
  51. </tr>
  52. {% endfor %}
  53. </table>
  54. </div>
  55. <div class="card">
  56. <h2 class="card-header">{% trans "Tagged Item Types" %}</h2>
  57. <ul class="list-group list-group-flush" role="presentation">
  58. {% for object_type in object_types %}
  59. {% with viewname=object_type.content_type.model_class|validated_viewname:"list" %}
  60. {% if viewname %}
  61. <a href="{% url viewname %}?tag={{ object.slug }}" class="list-group-item list-group-item-action d-flex justify-content-between">
  62. {{ object_type.content_type.name|bettertitle }}
  63. <span class="badge text-bg-primary rounded-pill">{{ object_type.item_count }}</span>
  64. </a>
  65. {% else %}
  66. <li class="list-group-item list-group-item-action d-flex justify-content-between">
  67. {{ object_type.content_type.name|bettertitle }}
  68. <span class="badge text-bg-primary rounded-pill">{{ object_type.item_count }}</span>
  69. </li>
  70. {% endif %}
  71. {% endwith %}
  72. {% endfor %}
  73. </ul>
  74. </div>
  75. {% plugin_right_page object %}
  76. </div>
  77. </div>
  78. <div class="row">
  79. <div class="col col-md-12">
  80. <div class="card">
  81. <h2 class="card-header">{% trans "Tagged Objects" %}</h2>
  82. <div class="table-responsive">
  83. {% render_table taggeditem_table 'inc/table.html' %}
  84. {% include 'inc/paginator.html' with paginator=taggeditem_table.paginator page=taggeditem_table.page %}
  85. </div>
  86. </div>
  87. {% plugin_full_width_page object %}
  88. </div>
  89. </div>
  90. {% endblock %}