mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 15:36:22 +08:00
Make deferred SmartAnnotation loading optional [SCI-7534]
This commit is contained in:
parent
f231c69a02
commit
76de2d1380
|
@ -40,7 +40,7 @@ $.fn.dataTable.render.editRepositoryTextValue = function(formId, columnId, cell)
|
|||
data-type="RepositoryTextValue">
|
||||
</div>`);
|
||||
$cell.find('input').val(text);
|
||||
SmartAnnotation.init($cell.find('input'));
|
||||
SmartAnnotation.init($cell.find('input'), true);
|
||||
};
|
||||
|
||||
$.fn.dataTable.render.editRepositoryListValue = function(formId, columnId, cell) {
|
||||
|
|
|
@ -16,7 +16,7 @@ var RepositoryDatatableRowEditor = (function() {
|
|||
function initSmartAnnotation($row) {
|
||||
$row.find('[data-object="repository_cell"]').each(function(el) {
|
||||
if (el.data('atwho')) {
|
||||
SmartAnnotation.init(el);
|
||||
SmartAnnotation.init(el, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ var SmartAnnotation = (function() {
|
|||
});
|
||||
}
|
||||
|
||||
function SetAtWho(field) {
|
||||
function SetAtWho(field, deferred) {
|
||||
var FilterTypeEnum = Object.freeze({
|
||||
USER: { tag: 'users', dataUrl: $(document.body).attr('data-atwho-users-url') },
|
||||
TASK: { tag: 'sa-tasks', dataUrl: $(document.body).attr('data-atwho-task-url') },
|
||||
|
@ -121,8 +121,7 @@ var SmartAnnotation = (function() {
|
|||
};
|
||||
}
|
||||
|
||||
function init() {
|
||||
$(field).on('focus', function() {
|
||||
function initAtwho() {
|
||||
if ($(this).data('atwho-initialized')) return;
|
||||
|
||||
$(field).on('shown.atwho', function() {
|
||||
|
@ -204,7 +203,14 @@ var SmartAnnotation = (function() {
|
|||
// .atwho(atWhoSettings('sample#', FilterTypeEnum.REPOSITORY));
|
||||
|
||||
$(this).data('atwho-initialized', true);
|
||||
});
|
||||
}
|
||||
|
||||
function init() {
|
||||
if (deferred) {
|
||||
$(field).on('focus', initAtwho);
|
||||
} else {
|
||||
initAtwho();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -217,8 +223,8 @@ var SmartAnnotation = (function() {
|
|||
$('.atwho-header-res').find('.fa-times').click();
|
||||
}
|
||||
|
||||
function initialize(field) {
|
||||
var atWho = new SetAtWho(field);
|
||||
function initialize(field, deferred) {
|
||||
var atWho = new SetAtWho(field, deferred);
|
||||
atWho.init();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue