2018-03-20 21:45:57 +08:00
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
2018-06-08 16:58:28 +08:00
|
|
|
function initTable() {
|
|
|
|
RepositoryDatatable.destroy();
|
|
|
|
RepositoryDatatable.init('#' + $('.repository-table table').attr('id'));
|
|
|
|
RepositoryDatatable.redrawTableOnSidebarToggle();
|
|
|
|
}
|
|
|
|
|
2018-07-19 23:56:42 +08:00
|
|
|
function initParseRecordsModal() {
|
2018-03-20 21:45:57 +08:00
|
|
|
$('#form-records-file').on('ajax:success', function(ev, data) {
|
|
|
|
$('#modal-import-records').modal('hide');
|
|
|
|
$(data.html).appendTo('body').promise().done(function() {
|
|
|
|
$('#parse-records-modal')
|
|
|
|
.modal('show')
|
|
|
|
.on('hidden.bs.modal', function() {
|
|
|
|
animateSpinner();
|
|
|
|
location.reload();
|
|
|
|
});
|
|
|
|
repositoryRecordsImporter();
|
|
|
|
});
|
|
|
|
}).on('ajax:error', function(ev, data) {
|
|
|
|
$(this).find('.form-group').addClass('has-error');
|
|
|
|
$(this).find('.form-group').find('.help-block').remove();
|
|
|
|
$(this).find('.form-group').append("<span class='help-block'>" +
|
|
|
|
data.responseJSON.message + '</span>');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-07-19 23:56:42 +08:00
|
|
|
function initImportRecordsModal() {
|
|
|
|
$('#importRecordsButton').off().on('click', function() {
|
|
|
|
$('#modal-import-records').modal('show');
|
|
|
|
initParseRecordsModal();
|
|
|
|
});
|
2018-03-20 21:45:57 +08:00
|
|
|
}
|
|
|
|
|
2018-07-19 23:56:42 +08:00
|
|
|
initImportRecordsModal();
|
|
|
|
initTable();
|
|
|
|
}());
|