Restructure, add README license and copyright
This commit is contained in:
171
ots-signs/views/tag-page.twig
Normal file
171
ots-signs/views/tag-page.twig
Normal file
@@ -0,0 +1,171 @@
|
||||
{#
|
||||
/*
|
||||
* OTS Signs Theme - Tag Page
|
||||
* Based on Xibo CMS tag-page.twig with OTS styling
|
||||
*/
|
||||
#}
|
||||
{% extends "authed.twig" %}
|
||||
{% import "inline.twig" as inline %}
|
||||
|
||||
{% block title %}{{ "Tags"|trans }} | {% endblock %}
|
||||
|
||||
{% block actionMenu %}{% endblock %}
|
||||
|
||||
{% block pageContent %}
|
||||
<div class="ots-static-page ots-displays-page">
|
||||
<div class="page-header ots-page-header">
|
||||
<h1>{% trans "Tags" %}</h1>
|
||||
<p class="text-muted">{% trans "Manage content tags." %}</p>
|
||||
</div>
|
||||
|
||||
<div class="widget content-card ots-displays-card">
|
||||
<div class="widget-body ots-displays-body">
|
||||
<div class="XiboGrid" id="{{ random() }}" data-grid-name="tagView">
|
||||
<div class="XiboFilter card mb-3 bg-light content-card ots-filter-card">
|
||||
<div class="ots-filter-header">
|
||||
<h3 class="ots-filter-title">{% trans "Filter Tags" %}</h3>
|
||||
<button type="button" class="ots-filter-toggle" id="ots-filter-collapse-btn" title="{% trans 'Toggle filter panel' %}">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="ots-filter-content" id="ots-filter-content">
|
||||
<div class="FilterDiv card-body" id="Filter">
|
||||
<form class="form-inline">
|
||||
{% set title %}{% trans "ID" %}{% endset %}
|
||||
{{ inline.number("tagId", title) }}
|
||||
|
||||
{% set title %}{% trans "Name" %}{% endset %}
|
||||
{{ inline.inputNameGrid('tag', title) }}
|
||||
|
||||
{% set title %}{% trans "Show System tags?" %}{% endset %}
|
||||
{{ inline.checkbox("isSystem", title, 0) }}
|
||||
|
||||
{% set title %}{% trans "Show only tags with values?" %}{% endset %}
|
||||
{{ inline.checkbox("haveOptions", title, 0) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="XiboData card pt-3 content-card ots-table-card">
|
||||
<div class="ots-table-toolbar">
|
||||
<button class="btn btn-sm btn-success ots-toolbar-btn XiboFormButton" title="{% trans "Add a new Tag" %}" href="{{ url_for("tag.add.form") }}"><i class="fa fa-plus-circle" aria-hidden="true"></i></button>
|
||||
<button class="btn btn-sm btn-primary ots-toolbar-btn" id="refreshGrid" title="{% trans "Refresh the Table" %}" href="#"><i class="fa fa-refresh" aria-hidden="true"></i></button>
|
||||
</div>
|
||||
<table id="tags" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "ID" %}</th>
|
||||
<th>{% trans "Name" %}</th>
|
||||
<th>{% trans "isRequired" %}</th>
|
||||
<th>{% trans "Values" %}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block javaScript %}
|
||||
<script type="text/javascript" nonce="{{ cspNonce }}">
|
||||
var table = $("#tags").DataTable({
|
||||
"language": dataTablesLanguage,
|
||||
dom: dataTablesTemplate,
|
||||
serverSide: true,
|
||||
stateSave: true,
|
||||
stateDuration: 0,
|
||||
responsive: true,
|
||||
stateLoadCallback: dataTableStateLoadCallback,
|
||||
stateSaveCallback: dataTableStateSaveCallback,
|
||||
filter: false,
|
||||
searchDelay: 3000,
|
||||
"order": [[ 1, "desc"]],
|
||||
ajax: {
|
||||
"url": "{{ url_for("tag.search") }}",
|
||||
"data": function(d) {
|
||||
$.extend(d, $("#tags").closest(".XiboGrid").find(".FilterDiv form").serializeObject());
|
||||
}
|
||||
},
|
||||
"columns": [
|
||||
{ "data": "tagId", responsivePriority: 2 },
|
||||
{ "data": "tag", responsivePriority: 2 },
|
||||
{
|
||||
"data": "isRequired",
|
||||
responsivePriority: 3,
|
||||
"render": function (data, type, row) {
|
||||
if (type != "display") {
|
||||
return data;
|
||||
}
|
||||
|
||||
var icon = "";
|
||||
if (data == 1)
|
||||
icon = "fa-check";
|
||||
else if (data == 0)
|
||||
icon = "fa-times";
|
||||
|
||||
return "<span class='fa " + icon + "'></span>";
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "options",
|
||||
responsivePriority: 3,
|
||||
"render": function (data, type, row) {
|
||||
if (type != "display") {
|
||||
return data;
|
||||
}
|
||||
|
||||
return JSON.parse(data);
|
||||
}
|
||||
},
|
||||
{
|
||||
"orderable": false,
|
||||
responsivePriority: 1,
|
||||
"data": dataTableButtonsColumn
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
table.on('draw', dataTableDraw);
|
||||
table.on('processing.dt', dataTableProcessing);
|
||||
dataTableAddButtons(table, $('#tags_wrapper').find('.dataTables_buttons'), false);
|
||||
|
||||
$("#refreshGrid").click(function () {
|
||||
table.ajax.reload();
|
||||
});
|
||||
|
||||
function usageFormOpen(dialog) {
|
||||
const $tagUsageTable = $("#tagUsageTable");
|
||||
var usageTable = $tagUsageTable.DataTable({
|
||||
"language": dataTablesLanguage,
|
||||
dom: dataTablesTemplate,
|
||||
serverSide: true,
|
||||
stateSave: true, stateDuration: 0,
|
||||
filter: false,
|
||||
searchDelay: 3000,
|
||||
responsive: true,
|
||||
"order": [[1, "asc"]],
|
||||
ajax: {
|
||||
"url": "{{ url_for("tag.usage", {id: ':id'}) }}".replace(":id", $tagUsageTable.data().tagId),
|
||||
"data": function(data) {
|
||||
return data;
|
||||
}
|
||||
},
|
||||
"columns": [
|
||||
{ "data": "entityId"},
|
||||
{ "data": "type"},
|
||||
{ "data": "name" },
|
||||
{ "data": "value" }
|
||||
]
|
||||
});
|
||||
|
||||
usageTable.on('draw', dataTableDraw);
|
||||
usageTable.on('processing.dt', dataTableProcessing);
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user