mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-14 01:24:06 -08:00
51 lines
1.5 KiB
JavaScript
Executable file
51 lines
1.5 KiB
JavaScript
Executable file
/**
|
|
* Module containing core application logic.
|
|
* @param {jQuery} $ Insulated jQuery object
|
|
* @param {JSON} settings Insulated `window.snipeit.settings` object.
|
|
* @return {IIFE} Immediately invoked. Returns self.
|
|
*/
|
|
(function($, settings) {
|
|
var Components = {};
|
|
Components.modals = {};
|
|
|
|
// confirm delete modal
|
|
Components.modals.confirmDelete = function() {
|
|
var $el = $('table');
|
|
|
|
var events = {
|
|
'click': function(evnt) {
|
|
var $context = $(this);
|
|
var $dataConfirmModal = $('#dataConfirmModal');
|
|
var href = $context.attr('href');
|
|
var message = $context.attr('data-content');
|
|
var title = $context.attr('data-title');
|
|
|
|
$('#myModalLabel').text(title);
|
|
$dataConfirmModal.find('.modal-body').text(message);
|
|
$('#dataConfirmOK').attr('href', href);
|
|
$dataConfirmModal.modal({
|
|
show: true
|
|
});
|
|
return false;
|
|
}
|
|
};
|
|
|
|
var render = function() {
|
|
$el.on('click', '.delete-asset', events['click']);
|
|
};
|
|
|
|
return {
|
|
render: render
|
|
};
|
|
};
|
|
|
|
|
|
/**
|
|
* Application start point
|
|
* Component definition stays out of load event, execution only happens.
|
|
*/
|
|
$(function() {
|
|
new Components.modals.confirmDelete().render();
|
|
});
|
|
}(jQuery, window.snipeit.settings));
|