Create js for grants

This commit is contained in:
T-Midnight 2018-12-24 11:07:02 +04:00
parent 25278bcdd8
commit 307b640e8e

View File

@ -0,0 +1,42 @@
/*<![CDATA[*/
$(document).ready(function () {
$(".grant-row").mouseenter(function (event) {
var grantRow = $(event.target).closest(".grant-row");
$(grantRow).css("background-color", "#f8f9fa");
$(grantRow).find(".remove-paper").removeClass("d-none");
});
$(".grant-row").mouseleave(function (event) {
var grantRow = $(event.target).closest(".grant-row");
$(grantRow).css("background-color", "white");
$(grantRow).closest(".grant-row").find(".remove-grant").addClass("d-none");
});
$('a[data-confirm]').click(function(ev) {
var href = $(this).attr('href');
if (!$('#dataConfirmModal').length) {
$('#modalDelete').append('<div class="modal fade" id="dataConfirmModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true"\n' +
' >\n' +
' <div class="modal-dialog modal-sm">\n' +
' <div class="modal-content">\n' +
' <div class="modal-header">\n' +
' <h8 class="modal-title" id="myModalLabel">Удалить грант?</h8>\n' +
' <button type="button" class="close" data-dismiss="modal" aria-label="Закрыть"><span\n' +
' aria-hidden="true">&times;</span></button>\n' +
' </div>\n' +
' <div class="modal-footer">\n' +
' <a class="btn btn-primary" id="dataConfirmOK">Да</a>'+
' <button class="btn primary" data-dismiss="modal" aria-hidden="true">Нет</button>'+
' </div>\n' +
' </div>\n' +
' </div>\n' +
' </div>');
}
$('#dataConfirmModal').find('#myModalLabel').text($(this).attr('data-confirm'));
$('#dataConfirmOK').attr('href', href);
$('#dataConfirmModal').modal({show:true});
return false;
});
});
/*]]>*/