Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

ESLint fixes

Alexander Brandon Coles48c12a3fa8c1
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/backlog.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/backlog.ts
index 2372651915f..91cb0937b8c 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/backlog.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/backlog.ts
@@ -43,7 +43,7 @@ RB.Backlog = (function ($) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create({
- initialize: function (el: any) {
+ initialize(el:any) {
this.$ = $(el);
this.el = el;
@@ -54,19 +54,19 @@ RB.Backlog = (function ($) {
this.getList().sortable({
connectWith: '.stories',
dropOnEmpty: true,
- start: this.dragStart,
- stop: this.dragStop,
- update: this.dragComplete,
+ start: this.dragStart,
+ stop: this.dragStop,
+ update: this.dragComplete,
receive: this.dragChanged,
- remove: this.dragChanged,
+ remove: this.dragChanged,
containment: $('#backlogs_container'),
cancel: 'input, textarea, button, select, option, .prevent_drag',
scroll: true,
- helper: function(event: any, ui: any){
- var $clone = $(ui).clone();
- $clone .css('position','absolute');
+ helper(event:any, ui:any) {
+ const $clone = $(ui).clone();
+ $clone.css('position', 'absolute');
return $clone.get(0);
- }
+ },
});
// Observe menu items
@@ -81,7 +81,7 @@ RB.Backlog = (function ($) {
}
// Initialize each item in the backlog
- this.getStories().each(function(this: any, index: any) {
+ this.getStories().each(function (this:any, index:any) {
// 'this' refers to an element with class="story"
// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Factory.initialize(RB.Story, this);
@@ -92,12 +92,12 @@ RB.Backlog = (function ($) {
}
},
- dragChanged: function (e: any, ui: any) {
+ dragChanged(e:any, ui:any) {
$(this).parents('.backlog').data('this').refresh();
},
- dragComplete: function (e: any, ui: any) {
- var isDropTarget = (ui.sender === null || ui.sender === undefined);
+ dragComplete(e:any, ui:any) {
+ const isDropTarget = (ui.sender === null || ui.sender === undefined);
// jQuery triggers dragComplete of source and target.
// Thus we have to check here. Otherwise, the story
@@ -107,29 +107,29 @@ RB.Backlog = (function ($) {
}
},
- dragStart: function (e: any, ui: any) {
- ui.item.addClass("dragging");
+ dragStart(e:any, ui:any) {
+ ui.item.addClass('dragging');
},
- dragStop: function (e: any, ui: any) {
- ui.item.removeClass("dragging");
+ dragStop(e:any, ui:any) {
+ ui.item.removeClass('dragging');
},
- getSprint: function () {
- return $(this.el).find(".model.sprint").first();
+ getSprint() {
+ return $(this.el).find('.model.sprint').first();
},
- getStories: function () {
- return this.getList().children(".story");
+ getStories() {
+ return this.getList().children('.story');
},
- getList: function () {
- return this.$.children(".stories").first();
+ getList() {
+ return this.$.children('.stories').first();
},
- handleNewStoryClick: function (e: any) {
- var toggler = $(this).parents('.header').find('.toggler');
- if (toggler.hasClass('closed')){
+ handleNewStoryClick(e:any) {
+ const toggler = $(this).parents('.header').find('.toggler');
+ if (toggler.hasClass('closed')) {
toggler.click();
}
e.preventDefault();
@@ -137,12 +137,13 @@ RB.Backlog = (function ($) {
},
// return true if backlog has an element with class="sprint"
- isSprintBacklog: function () {
+ isSprintBacklog() {
return $(this.el).find('.sprint').length === 1;
},
- newStory: function () {
- var story, o;
+ newStory() {
+ let story;
+ let o;
story = $('#story_template').children().first().clone();
this.getList().prepend(story);
@@ -154,28 +155,28 @@ RB.Backlog = (function ($) {
story.find('.editor').first().focus();
},
- refresh : function () {
+ refresh() {
this.recalcVelocity();
this.recalcOddity();
},
- recalcVelocity: function () {
- var total: any;
+ recalcVelocity() {
+ let total:any;
if (!this.isSprintBacklog()) {
return;
}
total = 0;
- this.getStories().each(function(this: any, index: any) {
+ this.getStories().each(function (this:any, index:any) {
total += $(this).data('this').getPoints();
});
this.$.children('.header').children('.velocity').text(total);
},
- recalcOddity : function () {
+ recalcOddity() {
this.$.find('.story:even').removeClass('odd').addClass('even');
this.$.find('.story:odd').removeClass('even').addClass('odd');
- }
+ },
});
}(jQuery));
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/burndown.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/burndown.ts
index c333dcbf18c..b6942b86676 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/burndown.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/burndown.ts
@@ -31,7 +31,7 @@ RB.Burndown = (function ($) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create({
- initialize: function (el: any) {
+ initialize(el:any) {
this.$ = $(el);
this.el = el;
@@ -42,26 +42,26 @@ RB.Burndown = (function ($) {
this.$.click(this.show);
},
- setSprintId : function (sprintId: any) {
+ setSprintId(sprintId:any) {
this.sprintId = sprintId;
},
- getSprintId : function (){
+ getSprintId() {
return this.sprintId;
},
- show: function (e: any) {
+ show(e:any) {
e.preventDefault();
- if ($("#charts").length === 0) {
- $('<div id="charts"></div>').appendTo("body");
+ if ($('#charts').length === 0) {
+ $('<div id="charts"></div>').appendTo('body');
}
// @ts-expect-error TS(2304): Cannot find name 'RB'.
- $('#charts').html("<div class='loading'>" + RB.i18n.generating_graph + "</div>");
+ $('#charts').html(`<div class='loading'>${RB.i18n.generating_graph}</div>`);
// @ts-expect-error TS(2304): Cannot find name 'RB'.
- var url = RB.urlFor('show_burndown_chart', { sprint_id: $(this).data('this').sprintId, project_id: RB.constants.project_id});
+ const url = RB.urlFor('show_burndown_chart', { sprint_id: $(this).data('this').sprintId, project_id: RB.constants.project_id });
window.open(url);
- }
+ },
});
}(jQuery));
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/common.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/common.ts
index c9ccfeaa1de..f80917edfc2 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/common.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/common.ts
@@ -32,16 +32,21 @@ if (window.RB === null || window.RB === undefined) {
window.RB = {};
}
-
(function ($) {
- var object: any, Factory, Dialog, UserPreferences,
- ajax;
+ let object:any;
+ let Factory;
+ let Dialog;
+ let UserPreferences;
+ let ajax;
object = {
// Douglas Crockford's technique for object extension
// http://javascript.crockford.com/prototypal.html
- create: function () {
- var obj, i, methods, methodName;
+ create() {
+ let obj;
+ let i;
+ let methods;
+ let methodName;
function F() {
}
@@ -63,34 +68,33 @@ if (window.RB === null || window.RB === undefined) {
}
}
return obj;
- }
+ },
};
-
// Object factory for chiliproject_backlogs
Factory = object.create({
- initialize: function (objType: any, el: any) {
- var obj;
+ initialize(objType:any, el:any) {
+ let obj;
obj = object.create(objType);
obj.initialize(el);
return obj;
- }
+ },
});
// Utilities
Dialog = object.create({
- msg: function (msg: any) {
- var dialog, baseClasses;
+ msg(msg:any) {
+ let dialog;
+ let baseClasses;
baseClasses = 'ui-button ui-widget ui-state-default ui-corner-all';
if ($('#msgBox').length === 0) {
dialog = $('<div id="msgBox"></div>').appendTo('body');
- }
- else {
+ } else {
dialog = $('#msgBox');
}
@@ -101,26 +105,27 @@ if (window.RB === null || window.RB === undefined) {
{
text: 'OK',
class: 'button -primary',
- click: function () {
- $(this).dialog("close");
- }
+ click() {
+ $(this).dialog('close');
+ },
}],
- modal: true
+ modal: true,
});
$('.button').removeClass(baseClasses);
$('.ui-icon-closethick').prop('title', 'close');
- }
+ },
});
ajax = (function () {
- var ajaxQueue: any, ajaxOngoing: any,
- processAjaxQueue: any;
+ let ajaxQueue:any;
+ let ajaxOngoing:any;
+ let processAjaxQueue:any;
ajaxQueue = [];
ajaxOngoing = false;
processAjaxQueue = function () {
- var options = ajaxQueue.shift();
+ const options = ajaxQueue.shift();
if (options !== null && options !== undefined) {
ajaxOngoing = true;
@@ -130,12 +135,12 @@ if (window.RB === null || window.RB === undefined) {
// Process outstanding entries in the ajax queue whenever a ajax request
// finishes.
- $(document).ajaxComplete(function (event, xhr, settings) {
+ $(document).ajaxComplete((event, xhr, settings) => {
ajaxOngoing = false;
processAjaxQueue();
});
- return function (options: any) {
+ return function (options:any) {
ajaxQueue.push(options);
if (!ajaxOngoing) {
processAjaxQueue();
@@ -146,13 +151,13 @@ if (window.RB === null || window.RB === undefined) {
// Abstract the user preference from the rest of the RB objects
// so that we can change the underlying implementation as needed
UserPreferences = object.create({
- get: function (key: any) {
+ get(key:any) {
return $.cookie(key);
},
- set: function (key: any, value: any) {
+ set(key:any, value:any) {
$.cookie(key, value, { expires: 365 * 10 });
- }
+ },
});
// @ts-expect-error TS(2304): Cannot find name 'RB'.
@@ -165,5 +170,4 @@ if (window.RB === null || window.RB === undefined) {
RB.UserPreferences = UserPreferences;
// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.ajax = ajax;
-
}(jQuery));
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/editable_inplace.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/editable_inplace.ts
index de76f44048c..22c947f995b 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/editable_inplace.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/editable_inplace.ts
@@ -31,14 +31,14 @@ RB.EditableInplace = (function ($) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.Model, {
- displayEditor: function (editor: any) {
- this.$.addClass("editing");
- editor.find(".editor").bind('keydown', this.handleKeydown);
+ displayEditor(editor:any) {
+ this.$.addClass('editing');
+ editor.find('.editor').bind('keydown', this.handleKeydown);
},
- getEditor: function () {
+ getEditor() {
// Create the model editor container if it does not yet exist
- var editor = this.$.children(".editors");
+ let editor = this.$.children('.editors');
if (editor.length === 0) {
editor = $("<div class='editors'></div>").appendTo(this.$);
@@ -49,8 +49,9 @@ RB.EditableInplace = (function ($) {
},
// For detecting Enter and ESC
- handleKeydown: function (e: any) {
- var j, that;
+ handleKeydown(e:any) {
+ let j;
+ let that;
j = $(this).parents('.model').first();
that = j.data('this');
@@ -60,6 +61,6 @@ RB.EditableInplace = (function ($) {
} else if (e.key === 'Escape') {
that.cancelEdit();
}
- }
+ },
});
}(jQuery));
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/impediment.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/impediment.ts
index 3419f3fbb5f..648c8af2803 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/impediment.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/impediment.ts
@@ -35,13 +35,13 @@ RB.Impediment = (function ($) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.Task, {
- initialize: function (el: any) {
- var j; // This ensures that we use a local 'j' variable, not a global one.
+ initialize(el:any) {
+ let j; // This ensures that we use a local 'j' variable, not a global one.
this.$ = j = $(el);
this.el = el;
- j.addClass("impediment"); // If node is based on #task_template, it doesn't have the impediment class yet
+ j.addClass('impediment'); // If node is based on #task_template, it doesn't have the impediment class yet
// Associate this object with the element for later retrieval
j.data('this', this);
@@ -50,35 +50,38 @@ RB.Impediment = (function ($) {
},
// Override saveDirectives of RB.Task
- saveDirectives: function () {
- var j, prev, statusID, data, url;
+ saveDirectives() {
+ let j;
+ let prev;
+ let statusID;
+ let data;
+ let url;
j = this.$;
prev = this.$.prev();
- statusID = j.parent('td').first().attr('id').split("_")[1];
+ statusID = j.parent('td').first().attr('id').split('_')[1];
- data = j.find('.editor').serialize() +
- "&is_impediment=true" +
+ data = `${j.find('.editor').serialize()
+ }&is_impediment=true`
// @ts-expect-error TS(2304): Cannot find name 'RB'.
- "&version_id=" + RB.constants.sprint_id +
- "&status_id=" + statusID +
- "&prev=" + (prev.length === 1 ? prev.data('this').getID() : '') +
- (this.isNew() ? "" : "&id=" + j.children('.id').text());
+ + `&version_id=${RB.constants.sprint_id
+ }&status_id=${statusID
+ }&prev=${prev.length === 1 ? prev.data('this').getID() : ''
+ }${this.isNew() ? '' : `&id=${j.children('.id').text()}`}`;
if (this.isNew()) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
- url = RB.urlFor('create_impediment', {sprint_id: RB.constants.sprint_id});
- }
- else {
+ url = RB.urlFor('create_impediment', { sprint_id: RB.constants.sprint_id });
+ } else {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
- url = RB.urlFor('update_impediment', {id: this.getID(), sprint_id: RB.constants.sprint_id});
- data += "&_method=put";
+ url = RB.urlFor('update_impediment', { id: this.getID(), sprint_id: RB.constants.sprint_id });
+ data += '&_method=put';
}
return {
- url: url,
- data: data
+ url,
+ data,
};
- }
+ },
});
}(jQuery));
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/master_backlog.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/master_backlog.ts
index 9c1bfcfb29c..9f055c6bcfc 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/master_backlog.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/master_backlog.ts
@@ -27,8 +27,7 @@
//++
// Initialize the backlogs after DOM is loaded
-jQuery(function ($) {
-
+jQuery(($) => {
// Initialize each backlog
$('.backlog').each(function (index) {
// 'this' refers to an element with class="backlog"
@@ -36,7 +35,7 @@ jQuery(function ($) {
RB.Factory.initialize(RB.Backlog, this);
});
- $('.backlog .toggler').on('click',function(){
+ $('.backlog .toggler').on('click', function () {
$(this).toggleClass('closed icon-arrow-up1 icon-arrow-down1');
$(this).parents('.backlog').find('ul.stories').toggleClass('closed');
});
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/model.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/model.ts
index 277363fe8c8..8ba9cdf6be7 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/model.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/model.ts
@@ -37,17 +37,18 @@ RB.Model = (function ($) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create({
- initialize: function (el: any) {
+ initialize(el:any) {
this.$ = $(el);
this.el = el;
},
- afterCreate: function (data: any, textStatus: any, xhr: any) {
+ afterCreate(data:any, textStatus:any, xhr:any) {
// Do nothing. Child objects may optionally override this
},
- afterSave: function (data: any, textStatus: any, xhr: any) {
- var isNew, result;
+ afterSave(data:any, textStatus:any, xhr:any) {
+ let isNew;
+ let result;
isNew = this.isNew();
// @ts-expect-error TS(2304): Cannot find name 'RB'.
@@ -59,48 +60,46 @@ RB.Model = (function ($) {
if (isNew) {
this.$.attr('id', result.$.attr('id'));
this.afterCreate(data, textStatus, xhr);
- }
- else {
+ } else {
this.afterUpdate(data, textStatus, xhr);
}
},
- afterUpdate: function (data: any, textStatus: any, xhr: any) {
+ afterUpdate(data:any, textStatus:any, xhr:any) {
// Do nothing. Child objects may optionally override this
},
- beforeSave: function () {
+ beforeSave() {
// Do nothing. Child objects may or may not override this method
},
- cancelEdit: function () {
+ cancelEdit() {
this.endEdit();
if (this.isNew()) {
this.$.hide('blind');
}
},
- close: function () {
+ close() {
this.$.addClass('closed');
},
- copyFromDialog: function () {
- var editors;
+ copyFromDialog() {
+ let editors;
- if (this.$.find(".editors").length === 0) {
+ if (this.$.find('.editors').length === 0) {
editors = $("<div class='editors'></div>").appendTo(this.$);
+ } else {
+ editors = this.$.find('.editors').first();
}
- else {
- editors = this.$.find(".editors").first();
- }
- editors.html("");
- editors.append($("#" + this.getType().toLowerCase() + "_editor").children(".editor"));
+ editors.html('');
+ editors.append($(`#${this.getType().toLowerCase()}_editor`).children('.editor'));
this.saveEdits();
},
- displayEditor: function (editor: any) {
- var self = this,
- baseClasses;
+ displayEditor(editor:any) {
+ const self = this;
+ let baseClasses;
baseClasses = 'ui-button ui-widget ui-state-default ui-corner-all';
@@ -109,43 +108,43 @@ RB.Model = (function ($) {
{
text: 'OK',
class: 'button -primary',
- click: function () {
+ click() {
self.copyFromDialog();
- $(this).dialog("close");
- }
+ $(this).dialog('close');
+ },
},
{
text: 'Cancel',
class: 'button',
- click: function () {
+ click() {
self.cancelEdit();
- $(this).dialog("close");
- }
+ $(this).dialog('close');
+ },
},
],
- close: function (e: any, ui: any) {
+ close(e:any, ui:any) {
if (e.type === 'click' || (e.type === 'keydown' && e.key === 'Escape')) {
self.cancelEdit();
}
},
- dialogClass: this.getType().toLowerCase() + '_editor_dialog',
- modal: true,
- position: { my: 'center', at: 'center', of: window },
- resizable: false,
- title: (this.isNew() ? this.newDialogTitle() : this.editDialogTitle())
+ dialogClass: `${this.getType().toLowerCase()}_editor_dialog`,
+ modal: true,
+ position: { my: 'center', at: 'center', of: window },
+ resizable: false,
+ title: (this.isNew() ? this.newDialogTitle() : this.editDialogTitle()),
});
- editor.find(".editor").first().focus();
+ editor.find('.editor').first().focus();
$('.button').removeClass(baseClasses);
$('.ui-icon-closethick').prop('title', 'close');
},
- edit: function () {
- var editor = this.getEditor(),
- self = this,
- maxTabIndex = 0;
+ edit() {
+ const editor = this.getEditor();
+ const self = this;
+ let maxTabIndex = 0;
$('.stories .editors .editor').each(function (index) {
- var value;
+ let value;
// @ts-expect-error TS(2345): Argument of type 'string | undefined' is not assig... Remove this comment to see the full error message
value = parseInt($(this).attr('tabindex'), 10);
@@ -156,7 +155,7 @@ RB.Model = (function ($) {
});
if (!editor.hasClass('permanent')) {
- this.$.find('.editable').each(function(this: any, index: any) {
+ this.$.find('.editable').each(function (this:any, index:any) {
const field = $(this);
const fieldId = field.attr('field_id');
const fieldName = field.attr('fieldname');
@@ -167,7 +166,7 @@ RB.Model = (function ($) {
const fieldType = field.attr('fieldtype') || 'input';
let typeId;
let statusId;
- let input: any;
+ let input:any;
if (fieldType === 'select') {
// Special handling for status_id => they are dependent of type_id
@@ -180,7 +179,7 @@ RB.Model = (function ($) {
statusId = $.trim(self.$.find('.status_id .v').html());
input = self.findFactory(typeId, statusId, fieldName);
} else if (fieldName === 'type_id') {
- input = $('#' + fieldName + '_options').clone(true);
+ input = $(`#${fieldName}_options`).clone(true);
// if the type changes the status dropdown has to be modified
input.change(function () {
// @ts-expect-error TS(2683): 'this' implicitly has type 'any' because it does n... Remove this comment to see the full error message
@@ -192,7 +191,7 @@ RB.Model = (function ($) {
newInput = self.replaceStatusForNewType(input, newInput, $(this).parent().find('.status_id').val(), editor);
});
} else {
- input = $('#' + fieldName + '_options').clone(true);
+ input = $(`#${fieldName}_options`).clone(true);
}
} else {
input = $(document.createElement(fieldType));
@@ -206,15 +205,15 @@ RB.Model = (function ($) {
// Record in the model's root element which input field had the last focus. We will
// use this information inside RB.Model.refresh() to determine where to return the
// focus after the element has been refreshed with info from the server.
- input.focus(function(this: any) {
+ input.focus(function (this:any) {
self.$.data('focus', $(this).attr('name'));
});
- input.blur(function () {
+ input.blur(() => {
self.$.data('focus', '');
});
- $("<label />").attr({
+ $('<label />').attr({
for: input.attr('id'),
// @ts-expect-error TS(2345): Argument of type 'string | undefined' is not assig... Remove this comment to see the full error message
}).text(fieldLabel).appendTo(editor);
@@ -227,20 +226,20 @@ RB.Model = (function ($) {
return editor;
},
- findFactory: function (typeId: any, statusId: any, fieldName: any){
+ findFactory(typeId:any, statusId:any, fieldName:any) {
// Find a factory
- let newInput = $('#' + fieldName + '_options_' + typeId + '_' + statusId);
+ let newInput = $(`#${fieldName}_options_${typeId}_${statusId}`);
if (newInput.length === 0) {
// when no list found, only offer the default status
// no list = combination is not valid / user has no rights -> workflow
- newInput = $('#status_id_options_default_' + statusId);
+ newInput = $(`#status_id_options_default_${statusId}`);
}
newInput = newInput.clone(true);
return newInput;
},
- prepareInputFromFactory: function (input: any, fieldId: any, fieldName: any, fieldOrder: any, maxTabIndex: any, fieldEditable: any) {
- input.attr('id', fieldName + '_' + fieldId);
+ prepareInputFromFactory(input:any, fieldId:any, fieldName:any, fieldOrder:any, maxTabIndex:any, fieldEditable:any) {
+ input.attr('id', `${fieldName}_${fieldId}`);
input.attr('name', fieldName);
input.attr('tabindex', fieldOrder + maxTabIndex);
if (fieldEditable !== 'true') {
@@ -253,19 +252,19 @@ RB.Model = (function ($) {
return input;
},
- replaceStatusForNewType: function (input: any,newInput: any, statusId: any, editor: any) {
+ replaceStatusForNewType(input:any, newInput:any, statusId:any, editor:any) {
// Append an empty field and select it in case the old status is not available
newInput.val(statusId); // try to set the status
- if (newInput.val() !== statusId){
- newInput.append(new Option('',''));
+ if (newInput.val() !== statusId) {
+ newInput.append(new Option('', ''));
newInput.val('');
}
- newInput.focus(function(this: any) {
+ newInput.focus(function (this:any) {
// @ts-expect-error TS(2339): Property '$' does not exist on type 'Window & type... Remove this comment to see the full error message
self.$.data('focus', $(this).attr('name'));
});
- newInput.blur(function () {
+ newInput.blur(() => {
// @ts-expect-error TS(2339): Property '$' does not exist on type 'Window & type... Remove this comment to see the full error message
self.$.data('focus', '');
});
@@ -274,47 +273,49 @@ RB.Model = (function ($) {
},
// Override this method to change the dialog title
- editDialogTitle: function () {
- return "Edit " + this.getType();
+ editDialogTitle() {
+ return `Edit ${this.getType()}`;
},
- editorDisplayed: function (editor: any) {
+ editorDisplayed(editor:any) {
// Do nothing. Child objects may override this.
},
- endEdit: function () {
+ endEdit() {
this.$.removeClass('editing');
},
- error: function (xhr: any, textStatus: any, error: any) {
+ error(xhr:any, textStatus:any, error:any) {
this.markError();
// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Dialog.msg($(xhr.responseText).find('.errors').html());
this.processError(xhr, textStatus, error);
},
- getEditor: function () {
- var editorId, editor;
+ getEditor() {
+ let editorId;
+ let editor;
+
// Create the model editor if it does not yet exist
- editorId = this.getType().toLowerCase() + "_editor";
+ editorId = `${this.getType().toLowerCase()}_editor`;
- editor = $("#" + editorId).html("");
+ editor = $(`#${editorId}`).html('');
if (editor.length === 0) {
- editor = $("<div id='" + editorId + "'></div>").appendTo("body");
+ editor = $(`<div id='${editorId}'></div>`).appendTo('body');
}
return editor;
},
- getID: function () {
+ getID() {
return this.$.children('.id').children('.v').text();
},
- getType: function () {
- throw new Error("Child objects must override getType()");
+ getType() {
+ throw new Error('Child objects must override getType()');
},
- handleClick: function (e: any) {
+ handleClick(e:any) {
const field = $(this);
const model = field.parents('.model').first().data('this');
const j = model.$;
@@ -323,72 +324,70 @@ RB.Model = (function ($) {
&& !j.hasClass('dragging')
&& !j.hasClass('prevent_edit')
&& !$(e.target).hasClass('prevent_edit')
- && e.target.closest('.editable').getAttribute('fieldeditable') !== 'false' ) {
+ && e.target.closest('.editable').getAttribute('fieldeditable') !== 'false') {
const editor = model.edit();
- var input = editor.find('.' + $(e.currentTarget).attr('fieldname') + '.editor');
+ const input = editor.find(`.${$(e.currentTarget).attr('fieldname')}.editor`);
input.focus();
input.click();
}
},
- handleSelect: function (e: any) {
- var j = $(this),
- self = j.data('this');
-
- if (!$(e.target).hasClass('editable') &&
- !$(e.target).hasClass('checkbox') &&
- !j.hasClass('editing') &&
- e.target.tagName !== 'A' &&
- !j.hasClass('dragging')) {
+ handleSelect(e:any) {
+ const j = $(this);
+ const self = j.data('this');
+ if (!$(e.target).hasClass('editable')
+ && !$(e.target).hasClass('checkbox')
+ && !j.hasClass('editing')
+ && e.target.tagName !== 'A'
+ && !j.hasClass('dragging')) {
self.setSelection(!self.isSelected());
}
},
- isClosed: function () {
+ isClosed() {
return this.$.hasClass('closed');
},
- isNew: function () {
- return this.getID() === "";
+ isNew() {
+ return this.getID() === '';
},
- markError: function () {
+ markError() {
this.$.addClass('error icon icon-bug');
},
- markIfClosed: function () {
- throw new Error("Child objects must override markIfClosed()");
+ markIfClosed() {
+ throw new Error('Child objects must override markIfClosed()');
},
- markSaving: function () {
+ markSaving() {
this.$.addClass('ajax-indicator');
},
// Override this method to change the dialog title
- newDialogTitle: function () {
- return "New " + this.getType();
+ newDialogTitle() {
+ return `New ${this.getType()}`;
},
- open: function () {
+ open() {
this.$.removeClass('closed');
},
- processError: function (x: any, t: any, e: any) {
+ processError(x:any, t:any, e:any) {
// Override as needed
},
- refresh: function (obj: any) {
+ refresh(obj:any) {
this.$.html(obj.$.html());
if (obj.$.length > 1) {
// execute script tags, that were attached to the sources
- obj.$.filter('script').each(function(this: any) {
+ obj.$.filter('script').each(function (this:any) {
try {
$.globalEval($(this).html());
- }
- catch (e) {
+ } catch (e) {
}
});
}
@@ -402,39 +401,38 @@ RB.Model = (function ($) {
this.refreshed();
},
- refreshed: function () {
+ refreshed() {
// Override as needed
},
- saveDirectives: function () {
- throw new Error("Child object must implement saveDirectives()");
+ saveDirectives() {
+ throw new Error('Child object must implement saveDirectives()');
},
- saveEdits: function () {
- var j = this.$,
- self = this,
- editors = j.find('.editor'),
- saveDir;
+ saveEdits() {
+ const j = this.$;
+ const self = this;
+ const editors = j.find('.editor');
+ let saveDir;
// Copy the values from the fields to the proper html elements
- editors.each(function(this: any, index: any) {
+ editors.each(function (this:any, index:any) {
const editor = $(this).find('input,select,textarea').addBack('input,select,textarea');
const fieldName = editor.attr('name');
const type = editor.attr('type');
- if (type && type.match(/select/)) {
+ if (type?.match(/select/)) {
// if the user changes the type and that type does not offer the status
// of the current story, the status field is set to blank
// if the user saves this edit we will receive a validation error
// the following 3 lines will prevent the override of the status id
// otherwise we would loose the status id of the current ticket
- if (!(editor.val() === '' && fieldName === 'status_id')){
- j.children('div.' + fieldName).children('.v').text(editor.val());
+ if (!(editor.val() === '' && fieldName === 'status_id')) {
+ j.children(`div.${fieldName}`).children('.v').text(editor.val());
}
- j.children('div.' + fieldName).children('.t').text(editor.children(':selected').text());
-
+ j.children(`div.${fieldName}`).children('.t').text(editor.children(':selected').text());
} else {
- j.children('div.' + fieldName).text(editor.val());
+ j.children(`div.${fieldName}`).text(editor.val());
}
});
@@ -450,25 +448,25 @@ RB.Model = (function ($) {
self.markSaving();
// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.ajax({
- type: "POST",
+ type: 'POST',
url: saveDir.url,
data: saveDir.data,
- success : function (d: any, t: any, x: any) {
+ success(d:any, t:any, x:any) {
self.afterSave(d, t, x);
},
- error : function (x: any, t: any, e: any) {
+ error(x:any, t:any, e:any) {
self.error(x, t, e);
- }
+ },
});
self.endEdit();
},
- unmarkError: function () {
+ unmarkError() {
this.$.removeClass('error icon icon-bug');
},
- unmarkSaving: function () {
+ unmarkSaving() {
this.$.removeClass('ajax-indicator');
- }
+ },
});
}(jQuery));
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/show_main.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/show_main.ts
index ba14dbcfb73..f56db5e6edf 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/show_main.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/show_main.ts
@@ -27,8 +27,8 @@
//++
// Initialize everything after DOM is loaded
-jQuery(function ($) {
- var defaultDialogColor: any; // this var is used as cache for some computation in
+jQuery(($) => {
+ let defaultDialogColor:any; // this var is used as cache for some computation in
// the inner function. -> Do not move to where it
// actually belongs!
@@ -36,7 +36,7 @@ jQuery(function ($) {
RB.Factory.initialize(RB.Taskboard, $('#taskboard'));
$('#assigned_to_id_options').change(function () {
- var selected = $(this).children(':selected');
+ const selected = $(this).children(':selected');
if (!defaultDialogColor) {
// fetch the color from the task rendered as a prototype/template for new tasks
defaultDialogColor = $('#work_package_').css('background-color');
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/sprint.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/sprint.ts
index 723e6b359be..cfa97609630 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/sprint.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/sprint.ts
@@ -35,7 +35,7 @@ RB.Sprint = (function ($) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.Model, RB.EditableInplace, {
- initialize: function (el: any) {
+ initialize(el:any) {
this.$ = $(el);
this.el = el;
@@ -44,37 +44,37 @@ RB.Sprint = (function ($) {
this.$.on('mouseup', '.editable', this.handleClick);
},
- beforeSave: function () {
+ beforeSave() {
// Do nothing
},
- getType: function () {
- return "Sprint";
+ getType() {
+ return 'Sprint';
},
- markIfClosed: function () {
+ markIfClosed() {
// Do nothing
},
- refreshed: function () {
+ refreshed() {
// Do nothing
},
- saveDirectives: function () {
+ saveDirectives() {
const wrapper = this.$;
const editor = wrapper.find('.editor');
- const data = editor.serialize() + "&_method=put";
+ const data = `${editor.serialize()}&_method=put`;
// @ts-expect-error TS(2304): Cannot find name 'RB'.
const url = RB.urlFor('update_sprint', { id: this.getID() });
return {
- url : url,
- data: data
+ url,
+ data,
};
},
- beforeSaveDragResult: function () {
+ beforeSaveDragResult() {
// Do nothing
- }
+ },
});
}(jQuery));
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/story.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/story.ts
index 33043fa3689..ced6773010a 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/story.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/story.ts
@@ -33,7 +33,7 @@
RB.Story = (function ($) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.WorkPackage, RB.EditableInplace, {
- initialize: function (el: any) {
+ initialize(el:any) {
this.$ = $(el);
this.el = el;
@@ -45,68 +45,72 @@ RB.Story = (function ($) {
/**
* Callbacks from model.js
**/
- beforeSave: function () {
+ beforeSave() {
this.refreshStory();
},
- afterCreate: function (data: any, textStatus: any, xhr: any) {
+ afterCreate(data:any, textStatus:any, xhr:any) {
this.refreshStory();
},
- afterUpdate : function (data: any, textStatus: any, xhr: any) {
+ afterUpdate(data:any, textStatus:any, xhr:any) {
this.refreshStory();
},
- refreshed: function () {
+ refreshed() {
this.refreshStory();
},
/**/
- editDialogTitle: function () {
- return "Story #" + this.getID();
+ editDialogTitle() {
+ return `Story #${this.getID()}`;
},
- editorDisplayed: function (editor: any) { },
+ editorDisplayed(editor:any) { },
- getPoints: function () {
- var points = parseInt(this.$.find('.story_points').first().text(), 10);
+ getPoints() {
+ const points = parseInt(this.$.find('.story_points').first().text(), 10);
return isNaN(points) ? 0 : points;
},
- getType: function () {
- return "Story";
+ getType() {
+ return 'Story';
},
- markIfClosed: function () {
+ markIfClosed() {
// Do nothing
},
- newDialogTitle: function () {
- return "New Story";
+ newDialogTitle() {
+ return 'New Story';
},
- refreshStory : function () {
+ refreshStory() {
this.recalcVelocity();
},
- recalcVelocity: function () {
- this.$.parents(".backlog").first().data('this').refresh();
+ recalcVelocity() {
+ this.$.parents('.backlog').first().data('this').refresh();
},
- saveDirectives: function () {
- var url, prev, sprintId, data;
+ saveDirectives() {
+ let url;
+ let prev;
+ let sprintId;
+ let data;
prev = this.$.prev();
- sprintId = this.$.parents('.backlog').data('this').isSprintBacklog() ?
- this.$.parents('.backlog').data('this').getSprint().data('this').getID() :
- '';
+ sprintId = this.$.parents('.backlog').data('this').isSprintBacklog()
+ ? this.$.parents('.backlog').data('this').getSprint().data('this')
+.getID()
+ : '';
- data = "prev=" +
- (prev.length === 1 ? prev.data('this').getID() : '') +
- "&version_id=" + sprintId;
+ data = `prev=${
+ prev.length === 1 ? prev.data('this').getID() : ''
+ }&version_id=${sprintId}`;
if (this.$.find('.editor').length > 0) {
- data += "&" + this.$.find('.editor').serialize();
+ data += `&${this.$.find('.editor').serialize()}`;
}
//TODO: this might be unsave in case the parent of this story is not the
@@ -115,21 +119,21 @@ RB.Story = (function ($) {
// hoping it exists
if (this.isNew()) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
- url = RB.urlFor('create_story', {sprint_id: sprintId});
+ url = RB.urlFor('create_story', { sprint_id: sprintId });
} else {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
- url = RB.urlFor('update_story', {id: this.getID(), sprint_id: sprintId});
- data += "&_method=put";
+ url = RB.urlFor('update_story', { id: this.getID(), sprint_id: sprintId });
+ data += '&_method=put';
}
return {
- url: url,
- data: data
+ url,
+ data,
};
},
- beforeSaveDragResult: function () {
+ beforeSaveDragResult() {
// Do nothing
- }
+ },
});
}(jQuery));
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/task.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/task.ts
index 7e92d3c8b35..2c1c3112640 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/task.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/task.ts
@@ -35,38 +35,38 @@ RB.Task = (function ($) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.WorkPackage, {
- initialize: function (el: any) {
+ initialize(el:any) {
this.$ = $(el);
this.el = el;
// If node is based on #task_template, it doesn't have the story class yet
- this.$.addClass("task");
+ this.$.addClass('task');
// Associate this object with the element for later retrieval
this.$.data('this', this);
this.$.on('mouseup', '.editable', this.handleClick);
- this.defaultColor = $('#rb .task').css('background-color');
+ this.defaultColor = $('#rb .task').css('background-color');
},
beforeSave: function name() {
- if (this.el && $(this.el).hasClass('dragging')){
+ if (this.el && $(this.el).hasClass('dragging')) {
return;
}
- var c = this.$.find('select.assigned_to_id').children(':selected').attr('color') || this.defaultColor;
+ const c = this.$.find('select.assigned_to_id').children(':selected').attr('color') || this.defaultColor;
this.$.css('background-color', c);
this.$.colorcontrast();
},
- editorDisplayed: function (dialog: any) {
+ editorDisplayed(dialog:any) {
dialog.parents('.ui-dialog').css('background-color', this.$.css('background-color'));
dialog.parents('.ui-dialog').colorcontrast();
},
- getType: function () {
- return "Task";
+ getType() {
+ return 'Task';
},
- markIfClosed: function () {
+ markIfClosed() {
if (this.$.parent('td').first().hasClass('closed')) {
this.$.addClass('closed');
} else {
@@ -74,35 +74,37 @@ RB.Task = (function ($) {
}
},
- saveDirectives: function () {
- var prev, cellId, data, url;
+ saveDirectives() {
+ let prev;
+ let cellId;
+ let data;
+ let url;
prev = this.$.prev();
- cellId = this.$.parent('td').first().attr('id').split("_");
+ cellId = this.$.parent('td').first().attr('id').split('_');
- data = this.$.find('.editor').serialize() +
- "&parent_id=" + cellId[0] +
- "&status_id=" + cellId[1] +
- "&prev=" + (prev.length === 1 ? prev.data('this').getID() : '') +
- (this.isNew() ? "" : "&id=" + this.$.children('.id').text());
+ data = `${this.$.find('.editor').serialize()
+ }&parent_id=${cellId[0]
+ }&status_id=${cellId[1]
+ }&prev=${prev.length === 1 ? prev.data('this').getID() : ''
+ }${this.isNew() ? '' : `&id=${this.$.children('.id').text()}`}`;
if (this.isNew()) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
- url = RB.urlFor('create_task', {sprint_id: RB.constants.sprint_id});
- }
- else {
+ url = RB.urlFor('create_task', { sprint_id: RB.constants.sprint_id });
+ } else {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
- url = RB.urlFor('update_task', {id: this.getID(), sprint_id: RB.constants.sprint_id});
- data += "&_method=put";
+ url = RB.urlFor('update_task', { id: this.getID(), sprint_id: RB.constants.sprint_id });
+ data += '&_method=put';
}
return {
- url: url,
- data: data
+ url,
+ data,
};
},
- beforeSaveDragResult: function () {
+ beforeSaveDragResult() {
if (this.$.parent('td').first().hasClass('closed')) {
// This is only for the purpose of making the Remaining Hours reset
// instantaneously after dragging to a closed status. The server should
@@ -112,10 +114,10 @@ RB.Task = (function ($) {
}
},
- refreshed : function () {
- var remainingHours = this.$.children('.remaining_hours.editable');
+ refreshed() {
+ const remainingHours = this.$.children('.remaining_hours.editable');
remainingHours.toggleClass('empty', remainingHours.is(':empty'));
- }
+ },
});
}(jQuery));
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/taskboard.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/taskboard.ts
index c0fa55c1d24..49d5bb61397 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/taskboard.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/taskboard.ts
@@ -35,8 +35,8 @@ RB.Taskboard = (function ($) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.Model, {
- initialize: function (el: any) {
- var self = this; // So we can bind the event handlers to this object
+ initialize(el:any) {
+ const self = this; // So we can bind the event handlers to this object
this.$ = $(el);
this.el = el;
@@ -51,7 +51,7 @@ RB.Taskboard = (function ($) {
this.updateColWidths();
$('#col_width_input')
- .on('keyup', function (evt) {
+ .on('keyup', (evt) => {
if (evt.which === 13) {
self.updateColWidths();
}
@@ -66,32 +66,34 @@ RB.Taskboard = (function ($) {
this.initializeTaskboardMenus();
},
- initializeNewButtons : function () {
+ initializeNewButtons() {
this.$.find('#tasks .add_new.clickable').click(this.handleAddNewTaskClick);
this.$.find('#impediments .add_new.clickable').click(this.handleAddNewImpedimentClick);
},
- initializeSortables : function () {
+ initializeSortables() {
this.$.find('#impediments .list').sortable({
placeholder: 'placeholder',
- start: this.dragStart,
- stop: this.dragStop,
+ start: this.dragStart,
+ stop: this.dragStop,
update: this.dragComplete,
- cancel: '.prevent_edit'
+ cancel: '.prevent_edit',
}).sortable('option', 'connectWith', '#impediments .list');
$('#impediments .list').disableSelection();
- var list: any, augmentList: any, self = this;
+ let list:any;
+ let augmentList:any;
+ const self = this;
list = this.$.find('#tasks .list');
augmentList = function () {
$(list.splice(0, 50)).sortable({
placeholder: 'placeholder',
- start: self.dragStart,
- stop: self.dragStop,
+ start: self.dragStart,
+ stop: self.dragStop,
update: self.dragComplete,
- cancel: '.prevent_edit'
+ cancel: '.prevent_edit',
}).sortable('option', 'connectWith', '#tasks .list');
$('#tasks .list').disableSelection();
@@ -103,103 +105,105 @@ RB.Taskboard = (function ($) {
augmentList();
},
- initializeTasks : function () {
- this.$.find('.task').each(function(this: any, index: any) {
+ initializeTasks() {
+ this.$.find('.task').each(function (this:any, index:any) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Factory.initialize(RB.Task, this);
});
},
- initializeImpediments : function () {
- this.$.find('.impediment').each(function(this: any, index: any) {
+ initializeImpediments() {
+ this.$.find('.impediment').each(function (this:any, index:any) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Factory.initialize(RB.Impediment, this);
});
},
- initializeTaskboardMenus : function () {
- var toggleOpen = "open icon-pulldown-up icon-pulldown";
+ initializeTaskboardMenus() {
+ const toggleOpen = 'open icon-pulldown-up icon-pulldown';
- $(".backlog .backlog-menu > div.menu-trigger").on("click", function() {
+ $('.backlog .backlog-menu > div.menu-trigger').on('click', function () {
$(this).toggleClass(toggleOpen);
});
- $(".backlog .backlog-menu > ul.items li.item").on("click", function() {
- $(this).closest(".backlog-menu").find("div.menu-trigger").toggleClass(toggleOpen);
+ $('.backlog .backlog-menu > ul.items li.item').on('click', function () {
+ $(this).closest('.backlog-menu').find('div.menu-trigger').toggleClass(toggleOpen);
});
},
- dragComplete: function (e: any, ui: any) {
+ dragComplete(e:any, ui:any) {
// Handler is triggered for source and target. Thus the need to check.
- var isDropTarget = (ui.sender === null);
+ const isDropTarget = (ui.sender === null);
if (isDropTarget) {
ui.item.data('this').saveDragResult();
}
},
- dragStart: function (e: any, ui: any) {
- ui.item.addClass("dragging");
+ dragStart(e:any, ui:any) {
+ ui.item.addClass('dragging');
},
- dragStop: function (e: any, ui: any) {
- ui.item.removeClass("dragging");
+ dragStop(e:any, ui:any) {
+ ui.item.removeClass('dragging');
},
- handleAddNewImpedimentClick: function (e: any) {
- var row = $(this).parents("tr").first();
+ handleAddNewImpedimentClick(e:any) {
+ const row = $(this).parents('tr').first();
$('#taskboard').data('this').newImpediment(row);
},
- handleAddNewTaskClick: function (e: any) {
- var row = $(this).parents("tr").first();
+ handleAddNewTaskClick(e:any) {
+ const row = $(this).parents('tr').first();
$('#taskboard').data('this').newTask(row);
},
- loadColWidthPreference: function () {
+ loadColWidthPreference() {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
- var w = RB.UserPreferences.get('taskboardColWidth');
+ let w = RB.UserPreferences.get('taskboardColWidth');
if (w === null || w === undefined) {
w = this.defaultColWidth;
// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.UserPreferences.set('taskboardColWidth', w);
}
- $("#col_width input").val(w);
+ $('#col_width input').val(w);
},
- newImpediment: function (row: any) {
- var impediment, o;
+ newImpediment(row:any) {
+ let impediment;
+ let o;
impediment = $('#impediment_template').children().first().clone();
- row.find(".list").first().prepend(impediment);
+ row.find('.list').first().prepend(impediment);
// @ts-expect-error TS(2304): Cannot find name 'RB'.
o = RB.Factory.initialize(RB.Impediment, impediment);
o.edit();
},
- newTask: function (row: any) {
- var task, o;
+ newTask(row:any) {
+ let task;
+ let o;
task = $('#task_template').children().first().clone();
- row.find(".list").first().prepend(task);
+ row.find('.list').first().prepend(task);
// @ts-expect-error TS(2304): Cannot find name 'RB'.
o = RB.Factory.initialize(RB.Task, task);
o.edit();
},
- updateColWidths: function () {
+ updateColWidths() {
// @ts-expect-error TS(2345): Argument of type 'string | number | string[] | und... Remove this comment to see the full error message
- var w = parseInt($("#col_width_input").val(), 10);
+ let w = parseInt($('#col_width_input').val(), 10);
if (isNaN(w) || w <= 0) {
w = this.defaultColWidth;
}
- $("#col_width_input").val(w);
+ $('#col_width_input').val(w);
// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.UserPreferences.set('taskboardColWidth', w);
- $(".swimlane").width(this.colWidthUnit * w).css('min-width', this.colWidthUnit * w);
- }
+ $('.swimlane').width(this.colWidthUnit * w).css('min-width', this.colWidthUnit * w);
+ },
});
}(jQuery));
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/work_package.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/work_package.ts
index eddd9f4c457..f10d3b67a65 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/work_package.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/work_package.ts
@@ -34,24 +34,24 @@ RB.WorkPackage = (function ($) {
// @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.Model, {
- initialize: function (el: any) {
+ initialize(el:any) {
this.$ = $(el);
this.el = el;
},
- beforeSaveDragResult: function () {
+ beforeSaveDragResult() {
// Do nothing
},
- getType: function () {
- return "WorkPackage";
+ getType() {
+ return 'WorkPackage';
},
- saveDragResult: function () {
+ saveDragResult() {
this.beforeSaveDragResult();
if (!this.$.hasClass('editing')) {
this.saveEdits();
}
- }
+ },
});
}(jQuery));