-
Notifications
You must be signed in to change notification settings - Fork 2
/
tufts.js
51 lines (49 loc) · 1.42 KB
/
tufts.js
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
var Tufts = {
qrStatus: function () {
var QrStatus = require('tufts/qr_status')
return new QrStatus()
},
autocomplete: function () {
var Autocomplete = require('hyrax/autocomplete')
var autocomplete = new Autocomplete()
autocomplete.setup($('#contribution_department'),'default','/authorities/search/local/departments')
},
selectAllOfHyrax: function() {
$('[data-search-option="/catalog"]').click()
},
activateDataTable: function(options) {
$(document).on('turbolinks:load', function() {
if ($.fn.dataTable.isDataTable(options.selector)) {
table = $(options.selector).DataTable()
}
else {
table = $(options.selector).DataTable( {
paging: options.paging
})
}
})
$(document).on("turbolinks:before-cache", function() {
$(options.selector).DataTable().destroy()
})
},
activateBatchesTable: function() {
$(document).on('turbolinks:load', function() {
if ($.fn.dataTable.isDataTable('#batch-table')) {
table = $('#batch-table').DataTable()
}
else {
$('#batch-table').DataTable( {
"stateSave": true,
"processing": true,
"paging": true,
"serverSide": true,
"searching": false,
"ajax": "/batches.json"
})
}
})
$(document).on("turbolinks:before-cache", function() {
$('#batch-table').DataTable().destroy()
})
}
}