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">
|
data-type="RepositoryTextValue">
|
||||||
</div>`);
|
</div>`);
|
||||||
$cell.find('input').val(text);
|
$cell.find('input').val(text);
|
||||||
SmartAnnotation.init($cell.find('input'));
|
SmartAnnotation.init($cell.find('input'), true);
|
||||||
};
|
};
|
||||||
|
|
||||||
$.fn.dataTable.render.editRepositoryListValue = function(formId, columnId, cell) {
|
$.fn.dataTable.render.editRepositoryListValue = function(formId, columnId, cell) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ var RepositoryDatatableRowEditor = (function() {
|
||||||
function initSmartAnnotation($row) {
|
function initSmartAnnotation($row) {
|
||||||
$row.find('[data-object="repository_cell"]').each(function(el) {
|
$row.find('[data-object="repository_cell"]').each(function(el) {
|
||||||
if (el.data('atwho')) {
|
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({
|
var FilterTypeEnum = Object.freeze({
|
||||||
USER: { tag: 'users', dataUrl: $(document.body).attr('data-atwho-users-url') },
|
USER: { tag: 'users', dataUrl: $(document.body).attr('data-atwho-users-url') },
|
||||||
TASK: { tag: 'sa-tasks', dataUrl: $(document.body).attr('data-atwho-task-url') },
|
TASK: { tag: 'sa-tasks', dataUrl: $(document.body).attr('data-atwho-task-url') },
|
||||||
|
@ -121,8 +121,7 @@ var SmartAnnotation = (function() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function initAtwho() {
|
||||||
$(field).on('focus', function() {
|
|
||||||
if ($(this).data('atwho-initialized')) return;
|
if ($(this).data('atwho-initialized')) return;
|
||||||
|
|
||||||
$(field).on('shown.atwho', function() {
|
$(field).on('shown.atwho', function() {
|
||||||
|
@ -204,7 +203,14 @@ var SmartAnnotation = (function() {
|
||||||
// .atwho(atWhoSettings('sample#', FilterTypeEnum.REPOSITORY));
|
// .atwho(atWhoSettings('sample#', FilterTypeEnum.REPOSITORY));
|
||||||
|
|
||||||
$(this).data('atwho-initialized', true);
|
$(this).data('atwho-initialized', true);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
if (deferred) {
|
||||||
|
$(field).on('focus', initAtwho);
|
||||||
|
} else {
|
||||||
|
initAtwho();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -217,8 +223,8 @@ var SmartAnnotation = (function() {
|
||||||
$('.atwho-header-res').find('.fa-times').click();
|
$('.atwho-header-res').find('.fa-times').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize(field) {
|
function initialize(field, deferred) {
|
||||||
var atWho = new SetAtWho(field);
|
var atWho = new SetAtWho(field, deferred);
|
||||||
atWho.init();
|
atWho.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue