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

[ts-migrate][src] Automated conversion to TS

Alexander Brandon Colescfa5b7e53365
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/backlog.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/backlog.ts
index 116de609036..5e4fa67884d 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/backlog.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/backlog.ts
@@ -38,10 +38,12 @@
visualize the sprint.
******************************************/
+// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Backlog = (function ($) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create({
- initialize: function (el) {
+ initialize: function (el: any) {
this.$ = $(el);
this.el = el;
@@ -60,7 +62,7 @@ RB.Backlog = (function ($) {
containment: $('#backlogs_container'),
cancel: 'input, textarea, button, select, option, .prevent_drag',
scroll: true,
- helper: function(event, ui){
+ helper: function(event: any, ui: any){
var $clone = $(ui).clone();
$clone .css('position','absolute');
return $clone.get(0);
@@ -71,14 +73,17 @@ RB.Backlog = (function ($) {
this.$.find('.add_new_story').click(this.handleNewStoryClick);
if (this.isSprintBacklog()) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Factory.initialize(RB.Sprint, this.getSprint());
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
this.burndown = RB.Factory.initialize(RB.Burndown, this.$.find('.show_burndown_chart'));
this.burndown.setSprintId(this.getSprint().data('this').getID());
}
// Initialize each item in the backlog
- this.getStories().each(function (index) {
+ 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);
});
@@ -87,11 +92,11 @@ RB.Backlog = (function ($) {
}
},
- dragChanged: function (e, ui) {
+ dragChanged: function (e: any, ui: any) {
$(this).parents('.backlog').data('this').refresh();
},
- dragComplete: function (e, ui) {
+ dragComplete: function (e: any, ui: any) {
var isDropTarget = (ui.sender === null || ui.sender === undefined);
// jQuery triggers dragComplete of source and target.
@@ -102,11 +107,11 @@ RB.Backlog = (function ($) {
}
},
- dragStart: function (e, ui) {
+ dragStart: function (e: any, ui: any) {
ui.item.addClass("dragging");
},
- dragStop: function (e, ui) {
+ dragStop: function (e: any, ui: any) {
ui.item.removeClass("dragging");
},
@@ -122,7 +127,7 @@ RB.Backlog = (function ($) {
return this.$.children(".stories").first();
},
- handleNewStoryClick: function (e) {
+ handleNewStoryClick: function (e: any) {
var toggler = $(this).parents('.header').find('.toggler');
if (toggler.hasClass('closed')){
toggler.click();
@@ -142,6 +147,7 @@ RB.Backlog = (function ($) {
story = $('#story_template').children().first().clone();
this.getList().prepend(story);
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
o = RB.Factory.initialize(RB.Story, story[0]);
o.edit();
@@ -154,14 +160,14 @@ RB.Backlog = (function ($) {
},
recalcVelocity: function () {
- var total;
+ var total: any;
if (!this.isSprintBacklog()) {
return true;
}
total = 0;
- this.getStories().each(function (index) {
+ this.getStories().each(function(this: any, index: any) {
total += $(this).data('this').getPoints();
});
this.$.children('.header').children('.velocity').text(total);
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/burndown.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/burndown.ts
index f92d8310558..c333dcbf18c 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/burndown.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/burndown.ts
@@ -26,10 +26,12 @@
// See COPYRIGHT and LICENSE files for more details.
//++
+// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Burndown = (function ($) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create({
- initialize: function (el) {
+ initialize: function (el: any) {
this.$ = $(el);
this.el = el;
@@ -40,7 +42,7 @@ RB.Burndown = (function ($) {
this.$.click(this.show);
},
- setSprintId : function (sprintId) {
+ setSprintId : function (sprintId: any) {
this.sprintId = sprintId;
},
@@ -48,14 +50,16 @@ RB.Burndown = (function ($) {
return this.sprintId;
},
- show: function (e) {
+ show: function (e: any) {
e.preventDefault();
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>");
+ // @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});
window.open(url);
}
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/common.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/common.ts
index 830723e2ddd..c9ccfeaa1de 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/common.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/common.ts
@@ -26,13 +26,15 @@
// See COPYRIGHT and LICENSE files for more details.
//++
+// @ts-expect-error TS(2339): Property 'RB' does not exist on type 'Window & typ... Remove this comment to see the full error message
if (window.RB === null || window.RB === undefined) {
+ // @ts-expect-error TS(2339): Property 'RB' does not exist on type 'Window & typ... Remove this comment to see the full error message
window.RB = {};
}
(function ($) {
- var object, Factory, Dialog, UserPreferences,
+ var object: any, Factory, Dialog, UserPreferences,
ajax;
object = {
@@ -45,6 +47,7 @@ if (window.RB === null || window.RB === undefined) {
}
F.prototype = arguments[0];
+ // @ts-expect-error TS(7009): 'new' expression, whose target lacks a construct s... Remove this comment to see the full error message
obj = new F();
// Add all the other arguments as mixins that
@@ -67,7 +70,7 @@ if (window.RB === null || window.RB === undefined) {
// Object factory for chiliproject_backlogs
Factory = object.create({
- initialize: function (objType, el) {
+ initialize: function (objType: any, el: any) {
var obj;
obj = object.create(objType);
@@ -79,7 +82,7 @@ if (window.RB === null || window.RB === undefined) {
// Utilities
Dialog = object.create({
- msg: function (msg) {
+ msg: function (msg: any) {
var dialog, baseClasses;
baseClasses = 'ui-button ui-widget ui-state-default ui-corner-all';
@@ -110,8 +113,8 @@ if (window.RB === null || window.RB === undefined) {
});
ajax = (function () {
- var ajaxQueue, ajaxOngoing,
- processAjaxQueue;
+ var ajaxQueue: any, ajaxOngoing: any,
+ processAjaxQueue: any;
ajaxQueue = [];
ajaxOngoing = false;
@@ -132,7 +135,7 @@ if (window.RB === null || window.RB === undefined) {
processAjaxQueue();
});
- return function (options) {
+ return function (options: any) {
ajaxQueue.push(options);
if (!ajaxOngoing) {
processAjaxQueue();
@@ -143,19 +146,24 @@ 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) {
+ get: function (key: any) {
return $.cookie(key);
},
- set: function (key, value) {
+ set: function (key: any, value: any) {
$.cookie(key, value, { expires: 365 * 10 });
}
});
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Object = object;
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Factory = Factory;
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Dialog = Dialog;
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
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 0e6426d92a7..fd52095f843 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/editable_inplace.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/editable_inplace.ts
@@ -26,10 +26,12 @@
// See COPYRIGHT and LICENSE files for more details.
//++
+// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.EditableInplace = (function ($) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.Model, {
- displayEditor: function (editor) {
+ displayEditor: function (editor: any) {
this.$.addClass("editing");
editor.find(".editor").bind('keydown', this.handleKeydown);
},
@@ -47,7 +49,7 @@ RB.EditableInplace = (function ($) {
},
// For detecting Enter and ESC
- handleKeydown: function (e) {
+ handleKeydown: function (e: any) {
var j, that;
j = $(this).parents('.model').first();
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/impediment.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/impediment.ts
index 7458eb5f60e..3419f3fbb5f 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/impediment.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/impediment.ts
@@ -30,10 +30,12 @@
IMPEDIMENT
***************************************/
+// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Impediment = (function ($) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.Task, {
- initialize: function (el) {
+ initialize: function (el: any) {
var j; // This ensures that we use a local 'j' variable, not a global one.
this.$ = j = $(el);
@@ -57,15 +59,18 @@ RB.Impediment = (function ($) {
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());
if (this.isNew()) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
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";
}
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/master_backlog.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/master_backlog.ts
index c4ffbc0007d..9c1bfcfb29c 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/master_backlog.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/master_backlog.ts
@@ -32,6 +32,7 @@ jQuery(function ($) {
// Initialize each backlog
$('.backlog').each(function (index) {
// 'this' refers to an element with class="backlog"
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Factory.initialize(RB.Backlog, this);
});
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/model.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/model.ts
index b6c0280e7f6..277363fe8c8 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/model.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/model.ts
@@ -32,22 +32,25 @@
story, task, and impediment
***************************************/
+// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Model = (function ($) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create({
- initialize: function (el) {
+ initialize: function (el: any) {
this.$ = $(el);
this.el = el;
},
- afterCreate: function (data, textStatus, xhr) {
+ afterCreate: function (data: any, textStatus: any, xhr: any) {
// Do nothing. Child objects may optionally override this
},
- afterSave: function (data, textStatus, xhr) {
+ afterSave: function (data: any, textStatus: any, xhr: any) {
var isNew, result;
isNew = this.isNew();
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
result = RB.Factory.initialize(RB.Model, data);
this.unmarkSaving();
@@ -62,7 +65,7 @@ RB.Model = (function ($) {
}
},
- afterUpdate: function (data, textStatus, xhr) {
+ afterUpdate: function (data: any, textStatus: any, xhr: any) {
// Do nothing. Child objects may optionally override this
},
@@ -95,7 +98,7 @@ RB.Model = (function ($) {
this.saveEdits();
},
- displayEditor: function (editor) {
+ displayEditor: function (editor: any) {
var self = this,
baseClasses;
@@ -120,7 +123,7 @@ RB.Model = (function ($) {
}
},
],
- close: function (e, ui) {
+ close: function (e: any, ui: any) {
if (e.type === 'click' || (e.type === 'keydown' && e.key === 'Escape')) {
self.cancelEdit();
}
@@ -144,6 +147,7 @@ RB.Model = (function ($) {
$('.stories .editors .editor').each(function (index) {
var 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);
if (maxTabIndex < value) {
@@ -152,17 +156,18 @@ RB.Model = (function ($) {
});
if (!editor.hasClass('permanent')) {
- this.$.find('.editable').each(function (index) {
+ this.$.find('.editable').each(function(this: any, index: any) {
const field = $(this);
const fieldId = field.attr('field_id');
const fieldName = field.attr('fieldname');
const fieldLabel = field.attr('fieldlabel');
+ // @ts-expect-error TS(2345): Argument of type 'string | undefined' is not assig... Remove this comment to see the full error message
const fieldOrder = parseInt(field.attr('fieldorder'), 10);
const fieldEditable = field.attr('fieldeditable') || 'true';
const fieldType = field.attr('fieldtype') || 'input';
let typeId;
let statusId;
- let input;
+ let input: any;
if (fieldType === 'select') {
// Special handling for status_id => they are dependent of type_id
@@ -178,10 +183,12 @@ RB.Model = (function ($) {
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
typeId = $(this).val();
statusId = $.trim(self.$.find('.status_id .v').html());
let newInput = self.findFactory(typeId, statusId, 'status_id');
newInput = self.prepareInputFromFactory(newInput, fieldId, 'status_id', fieldOrder, maxTabIndex);
+ // @ts-expect-error TS(2683): 'this' implicitly has type 'any' because it does n... Remove this comment to see the full error message
newInput = self.replaceStatusForNewType(input, newInput, $(this).parent().find('.status_id').val(), editor);
});
} else {
@@ -199,7 +206,7 @@ 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 () {
+ input.focus(function(this: any) {
self.$.data('focus', $(this).attr('name'));
});
@@ -209,6 +216,7 @@ RB.Model = (function ($) {
$("<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);
input.appendTo(editor);
});
@@ -219,7 +227,7 @@ RB.Model = (function ($) {
return editor;
},
- findFactory: function (typeId, statusId, fieldName){
+ findFactory: function (typeId: any, statusId: any, fieldName: any){
// Find a factory
let newInput = $('#' + fieldName + '_options_' + typeId + '_' + statusId);
if (newInput.length === 0) {
@@ -231,7 +239,7 @@ RB.Model = (function ($) {
return newInput;
},
- prepareInputFromFactory: function (input, fieldId, fieldName, fieldOrder, maxTabIndex, fieldEditable) {
+ prepareInputFromFactory: function (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);
@@ -245,18 +253,20 @@ RB.Model = (function ($) {
return input;
},
- replaceStatusForNewType: function (input,newInput, statusId, editor) {
+ replaceStatusForNewType: function (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('',''));
newInput.val('');
}
- newInput.focus(function () {
+ 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 () {
+ // @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', '');
});
// Find the old status dropdown and replace it with the new one
@@ -268,7 +278,7 @@ RB.Model = (function ($) {
return "Edit " + this.getType();
},
- editorDisplayed: function (editor) {
+ editorDisplayed: function (editor: any) {
// Do nothing. Child objects may override this.
},
@@ -276,8 +286,9 @@ RB.Model = (function ($) {
this.$.removeClass('editing');
},
- error: function (xhr, textStatus, error) {
+ error: function (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);
},
@@ -303,7 +314,7 @@ RB.Model = (function ($) {
throw new Error("Child objects must override getType()");
},
- handleClick: function (e) {
+ handleClick: function (e: any) {
const field = $(this);
const model = field.parents('.model').first().data('this');
const j = model.$;
@@ -321,7 +332,7 @@ RB.Model = (function ($) {
}
},
- handleSelect: function (e) {
+ handleSelect: function (e: any) {
var j = $(this),
self = j.data('this');
@@ -364,16 +375,16 @@ RB.Model = (function ($) {
this.$.removeClass('closed');
},
- processError: function (x, t, e) {
+ processError: function (x: any, t: any, e: any) {
// Override as needed
},
- refresh: function (obj) {
+ refresh: function (obj: any) {
this.$.html(obj.$.html());
if (obj.$.length > 1) {
// execute script tags, that were attached to the sources
- obj.$.filter('script').each(function () {
+ obj.$.filter('script').each(function(this: any) {
try {
$.globalEval($(this).html());
}
@@ -406,7 +417,7 @@ RB.Model = (function ($) {
saveDir;
// Copy the values from the fields to the proper html elements
- editors.each(function (index) {
+ 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');
@@ -437,14 +448,15 @@ RB.Model = (function ($) {
self.unmarkError();
self.markSaving();
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.ajax({
type: "POST",
url: saveDir.url,
data: saveDir.data,
- success : function (d, t, x) {
+ success : function (d: any, t: any, x: any) {
self.afterSave(d, t, x);
},
- error : function (x, t, e) {
+ error : function (x: any, t: any, e: any) {
self.error(x, t, e);
}
});
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/show_main.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/show_main.ts
index 550ec85ab99..ba14dbcfb73 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/show_main.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/show_main.ts
@@ -28,10 +28,11 @@
// Initialize everything after DOM is loaded
jQuery(function ($) {
- var defaultDialogColor; // this var is used as cache for some computation in
+ var defaultDialogColor: any; // this var is used as cache for some computation in
// the inner function. -> Do not move to where it
// actually belongs!
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Factory.initialize(RB.Taskboard, $('#taskboard'));
$('#assigned_to_id_options').change(function () {
@@ -41,6 +42,7 @@ jQuery(function ($) {
defaultDialogColor = $('#work_package_').css('background-color');
}
$(this).parents('.ui-dialog').css('background-color', selected.attr('color') || defaultDialogColor);
+ // @ts-expect-error TS(2339): Property 'colorcontrast' does not exist on type 'J... Remove this comment to see the full error message
$(this).parents('.ui-dialog').colorcontrast();
});
});
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/sprint.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/sprint.ts
index 665a7dc1d8c..723e6b359be 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/sprint.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/sprint.ts
@@ -30,10 +30,12 @@
SPRINT
***************************************/
+// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Sprint = (function ($) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.Model, RB.EditableInplace, {
- initialize: function (el) {
+ initialize: function (el: any) {
this.$ = $(el);
this.el = el;
@@ -62,6 +64,7 @@ RB.Sprint = (function ($) {
const wrapper = this.$;
const editor = wrapper.find('.editor');
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 {
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/story.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/story.ts
index a141bd5d4ea..33043fa3689 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/story.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/story.ts
@@ -29,9 +29,11 @@
/**************************************
STORY
***************************************/
+// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Story = (function ($) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.WorkPackage, RB.EditableInplace, {
- initialize: function (el) {
+ initialize: function (el: any) {
this.$ = $(el);
this.el = el;
@@ -47,11 +49,11 @@ RB.Story = (function ($) {
this.refreshStory();
},
- afterCreate: function (data, textStatus, xhr) {
+ afterCreate: function (data: any, textStatus: any, xhr: any) {
this.refreshStory();
},
- afterUpdate : function (data, textStatus, xhr) {
+ afterUpdate : function (data: any, textStatus: any, xhr: any) {
this.refreshStory();
},
@@ -64,7 +66,7 @@ RB.Story = (function ($) {
return "Story #" + this.getID();
},
- editorDisplayed: function (editor) { },
+ editorDisplayed: function (editor: any) { },
getPoints: function () {
var points = parseInt(this.$.find('.story_points').first().text(), 10);
@@ -112,8 +114,10 @@ RB.Story = (function ($) {
// valid url - one option might be to take RB.constants.sprint_id
// hoping it exists
if (this.isNew()) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
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";
}
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/task.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/task.ts
index 5a823fb21f1..7e92d3c8b35 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/task.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/task.ts
@@ -30,10 +30,12 @@
TASK
***************************************/
+// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Task = (function ($) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.WorkPackage, {
- initialize: function (el) {
+ initialize: function (el: any) {
this.$ = $(el);
this.el = el;
@@ -55,7 +57,7 @@ RB.Task = (function ($) {
this.$.colorcontrast();
},
- editorDisplayed: function (dialog) {
+ editorDisplayed: function (dialog: any) {
dialog.parents('.ui-dialog').css('background-color', this.$.css('background-color'));
dialog.parents('.ui-dialog').colorcontrast();
},
@@ -85,9 +87,11 @@ RB.Task = (function ($) {
(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 {
+ // @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";
}
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/taskboard.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/taskboard.ts
index 1445ffc4635..c0fa55c1d24 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/taskboard.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/taskboard.ts
@@ -30,10 +30,12 @@
TASKBOARD
***************************************/
+// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Taskboard = (function ($) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.Model, {
- initialize: function (el) {
+ initialize: function (el: any) {
var self = this; // So we can bind the event handlers to this object
this.$ = $(el);
@@ -79,7 +81,7 @@ RB.Taskboard = (function ($) {
}).sortable('option', 'connectWith', '#impediments .list');
$('#impediments .list').disableSelection();
- var list, augmentList, self = this;
+ var list: any, augmentList: any, self = this;
list = this.$.find('#tasks .list');
@@ -102,13 +104,15 @@ RB.Taskboard = (function ($) {
},
initializeTasks : function () {
- this.$.find('.task').each(function (index) {
+ 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 (index) {
+ this.$.find('.impediment').each(function(this: any, index: any) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.Factory.initialize(RB.Impediment, this);
});
},
@@ -125,7 +129,7 @@ RB.Taskboard = (function ($) {
});
},
- dragComplete: function (e, ui) {
+ dragComplete: function (e: any, ui: any) {
// Handler is triggered for source and target. Thus the need to check.
var isDropTarget = (ui.sender === null);
@@ -134,60 +138,66 @@ RB.Taskboard = (function ($) {
}
},
- dragStart: function (e, ui) {
+ dragStart: function (e: any, ui: any) {
ui.item.addClass("dragging");
},
- dragStop: function (e, ui) {
+ dragStop: function (e: any, ui: any) {
ui.item.removeClass("dragging");
},
- handleAddNewImpedimentClick: function (e) {
+ handleAddNewImpedimentClick: function (e: any) {
var row = $(this).parents("tr").first();
$('#taskboard').data('this').newImpediment(row);
},
- handleAddNewTaskClick: function (e) {
+ handleAddNewTaskClick: function (e: any) {
var row = $(this).parents("tr").first();
$('#taskboard').data('this').newTask(row);
},
loadColWidthPreference: function () {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
var 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);
},
- newImpediment: function (row) {
+ newImpediment: function (row: any) {
var impediment, o;
impediment = $('#impediment_template').children().first().clone();
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) {
+ newTask: function (row: any) {
var task, o;
task = $('#task_template').children().first().clone();
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 () {
+ // @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);
if (isNaN(w) || w <= 0) {
w = this.defaultColWidth;
}
$("#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);
}
diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/work_package.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/work_package.ts
index 13603198df4..eddd9f4c457 100644
--- a/frontend/src/stimulus/controllers/dynamic/backlogs/work_package.ts
+++ b/frontend/src/stimulus/controllers/dynamic/backlogs/work_package.ts
@@ -29,10 +29,12 @@
/**************************************
WORK PACKAGE
***************************************/
+// @ts-expect-error TS(2304): Cannot find name 'RB'.
RB.WorkPackage = (function ($) {
+ // @ts-expect-error TS(2304): Cannot find name 'RB'.
return RB.Object.create(RB.Model, {
- initialize: function (el) {
+ initialize: function (el: any) {
this.$ = $(el);
this.el = el;
},