.
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
<button id="deactivate-selected-cids">Deactivate selected</button>
|
||||
<button id="delete-selected-cids">Delete selected</button>
|
||||
<button id="toggle-internal">Toggle internal</button>
|
||||
<button id="add-group">Add Group to users</button>
|
||||
<p>Select exams below to add user(s) to (or edit existing user(s)).</p>
|
||||
<div class="exam-selectors">
|
||||
<span>
|
||||
@@ -103,12 +104,12 @@
|
||||
{% endfor %}
|
||||
|
||||
</select>
|
||||
<button id="add-group">Add Group to users</button>
|
||||
</div>
|
||||
<button id="add-new-cids">Add New (Blank) Users</button>
|
||||
<h3>Create New Users</h3>
|
||||
<button id="add-new-cids" title="This will create N new users">Add New (Blank) Users</button>
|
||||
<input type="number" id="add-number" value="number to add"><br />
|
||||
<button id="add-new-emails">Add New Users From Email</button>
|
||||
<textarea id="emails-input" name="emails" rows="4" cols="50">Enter emails here</textarea>
|
||||
<button id="add-new-emails" title="This will create users from a list of email addresses">Add New Users From Email</button>
|
||||
<textarea id="emails-input" name="emails" rows="4" cols="50" placeholder="Enter emails here (single email per line)"></textarea>
|
||||
</details>
|
||||
|
||||
{% endblock %}
|
||||
@@ -116,51 +117,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"/>
|
||||
{% comment %} <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> {% endcomment %}
|
||||
|
||||
<script>
|
||||
jQuery.fn.dataTable.render.ellipsis = function ( cutoff, wordbreak, escapeHtml ) {
|
||||
var esc = function ( t ) {
|
||||
return t
|
||||
.replace( /&/g, '&' )
|
||||
.replace( /</g, '<' )
|
||||
.replace( />/g, '>' )
|
||||
.replace( /"/g, '"' );
|
||||
};
|
||||
// jQuery.fn.dataTable.render.ellipsis = function ( cutoff, wordbreak, escapeHtml ) {
|
||||
//var esc = function ( t ) {
|
||||
//return t
|
||||
//.replace( /&/g, '&' )
|
||||
//.replace( /</g, '<' )
|
||||
//.replace( />/g, '>' )
|
||||
//.replace( /"/g, '"' );
|
||||
//};
|
||||
|
||||
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+'…</span>';
|
||||
};
|
||||
};
|
||||
//return '<span class="ellipsis" title="'+esc(d)+'">'+shortened+'…</span>';
|
||||
//};
|
||||
//};
|
||||
|
||||
function postAjax(data) {
|
||||
|
||||
@@ -177,6 +178,8 @@
|
||||
if (data.status == "success") {
|
||||
toastr.info('Added/Updated');
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.error(data.details)
|
||||
}
|
||||
// show some message according to the response.
|
||||
// For eg. A message box showing that the status has been changed
|
||||
@@ -215,19 +218,19 @@
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
{% if exams %}
|
||||
$("table").DataTable({
|
||||
columnDefs: [ {
|
||||
targets: [6,7,8,9,10],
|
||||
render: $.fn.dataTable.render.ellipsis( 17, true )
|
||||
} ],
|
||||
"paging": false,
|
||||
});
|
||||
{% else %}
|
||||
$("table").DataTable({
|
||||
"paging": false,
|
||||
});
|
||||
{% endif %}
|
||||
// {% if exams %}
|
||||
//$("table").DataTable({
|
||||
//columnDefs: [ {
|
||||
//targets: [6,7,8,9,10],
|
||||
//render: $.fn.dataTable.render.ellipsis( 17, true )
|
||||
//} ],
|
||||
//"paging": false,
|
||||
//});
|
||||
//{% else %}
|
||||
//$("table").DataTable({
|
||||
//"paging": false,
|
||||
//});
|
||||
//{% endif %}
|
||||
|
||||
$("#toggle-internal").click((evt) => {
|
||||
data = getGenericData();
|
||||
@@ -237,6 +240,7 @@
|
||||
$("#add-new-emails").click((evt) => {
|
||||
data = getGenericData();
|
||||
data["emails"] = JSON.stringify($("#emails-input").val());
|
||||
data["add_new_emails"] = true;
|
||||
postAjax(data);
|
||||
});
|
||||
$("#add-group").click((evt) => {
|
||||
|
||||
Reference in New Issue
Block a user