This commit is contained in:
Ross
2022-01-10 14:26:16 +00:00
parent e3dbdb2615
commit 2d5968c014
2 changed files with 56 additions and 53 deletions
+46 -44
View File
@@ -15,9 +15,9 @@
</div>
<div>
<span id="manage-span">
{% render_table table %}
</span>
<span id="manage-span">
{% render_table table %}
</span>
</div>
<details>
@@ -102,51 +102,51 @@
{% block js %}
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.11.3/r-2.2.9/datatables.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.11.3/r-2.2.9/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.11.3/r-2.2.9/datatables.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs4/dt-1.11.3/r-2.2.9/datatables.min.js"></script>
<script>
jQuery.fn.dataTable.render.ellipsis = function ( cutoff, wordbreak, escapeHtml ) {
var esc = function ( t ) {
return t
.replace( /&/g, '&amp;' )
.replace( /</g, '&lt;' )
.replace( />/g, '&gt;' )
.replace( /"/g, '&quot;' );
};
jQuery.fn.dataTable.render.ellipsis = function ( cutoff, wordbreak, escapeHtml ) {
var esc = function ( t ) {
return t
.replace( /&/g, '&amp;' )
.replace( /</g, '&lt;' )
.replace( />/g, '&gt;' )
.replace( /"/g, '&quot;' );
};
return function ( d, type, row ) {
// Order, search and type get the original data
if ( type !== 'display' ) {
return d;
}
return function ( d, type, row ) {
// Order, search and type get the original data
if ( type !== 'display' ) {
return d;
}
if ( typeof d !== 'number' && typeof d !== 'string' ) {
return d;
}
if ( typeof d !== 'number' && typeof d !== 'string' ) {
return d;
}
d = d.toString(); // cast numbers
d = d.toString(); // cast numbers
if ( d.length <= cutoff ) {
return d;
}
if ( d.length <= cutoff ) {
return d;
}
var shortened = d.substr(0, cutoff-1);
var shortened = d.substr(0, cutoff-1);
// Find the last white space character in the string
if ( wordbreak ) {
shortened = shortened.replace(/\s([^\s]*)$/, '');
}
// Find the last white space character in the string
if ( wordbreak ) {
shortened = shortened.replace(/\s([^\s]*)$/, '');
}
// Protect against uncontrolled HTML input
if ( escapeHtml ) {
shortened = esc( shortened );
}
// Protect against uncontrolled HTML input
if ( escapeHtml ) {
shortened = esc( shortened );
}
return '<span class="ellipsis" title="'+esc(d)+'">'+shortened+'&#8230;</span>';
};
};
return '<span class="ellipsis" title="'+esc(d)+'">'+shortened+'&#8230;</span>';
};
};
function postAjax(data) {
@@ -200,13 +200,15 @@ jQuery.fn.dataTable.render.ellipsis = function ( cutoff, wordbreak, escapeHtml )
$(document).ready(function () {
$("table").DataTable({
columnDefs: [ {
targets: [6,7,8,9,10],
render: $.fn.dataTable.render.ellipsis( 17, true )
} ],
"paging": false,
});
{% if exams %}
$("table").DataTable({
columnDefs: [ {
targets: [6,7,8,9,10],
render: $.fn.dataTable.render.ellipsis( 17, true )
} ],
"paging": false,
});
{% endif %}
$("#toggle-internal").click((evt) => {
data = getGenericData();
+1
View File
@@ -1326,6 +1326,7 @@ class CidUserExamView(CidManagerRequiredMixin, SingleTableMixin, FilterView):
context["longs_exams"] = longs_exams
context["anatomy_exams"] = anatomy_exams
context["cid_user_groups"] = cid_user_groups
context["exams"] = True
return context
class CidUserView(CidManagerRequiredMixin, SingleTableMixin, FilterView):