forked from xibosignage/xibo-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdataset-column-page.twig
148 lines (135 loc) · 5.56 KB
/
dataset-column-page.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
{#
/**
* Copyright (C) 2020 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
* This file is part of Xibo.
*
* Xibo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Xibo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/
#}
{% extends "authed.twig" %}
{% import "inline.twig" as inline %}
{% set dataSetName = dataSet.dataSet %}
{% block title %}{% trans %}Columns for {{ dataSetName }}{% endtrans %} | {% endblock %}
{% block actionMenu %}
<div class="widget-action-menu pull-right">
<button class="btn btn-success XiboFormButton" title="{% trans "Add Column" %}" href="{{ url_for("dataSet.column.add.form", {id: dataSet.dataSetId}) }}"><i class="fa fa-plus-circle" aria-hidden="true"></i> {% trans "Add Column" %}</button>
<button class="btn btn-info XiboRedirectButton" title="{% trans "View Data" %}" href="{{ url_for("dataSet.view.data", {id: dataSet.dataSetId}) }}"><i class="fa fa-eye" aria-hidden="true"></i> {% trans "View Data" %}</button>
</div>
{% endblock %}
{% block pageContent %}
{% set widgetTitle %}{% trans %}Columns for {{ dataSetName }}{% endtrans %}{% endset %}
<div class="widget">
<div class="widget-title">{{ widgetTitle }}</div>
<div class="widget-body">
<div class="XiboGrid" id="{{ random() }}">
<div class="XiboFilter">
<div class="FilterDiv card-body" id="Filter">
<form class="form-inline">
</form>
</div>
</div>
<div class="XiboData card pt-3">
<table id="datasets" class="table table-striped" data-state-preference-name="dataSetColumnGrid">
<thead>
<tr>
<th>{% trans "Heading" %}</th>
<th>{% trans "DataType" %}</th>
<th>{% trans "Column Type" %}</th>
<th>{% trans "List Content" %}</th>
<th>{% trans "Tooltip" %}</th>
<th>{% trans "Order" %}</th>
<th>{% trans "Required?" %}</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endblock %}
{% block javaScript %}
<script type="text/javascript">
var table = $("#datasets").DataTable({
"language": dataTablesLanguage,
dom: dataTablesTemplate,
serverSide: true,
stateSave: true,
stateDuration: 0,
stateLoadCallback: dataTableStateLoadCallback,
stateSaveCallback: dataTableStateSaveCallback,
filter: false,
responsive: true,
searchDelay: 3000,
"order": [[ 0, "asc"]],
ajax: {
"url": "{{ url_for("dataSet.column.search", {id: dataSet.dataSetId}) }}",
"data": function(d) {
$.extend(d, $("#datasets").closest(".XiboGrid").find(".FilterDiv form").serializeObject());
}
},
"columns": [
{ "data": "heading", "render": dataTableSpacingPreformatted },
{ "data": "dataType" },
{ "data": "dataSetColumnType" },
{ "data": "listContent" },
{ "data": "tooltip" },
{ "data": "columnOrder" },
{
"data": "isRequired",
"render": dataTableTickCrossColumn,
"visible": false,
"name": "isRequired"
},
{
"orderable": false,
responsivePriority: 1,
"data": dataTableButtonsColumn
}
]
});
table.on('draw', dataTableDraw);
table.on('processing.dt', dataTableProcessing);
dataTableAddButtons(table, $('#datasets_wrapper').find('.dataTables_buttons'));
function dataSetColumnFormOpen(dialog) {
formHelpers.setupPhpDateFormatPopover(dialog)
// remote DataSet source
onDataTypeChanged(dialog);
$(dialog).find('#dataTypeId, #dataSetColumnTypeId').on('change', function() {
onDataTypeChanged(dialog);
});
}
function onDataTypeChanged(dialog)
{
var dataTypeId = $(dialog).find('#dataTypeId').val();
var dataSetColumnTypeId = $(dialog).find('#dataSetColumnTypeId').val();
var $dateFormat = $(dialog).find('.dateFormat');
if (dataSetColumnTypeId == 3 && dataTypeId == 3) {
$dateFormat.removeClass('d-none')
} else {
$dateFormat.addClass('d-none')
}
}
</script>
<style>
.popover{
max-width: 70%;
}
</style>
{% endblock %}