37 lines
1.6 KiB
JavaScript
37 lines
1.6 KiB
JavaScript
$(function() {
|
|
$('.mails ul li[data-pdf-href]').on('click', function() {
|
|
$('#pdf-viewer')[0].contentWindow.postMessage($(this).data('pdf-href'),
|
|
window.location.protocol + '//' + window.location.host);
|
|
$(this).parent().find('li').removeClass('active');
|
|
$(this).addClass('active');
|
|
var source_type = $('div.source div[data-source-type]').data('source-type');
|
|
var source_pk = $('div.source .active[data-source-pk]').data('source-pk');
|
|
$.ajax({url: $('.cell.qualif').data('zone-url'),
|
|
data: {source_type: source_type,
|
|
source_pk: source_pk},
|
|
async: true,
|
|
dataType: 'html',
|
|
success: function(data) {
|
|
$('.cell.qualif > div').replaceWith(data);
|
|
$('.cell.qualif select').select2();
|
|
},
|
|
error: function(error) { console.log(':(', error); }
|
|
});
|
|
});
|
|
$('.qualif').delegate('button', 'click', function() {
|
|
var formdef_reference = $('#id_formdef_reference').val();
|
|
var source_type = $('div.source div[data-source-type]').data('source-type');
|
|
var source_pk = $('div.source .active[data-source-pk]').data('source-pk');
|
|
$.ajax({url: $('.cell.qualif').data('zone-url'),
|
|
data: {formdef_reference: formdef_reference,
|
|
source_type: source_type,
|
|
source_pk: source_pk},
|
|
method: 'POST',
|
|
dataType: 'html',
|
|
success: function(data) { $('.cell.qualif > div').replaceWith(data); },
|
|
error: function(error) { console.log(':(', error); }
|
|
});
|
|
return false;
|
|
});
|
|
});
|