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

Fix create story spec

Benjamin Bädorfce6b2f50c121
diff --git a/frontend/src/app/core/augmenting/dynamic-scripts/backlogs/model.js b/frontend/src/app/core/augmenting/dynamic-scripts/backlogs/model.js
index e8ec4f1faee..e998daf0002 100644
--- a/frontend/src/app/core/augmenting/dynamic-scripts/backlogs/model.js
+++ b/frontend/src/app/core/augmenting/dynamic-scripts/backlogs/model.js
@@ -153,15 +153,15 @@ RB.Model = (function ($) {
if (!editor.hasClass('permanent')) {
this.$.find('.editable').each(function (index) {
- let field, fieldId, fieldType, fieldLabel, fieldName, fieldOrder, input, newInput,
- typeId, statusId;
-
- field = $(this);
- fieldId = field.attr('field_id');
- fieldName = field.attr('fieldname');
- fieldLabel = field.attr('fieldlabel');
- fieldOrder = parseInt(field.attr('fieldorder'), 10);
- fieldType = field.attr('fieldtype') || 'input';
+ const field = $(this);
+ const fieldId = field.attr('field_id');
+ const fieldName = field.attr('fieldname');
+ const fieldOrder = parseInt(field.attr('fieldorder'), 10);
+ const fieldType = field.attr('fieldtype') || 'input';
+ let fieldLabel = field.attr('fieldlabel');
+ let typeId;
+ let statusId;
+ let input;
if (!fieldLabel) {
fieldLabel = fieldName.replace(/_/ig, " ").replace(/ id$/ig, "");
@@ -404,11 +404,10 @@ RB.Model = (function ($) {
// Copy the values from the fields to the proper html elements
editors.each(function (index) {
- var editor, fieldName;
-
- editor = $(this).find('input,select').addBack('input,select');
- fieldName = editor.attr('name');
- if (editor.attr('type').match(/select/)) {
+ const editor = $(this).find('input,select').addBack('input,select');
+ const fieldName = editor.attr('name');
+ const type = editor.attr('type');
+ if (type && 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
diff --git a/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts b/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
index 5f8542e6855..b15d72bcc8f 100644
--- a/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
+++ b/frontend/src/app/spot/components/drop-modal/drop-modal.component.ts
@@ -136,40 +136,38 @@ export class SpotDropModalComponent implements OnDestroy {
* template in the same tick.
* To make it happy, we update afterwards
*/
- setTimeout(() => {
- this.teleportationService.activate(this.body)
-
- this.teleportationService
- .hasRenderedFiltered$
- .pipe(
- filter((hasRendered) => hasRendered),
- take(1),
- )
- .subscribe(() => {
- /*
- * We have to set these listeners next tick, because they're so far up the tree.
- * If the open value was set because of a click listener in the trigger slot,
- * that event would reach the event listener added here and close the modal right away.
- */
- setTimeout(() => {
- document.body.addEventListener('click', this.onGlobalClick);
- document.body.addEventListener('keydown', this.onEscape);
- document.body.addEventListener('scroll', this.onScroll, true);
- window.addEventListener('resize', this.onResize);
- window.addEventListener('orientationchange', this.onResize);
-
- this.recalculateAlignment();
-
- const focusCatcherContainer = document.querySelectorAll("[data-modal-focus-catcher-container='true']")[0];
- if (focusCatcherContainer) {
- (findAllFocusableElementsWithin(focusCatcherContainer as HTMLElement)[0] as HTMLElement)?.focus();
- } else {
- // Index 1 because the element at index 0 is the trigger button to open the modal
- (findAllFocusableElementsWithin(document.querySelector('.spot-drop-modal-portal')!)[1] as HTMLElement)?.focus();
- }
- });
+ this.teleportationService.activate(this.body)
+
+ this.teleportationService
+ .hasRenderedFiltered$
+ .pipe(
+ filter((hasRendered) => hasRendered),
+ take(1),
+ )
+ .subscribe(() => {
+ /*
+ * We have to set these listeners next tick, because they're so far up the tree.
+ * If the open value was set because of a click listener in the trigger slot,
+ * that event would reach the event listener added here and close the modal right away.
+ */
+ setTimeout(() => {
+ document.body.addEventListener('click', this.onGlobalClick);
+ document.body.addEventListener('keydown', this.onEscape);
+ document.body.addEventListener('scroll', this.onScroll, true);
+ window.addEventListener('resize', this.onResize);
+ window.addEventListener('orientationchange', this.onResize);
+
+ this.recalculateAlignment();
+
+ const focusCatcherContainer = document.querySelectorAll("[data-modal-focus-catcher-container='true']")[0];
+ if (focusCatcherContainer) {
+ (findAllFocusableElementsWithin(focusCatcherContainer as HTMLElement)[0] as HTMLElement)?.focus();
+ } else {
+ // Index 1 because the element at index 0 is the trigger button to open the modal
+ (findAllFocusableElementsWithin(document.querySelector('.spot-drop-modal-portal')!)[1] as HTMLElement)?.focus();
+ }
});
- });
+ });
}
close():void {