mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-10 13:59:56 +08:00
Fix constant initialization
This commit is contained in:
parent
818a4dfdb3
commit
c9de9e857f
1 changed files with 391 additions and 390 deletions
|
@ -1,9 +1,9 @@
|
||||||
/* global I18n dropdownSelector HelperModule animateSpinner */
|
/* global I18n dropdownSelector HelperModule animateSpinner */
|
||||||
/* eslint-disable no-use-before-define */
|
/* eslint-disable no-use-before-define */
|
||||||
|
(function() {
|
||||||
|
const STATUS_POLLING_INTERVAL = 5000;
|
||||||
|
|
||||||
const STATUS_POLLING_INTERVAL = 5000;
|
function initTaskCollapseState() {
|
||||||
|
|
||||||
function initTaskCollapseState() {
|
|
||||||
let taskView = '.my-modules-protocols-index';
|
let taskView = '.my-modules-protocols-index';
|
||||||
let taskSection = '.task-section-caret';
|
let taskSection = '.task-section-caret';
|
||||||
let taskId = $(taskView).data('task-id');
|
let taskId = $(taskView).data('task-id');
|
||||||
|
@ -35,9 +35,9 @@ function initTaskCollapseState() {
|
||||||
|
|
||||||
collapseStateSave();
|
collapseStateSave();
|
||||||
collapseStateLoad();
|
collapseStateLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateStartDate() {
|
function updateStartDate() {
|
||||||
let updateUrl = $('#startDateContainer').data('update-url');
|
let updateUrl = $('#startDateContainer').data('update-url');
|
||||||
let val = $('#calendarStartDate').val();
|
let val = $('#calendarStartDate').val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -54,16 +54,16 @@ function updateStartDate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind ajax for editing due dates
|
// Bind ajax for editing due dates
|
||||||
function initStartDatePicker() {
|
function initStartDatePicker() {
|
||||||
$('#calendarStartDate').on('dp.change', function() {
|
$('#calendarStartDate').on('dp.change', function() {
|
||||||
updateStartDate();
|
updateStartDate();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateDueDate() {
|
function updateDueDate() {
|
||||||
let updateUrl = $('#dueDateContainer').data('update-url');
|
let updateUrl = $('#dueDateContainer').data('update-url');
|
||||||
let val = $('#calendarDueDate').val();
|
let val = $('#calendarDueDate').val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -80,18 +80,18 @@ function updateDueDate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind ajax for editing due dates
|
// Bind ajax for editing due dates
|
||||||
function initDueDatePicker() {
|
function initDueDatePicker() {
|
||||||
$('#calendarDueDate').on('dp.change', function() {
|
$('#calendarDueDate').on('dp.change', function() {
|
||||||
updateDueDate();
|
updateDueDate();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Bind ajax for editing tags
|
// Bind ajax for editing tags
|
||||||
function bindEditTagsAjax() {
|
function bindEditTagsAjax() {
|
||||||
var manageTagsModal = null;
|
var manageTagsModal = null;
|
||||||
var manageTagsModalBody = null;
|
var manageTagsModalBody = null;
|
||||||
|
|
||||||
|
@ -236,9 +236,9 @@ function bindEditTagsAjax() {
|
||||||
$('#manage-module-tags-modal-module').text(data.my_module.name);
|
$('#manage-module-tags-modal-module').text(data.my_module.name);
|
||||||
initTagsModalBody(data);
|
initTagsModalBody(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkStatusState() {
|
function checkStatusState() {
|
||||||
$.getJSON($('.status-flow-dropdown').data('status-check-url'), (statusData) => {
|
$.getJSON($('.status-flow-dropdown').data('status-check-url'), (statusData) => {
|
||||||
if (statusData.status_changing) {
|
if (statusData.status_changing) {
|
||||||
setTimeout(() => { checkStatusState(); }, STATUS_POLLING_INTERVAL);
|
setTimeout(() => { checkStatusState(); }, STATUS_POLLING_INTERVAL);
|
||||||
|
@ -246,9 +246,9 @@ function checkStatusState() {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyTaskStatusChangeCallBack() {
|
function applyTaskStatusChangeCallBack() {
|
||||||
if ($('.status-flow-dropdown').data('status-changing')) {
|
if ($('.status-flow-dropdown').data('status-changing')) {
|
||||||
setTimeout(() => { checkStatusState(); }, STATUS_POLLING_INTERVAL);
|
setTimeout(() => { checkStatusState(); }, STATUS_POLLING_INTERVAL);
|
||||||
}
|
}
|
||||||
|
@ -272,9 +272,9 @@ function applyTaskStatusChangeCallBack() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initTagsSelector() {
|
function initTagsSelector() {
|
||||||
var myModuleTagsSelector = '#module-tags-selector';
|
var myModuleTagsSelector = '#module-tags-selector';
|
||||||
|
|
||||||
dropdownSelector.init(myModuleTagsSelector, {
|
dropdownSelector.init(myModuleTagsSelector, {
|
||||||
|
@ -352,9 +352,9 @@ function initTagsSelector() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).getContainer(myModuleTagsSelector).addClass('my-module-tags-container');
|
}).getContainer(myModuleTagsSelector).addClass('my-module-tags-container');
|
||||||
}
|
}
|
||||||
|
|
||||||
function initAssignedUsersSelector() {
|
function initAssignedUsersSelector() {
|
||||||
var manageUsersModal = $('#manage-module-users-modal');
|
var manageUsersModal = $('#manage-module-users-modal');
|
||||||
var manageUsersModalBody = manageUsersModal.find('.modal-body');
|
var manageUsersModalBody = manageUsersModal.find('.modal-body');
|
||||||
|
|
||||||
|
@ -407,12 +407,13 @@ function initAssignedUsersSelector() {
|
||||||
});
|
});
|
||||||
|
|
||||||
initUsersEditLink();
|
initUsersEditLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
initTaskCollapseState();
|
initTaskCollapseState();
|
||||||
applyTaskStatusChangeCallBack();
|
applyTaskStatusChangeCallBack();
|
||||||
initTagsSelector();
|
initTagsSelector();
|
||||||
bindEditTagsAjax();
|
bindEditTagsAjax();
|
||||||
initStartDatePicker();
|
initStartDatePicker();
|
||||||
initDueDatePicker();
|
initDueDatePicker();
|
||||||
initAssignedUsersSelector();
|
initAssignedUsersSelector();
|
||||||
|
}());
|
||||||
|
|
Loading…
Add table
Reference in a new issue