diff --git a/app/components/versions/row_component.rb b/app/components/versions/row_component.rb index 1a6187596f3a..73dd9cb06dbc 100644 --- a/app/components/versions/row_component.rb +++ b/app/components/versions/row_component.rb @@ -85,7 +85,7 @@ def wiki_page end def button_links - [edit_link, delete_link, backlogs_edit_link].compact + [edit_link, delete_link].compact end private diff --git a/app/forms/versions/form.rb b/app/forms/versions/form.rb index 35f8b6b0533d..7412bdf722dc 100644 --- a/app/forms/versions/form.rb +++ b/app/forms/versions/form.rb @@ -110,29 +110,6 @@ class Form < ApplicationForm end end - if backlogs_enabled? - setting = version_setting_for_project - - f.select_list( - name: "version[version_settings_attributes][][display]", - scope_name_to_model: false, - label: I18n.t(:label_column_in_backlog), - input_width: :small - ) do |list| - position_display_options.each do |label, value| - list.option(label:, value:, selected: setting.display == value) - end - end - - if setting.persisted? - f.hidden( - name: "version[version_settings_attributes][][id]", - value: setting.id, - scope_name_to_model: false - ) - end - end - f.hidden( name: "project_id", value: project.id, @@ -177,35 +154,5 @@ def custom_fields def wiki_pages_disabled? contract.assignable_wiki_pages.none? end - - def backlogs_enabled? - resolved_project.backlogs_enabled? && !OpenProject::FeatureDecisions.scrum_projects_active? - end - - def resolved_project - @project || version.project - end - - def version_setting_for_project - setting = version.version_settings.detect { |vs| vs.project_id == resolved_project.id || vs.project_id.nil? } - setting || version.version_settings.new(display: VersionSetting::DISPLAY_LEFT, project: resolved_project) - end - - def position_display_options - [VersionSetting::DISPLAY_NONE, - VersionSetting::DISPLAY_LEFT, - VersionSetting::DISPLAY_RIGHT].map { |s| [humanize_display_option(s), s] } - end - - def humanize_display_option(option) - case option - when VersionSetting::DISPLAY_NONE - I18n.t("version_settings_display_option_none") - when VersionSetting::DISPLAY_LEFT - I18n.t("version_settings_display_option_left") - when VersionSetting::DISPLAY_RIGHT - I18n.t("version_settings_display_option_right") - end - end end end diff --git a/app/models/permitted_params.rb b/app/models/permitted_params.rb index 3470efc1006a..d0a44db3c3a7 100644 --- a/app/models/permitted_params.rb +++ b/app/models/permitted_params.rb @@ -359,9 +359,6 @@ def category end def version - # `version_settings_attributes` is from a plugin. Unfortunately as it stands - # now it is less work to do it this way than have the plugin override this - # method. We hopefully will change this in the future. permitted_params = params.fetch(:version, {}).permit(:name, :description, :effective_date, @@ -369,8 +366,7 @@ def version :start_date, :wiki_page_title, :status, - :sharing, - version_settings_attributes: %i(id display project_id)) + :sharing) permitted_params.merge(custom_field_values(:version, required: false)) end diff --git a/config/initializers/feature_decisions.rb b/config/initializers/feature_decisions.rb index e8101395c4aa..022d5863785d 100644 --- a/config/initializers/feature_decisions.rb +++ b/config/initializers/feature_decisions.rb @@ -61,11 +61,6 @@ description: "Enables Jira Migration Tool.", force_active: false -OpenProject::FeatureDecisions.add :scrum_projects, - description: "Enables an overhauled version of the backlogs module to " \ - "support Scrum projects with a new sprint planning experience. ", - force_active: true - OpenProject::FeatureDecisions.add :user_working_times, description: "Enables tracking of user working hours and non-working days." diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml index c32e868091d7..143c8a39ff79 100644 --- a/config/locales/js-en.yml +++ b/config/locales/js-en.yml @@ -556,7 +556,7 @@ en: sprints: "On the right you have the product backlog and the bug backlog, on the left you have the respective sprints. Here you can create epics, user stories, and bugs, prioritize via drag & drop and add them to a sprint." task_board_arrow: "To see your task board, open the sprint drop-down..." task_board_select: "...and select the task board entry." - task_board: "The task board visualizes the progress for this sprint. Click on the plus (+) icon next to a user story to add new tasks or impediments.
The status can be updated by drag and drop." + task_board: "The sprint board shows the board linked to this sprint, so you can follow the sprint's progress there." boards: overview: "Select boards to shift the view and manage your project using the agile boards view." lists_kanban: "Here you can create multiple lists (columns) within your board. This feature allows you to create a Kanban board, for example." diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 6df5080db5da..e479945a7180 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -67,7 +67,6 @@ "@stimulus-components/auto-submit": "^6.0.0", "@stimulus-components/reveal": "^5.0.0", "@tiptap/extensions": "^3.20.0", - "@types/jquery.cookie": "^1.4.36", "@uirouter/angular": "^17.0.0", "@uirouter/core": "^6.1.0", "@uirouter/rx": "^1.0.0", @@ -93,7 +92,6 @@ "idiomorph": "^0.7.4", "jquery": "^3.7.1", "jquery.caret": "^0.3.1", - "jquery.cookie": "^1.4.1", "json5": "^2.2.2", "lit-html": "^3.3.2", "lodash": "^4.17.23", @@ -9387,18 +9385,11 @@ "version": "3.5.33", "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.33.tgz", "integrity": "sha512-SeyVJXlCZpEki5F0ghuYe+L+PprQta6nRZqhONt9F13dWBtR/ftoaIbdRQ7cis7womE+X2LKhsDdDtkkDhJS6g==", + "dev": true, "dependencies": { "@types/sizzle": "*" } }, - "node_modules/@types/jquery.cookie": { - "version": "1.4.36", - "resolved": "https://registry.npmjs.org/@types/jquery.cookie/-/jquery.cookie-1.4.36.tgz", - "integrity": "sha512-qtTnH4jHqFWyYX4deNBklWoaK5myKm0WtKf7LbGQB7DUKt6tdAVWfYQ4Kl8Hw/7eNth864Jjts5rBsHjNveR4Q==", - "dependencies": { - "@types/jquery": "*" - } - }, "node_modules/@types/jqueryui": { "version": "1.12.24", "resolved": "https://registry.npmjs.org/@types/jqueryui/-/jqueryui-1.12.24.tgz", @@ -9584,7 +9575,8 @@ "node_modules/@types/sizzle": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz", - "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==" + "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==", + "dev": true }, "node_modules/@types/sockjs": { "version": "0.3.36", @@ -17085,12 +17077,6 @@ "resolved": "https://registry.npmjs.org/jquery.caret/-/jquery.caret-0.3.1.tgz", "integrity": "sha512-nS2mjMZzP4e4tIOgeTLSs+jFhUsUVZUPgkUMpi4DlJq9SgKEg6w2jf7q8joMJp6v+voJHXrH8rzAnbyxWHwAeA==" }, - "node_modules/jquery.cookie": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jquery.cookie/-/jquery.cookie-1.4.1.tgz", - "integrity": "sha512-c/hZOOL+8VSw/FkTVH637gS1/6YzMSCROpTZ2qBYwJ7s7sHajU7uBkSSiE5+GXWwrfCCyO+jsYjUQ7Hs2rIxAA==", - "license": "MIT" - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -31542,18 +31528,11 @@ "version": "3.5.33", "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.33.tgz", "integrity": "sha512-SeyVJXlCZpEki5F0ghuYe+L+PprQta6nRZqhONt9F13dWBtR/ftoaIbdRQ7cis7womE+X2LKhsDdDtkkDhJS6g==", + "dev": true, "requires": { "@types/sizzle": "*" } }, - "@types/jquery.cookie": { - "version": "1.4.36", - "resolved": "https://registry.npmjs.org/@types/jquery.cookie/-/jquery.cookie-1.4.36.tgz", - "integrity": "sha512-qtTnH4jHqFWyYX4deNBklWoaK5myKm0WtKf7LbGQB7DUKt6tdAVWfYQ4Kl8Hw/7eNth864Jjts5rBsHjNveR4Q==", - "requires": { - "@types/jquery": "*" - } - }, "@types/jqueryui": { "version": "1.12.24", "resolved": "https://registry.npmjs.org/@types/jqueryui/-/jqueryui-1.12.24.tgz", @@ -31733,7 +31712,8 @@ "@types/sizzle": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz", - "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==" + "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==", + "dev": true }, "@types/sockjs": { "version": "0.3.36", @@ -36889,11 +36869,6 @@ "resolved": "https://registry.npmjs.org/jquery.caret/-/jquery.caret-0.3.1.tgz", "integrity": "sha512-nS2mjMZzP4e4tIOgeTLSs+jFhUsUVZUPgkUMpi4DlJq9SgKEg6w2jf7q8joMJp6v+voJHXrH8rzAnbyxWHwAeA==" }, - "jquery.cookie": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jquery.cookie/-/jquery.cookie-1.4.1.tgz", - "integrity": "sha512-c/hZOOL+8VSw/FkTVH637gS1/6YzMSCROpTZ2qBYwJ7s7sHajU7uBkSSiE5+GXWwrfCCyO+jsYjUQ7Hs2rIxAA==" - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 3ea57a86d738..23d47db5df84 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -122,7 +122,6 @@ "@stimulus-components/auto-submit": "^6.0.0", "@stimulus-components/reveal": "^5.0.0", "@tiptap/extensions": "^3.20.0", - "@types/jquery.cookie": "^1.4.36", "@uirouter/angular": "^17.0.0", "@uirouter/core": "^6.1.0", "@uirouter/rx": "^1.0.0", @@ -148,7 +147,6 @@ "idiomorph": "^0.7.4", "jquery": "^3.7.1", "jquery.caret": "^0.3.1", - "jquery.cookie": "^1.4.1", "json5": "^2.2.2", "lit-html": "^3.3.2", "lodash": "^4.17.23", diff --git a/frontend/src/assets/sass/backlogs/_dialogues.sass b/frontend/src/assets/sass/backlogs/_dialogues.sass deleted file mode 100644 index 4d05872a31c4..000000000000 --- a/frontend/src/assets/sass/backlogs/_dialogues.sass +++ /dev/null @@ -1,9 +0,0 @@ -/* Hide the close button since we do no longer include the necessary image for the close icon -.controller-rb_master_backlogs, -.controller-rb_taskboards - .ui-dialog-titlebar-close - display: none - - .ui-dialog - background: var(--body-background) - border: 1px solid var(--borderColor-default) diff --git a/frontend/src/assets/sass/backlogs/_global.css b/frontend/src/assets/sass/backlogs/_global.css deleted file mode 100644 index 5e3cc7d66ba2..000000000000 --- a/frontend/src/assets/sass/backlogs/_global.css +++ /dev/null @@ -1,66 +0,0 @@ -/*-- copyright -OpenProject Backlogs Plugin - -Copyright (C) the OpenProject GmbH -Copyright (C)2011 Stephan Eckardt, Tim Felgentreff, Marnen Laibow-Koser, Sandro Munda -Copyright (C)2010-2011 friflaj -Copyright (C)2010 Maxime Guilbot, Andrew Vit, Joakim Kolsjö, ibussieres, Daniel Passos, Jason Vasquez, jpic, Emiliano Heyns -Copyright (C)2009-2010 Mark Maglana -Copyright (C)2009 Joe Heck, Nate Lowrie - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License version 3. - -OpenProject Backlogs is a derivative work based on ChiliProject Backlogs. -The copyright follows: -Copyright (C) 2010-2011 - Emiliano Heyns, Mark Maglana, friflaj -Copyright (C) 2011 - Jens Ulferts, Gregor Schmidt - Finn GmbH - Berlin, Germany - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++*/ - -#rb .meta { - display:none; -} -#rb #helpers { - display:none; -} -/* - .editor is the classname for field editors of sprint, - story, task, impediment. These field editors get created - at runtime whenever any of the above models are edited. -*/ -#rb .editors { - display:none; -} -#rb .ui-dialog .editor { - display:block; -} - -/* dialog */ -.ui-dialog .ui-dialog-title { float:left; margin-right:0; } -.ui-dialog.ui-widget-content { border:none; } -.ui-dialog .ui-dialog-buttonpane.ui-widget-content { border:none; } - -.subject-input { - width: 99%; -} - -th { - font-weight: var(--base-text-weight-bold); -} diff --git a/frontend/src/assets/sass/backlogs/_global_print.css b/frontend/src/assets/sass/backlogs/_global_print.css deleted file mode 100644 index 20931d7bd725..000000000000 --- a/frontend/src/assets/sass/backlogs/_global_print.css +++ /dev/null @@ -1,39 +0,0 @@ -/*-- copyright -OpenProject Backlogs Plugin - -Copyright (C) the OpenProject GmbH -Copyright (C)2011 Stephan Eckardt, Tim Felgentreff, Marnen Laibow-Koser, Sandro Munda -Copyright (C)2010-2011 friflaj -Copyright (C)2010 Maxime Guilbot, Andrew Vit, Joakim Kolsjö, ibussieres, Daniel Passos, Jason Vasquez, jpic, Emiliano Heyns -Copyright (C)2009-2010 Mark Maglana -Copyright (C)2009 Joe Heck, Nate Lowrie - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License version 3. - -OpenProject Backlogs is a derivative work based on ChiliProject Backlogs. -The copyright follows: -Copyright (C) 2010-2011 - Emiliano Heyns, Mark Maglana, friflaj -Copyright (C) 2011 - Jens Ulferts, Gregor Schmidt - Finn GmbH - Berlin, Germany - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++*/ - -#toolbar .links{ - display:none !important; -} diff --git a/frontend/src/assets/sass/backlogs/_index.sass b/frontend/src/assets/sass/backlogs/_index.sass index af0bd069623f..bfd07ffb3933 100644 --- a/frontend/src/assets/sass/backlogs/_index.sass +++ b/frontend/src/assets/sass/backlogs/_index.sass @@ -39,10 +39,4 @@ @import "../../../global_styles/openproject/_variables.sass" @import "../../../global_styles/openproject/_mixins.sass" -@import global -@import global_print -@import jqplot -@import statistics @import master_backlog -@import taskboard -@import dialogues diff --git a/frontend/src/assets/sass/backlogs/_jqplot.css b/frontend/src/assets/sass/backlogs/_jqplot.css deleted file mode 100644 index d9467564c3a6..000000000000 --- a/frontend/src/assets/sass/backlogs/_jqplot.css +++ /dev/null @@ -1,185 +0,0 @@ -/*-- copyright -OpenProject Backlogs Plugin - -Copyright (C) the OpenProject GmbH -Copyright (C)2011 Stephan Eckardt, Tim Felgentreff, Marnen Laibow-Koser, Sandro Munda -Copyright (C)2010-2011 friflaj -Copyright (C)2010 Maxime Guilbot, Andrew Vit, Joakim Kolsjö, ibussieres, Daniel Passos, Jason Vasquez, jpic, Emiliano Heyns -Copyright (C)2009-2010 Mark Maglana -Copyright (C)2009 Joe Heck, Nate Lowrie - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License version 3. - -OpenProject Backlogs is a derivative work based on ChiliProject Backlogs. -The copyright follows: -Copyright (C) 2010-2011 - Emiliano Heyns, Mark Maglana, friflaj -Copyright (C) 2011 - Jens Ulferts, Gregor Schmidt - Finn GmbH - Berlin, Germany - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++*/ - -.jqplot-target { - position: relative; - color: #666; - font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; - font-size: 1em; -} - -.jqplot-axis { - font-size: .75em; -} - -.jqplot-xaxis { - margin-top: 10px; -} - -.jqplot-x2axis { - margin-bottom: 10px; -} - -.jqplot-yaxis { - margin-right: 10px; -} - -.jqplot-y2axis, .jqplot-y3axis, .jqplot-y4axis, .jqplot-y5axis, .jqplot-y6axis, .jqplot-y7axis, .jqplot-y8axis, .jqplot-y9axis { - margin-left: 10px; - margin-right: 10px; -} - -.jqplot-axis-tick, .jqplot-xaxis-tick, .jqplot-yaxis-tick, .jqplot-x2axis-tick, .jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick { - position: absolute; -} - -.jqplot-xaxis-tick { - top: 0; - left: 15px; - vertical-align: top; -} - -.jqplot-x2axis-tick { - bottom: 0; - left: 15px; - vertical-align: bottom; -} - -.jqplot-yaxis-tick { - right: 0; - top: 15px; - text-align: right; -} - -.jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick { - left: 0; - top: 15px; - text-align: left; -} - -.jqplot-xaxis-label { - margin-top: 10px; - font-size: 11pt; - position: absolute; -} - -.jqplot-x2axis-label { - margin-bottom: 10px; - font-size: 11pt; - position: absolute; -} - -.jqplot-yaxis-label { - margin-right: 10px; - font-size: 11pt; - position: absolute; -} - -.jqplot-y2axis-label, .jqplot-y3axis-label, .jqplot-y4axis-label, .jqplot-y5axis-label, .jqplot-y6axis-label, .jqplot-y7axis-label, .jqplot-y8axis-label, .jqplot-y9axis-label { - font-size: 11pt; - position: absolute; -} - -table.jqplot-table-legend, table.jqplot-cursor-legend { - background-color: rgba(255, 255, 255, 0.6); - border: 1px solid #ccc; - position: absolute; - font-size: .75em; -} - -td.jqplot-table-legend { - vertical-align: middle; -} - -td.jqplot-table-legend > div { - border: 1px solid #ccc; - padding: .2em; -} - -div.jqplot-table-legend-swatch { - width: 0; - height: 0; - border-top-width: .35em; - border-bottom-width: .35em; - border-left-width: .6em; - border-right-width: .6em; - border-top-style: solid; - border-bottom-style: solid; - border-left-style: solid; - border-right-style: solid; -} - -.jqplot-title { - top: 0; - left: 0; - padding-bottom: .5em; - font-size: 1.2em; -} - -table.jqplot-cursor-tooltip { - border: 1px solid #ccc; - font-size: .75em; -} - -.jqplot-cursor-tooltip { - border: 1px solid #ccc; - font-size: .75em; - white-space: nowrap; - background: rgba(208, 208, 208, 0.5); - padding: 1px; -} - -.jqplot-highlighter-tooltip { - border: 1px solid #ccc; - font-size: .75em; - white-space: nowrap; - background: rgba(208, 208, 208, 0.5); - padding: 1px; -} - -.jqplot-point-label { - font-size: .75em; -} - -td.jqplot-cursor-legend-swatch { - vertical-align: middle; - text-align: center; -} - -div.jqplot-cursor-legend-swatch { - width: 1.2em; - height: .7em; -} diff --git a/frontend/src/assets/sass/backlogs/_statistics.css b/frontend/src/assets/sass/backlogs/_statistics.css deleted file mode 100644 index de64988edaf7..000000000000 --- a/frontend/src/assets/sass/backlogs/_statistics.css +++ /dev/null @@ -1,48 +0,0 @@ -/*-- copyright -OpenProject Backlogs Plugin - -Copyright (C) the OpenProject GmbH -Copyright (C)2011 Stephan Eckardt, Tim Felgentreff, Marnen Laibow-Koser, Sandro Munda -Copyright (C)2010-2011 friflaj -Copyright (C)2010 Maxime Guilbot, Andrew Vit, Joakim Kolsjö, ibussieres, Daniel Passos, Jason Vasquez, jpic, Emiliano Heyns -Copyright (C)2009-2010 Mark Maglana -Copyright (C)2009 Joe Heck, Nate Lowrie - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License version 3. - -OpenProject Backlogs is a derivative work based on ChiliProject Backlogs. -The copyright follows: -Copyright (C) 2010-2011 - Emiliano Heyns, Mark Maglana, friflaj -Copyright (C) 2011 - Jens Ulferts, Gregor Schmidt - Finn GmbH - Berlin, Germany - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -See COPYRIGHT and LICENSE files for more details. - -++*/ - -.score { text-align: center; width: 1.5em; font-size: large; display: inline-block; } -.score_0 { background-color: #FF0000; } -.score_1 { background-color: #FF5300; } -.score_2 { background-color: #FF8100; } -.score_3 { background-color: #FFA100; } -.score_4 { background-color: #FFBB00; } -.score_5 { background-color: #FFD300; } -.score_6 { background-color: #FFEC00; } -.score_7 { background-color: #E9FB00; } -.score_8 { background-color: #B1F100; } -.score_9 { background-color: #74E600; } -.score_10 { background-color: #00CC00; } diff --git a/frontend/src/assets/sass/backlogs/_taskboard.sass b/frontend/src/assets/sass/backlogs/_taskboard.sass deleted file mode 100644 index 733973ed5200..000000000000 --- a/frontend/src/assets/sass/backlogs/_taskboard.sass +++ /dev/null @@ -1,329 +0,0 @@ -/*-- copyright - * OpenProject is an open source project management software. - * Copyright (C) the OpenProject GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version 3. - * - * OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: - * Copyright (C) 2006-2013 Jean-Philippe Lang - * Copyright (C) 2010-2013 the ChiliProject Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * See COPYRIGHT and LICENSE files for more details. ++ - */ - -@mixin story-header - background-color: #FFFFFF - font-size: 1rem - rem-calc(5px) - opacity: 0.8 - filter: alpha(opacity = 80) - overflow: hidden - padding-bottom: 1px - padding-right: 3px - -@mixin story-footer - float: left - font-size: 1rem - rem-calc(5px) - width: 85% - margin-top: 4px - padding: 2px - padding-top: 0 - -@mixin ellipsis - overflow: hidden - white-space: nowrap - text-overflow: ellipsis - -#rb .task - color: #484848 - line-height: inherit - white-space: inherit - -#rb #taskboard - overflow-x: auto - #assigned_to_id_options - display: none - .swimlane - min-width: 107px - /* width + (2*margin) + (2*padding) of .work_package + (2*border) of cell */ - padding: 5px - width: 107px - /* Must be the same as min-width */ - #board_header - background-color: var(--body-background) - color: var(--body-font-color) - border: 1px solid var(--borderColor-default) - margin-bottom: 0 - margin-right: 10px - td - border-right: 1px dotted var(--borderColor-default) - font-weight: var(--base-text-weight-bold) - text-align: center - vertical-align: middle - padding-top: 0 - padding-bottom: 0 - line-height: 30px - &:first-child - min-width: 241px - width: 241px - - .board - background-color: var(--overlay-bgColor) - border: 1px solid var(--borderColor-default) - border-top: none - margin-right: 10px - /* IE7 table fix */ - table-layout: fixed - border-collapse: collapse - empty-cells: show - tr:hover - background-color: var(--control-transparent-bgColor-hover) - td - border-right: 1px dotted #CFCFCF - border-bottom: 1px dotted #CFCFCF - vertical-align: top - &:first-child - min-width: 210px - padding: 5px - width: 210px - tr:last-child td - border-bottom: none - .add_new - margin: 0 - min-width: 30px - padding: 0 - text-align: center - vertical-align: middle - width: 30px - &.clickable:hover - cursor: pointer - background-color: var(--highlight-neutral-bgColor) - .story, .label_sprint_impediments - background-color: var(--display-lemon-bgColor-muted) - color: var(--fgColor-muted) - border: none - display: block - min-height: 100px - margin: 5px - padding: 5px - position: relative - width: 190px - .story - .subject - height: 42px - line-height: 13px - margin-top: 0 - overflow: hidden - padding: 2px - width: 180px - &.closed .subject - text-decoration: line-through - .work_package, .placeholder - background-color: #AFAFAF - color: var(--color-ansi-black) - border: none - cursor: move - display: block - font-size: 10px - height: 85px - padding: 5px - margin: 5px 0px - position: relative - width: 85px - .work_package.prevent_edit - cursor: default - .placeholder - background-color: #FFFF00 - border: 1px dashed #333300 - height: 78px - width: 83px - .work_package - &.closed .subject.editable - text-decoration: line-through - .v - display: none - .remaining_hours.editable - border: 2px solid #FFFFFF - background-color: #EE0000 - bottom: -5px - color: #FFFFFF - font-size: 9px - height: 18px - padding-left: 5px - padding-right: 5px - position: absolute - right: -5px - .blocks, .remaining_hours.editable.empty - display: none - .indicator - display: none - - &.error .indicator - background: none - border: none - - &.error.icon-bug:before - position: absolute - top: 30px - left: 28px - color: red - - - .editors - display: none - -/* - * swimlane class is used by: - * - #board_header - * - .board - * - * Also use by the Column Width preference to determine the unit width of the - * swimlanes. See RB.Taskboard.initialize() - -/* status labels */ - -/* shared #impediments and #tasks */ - -/* item styles used by .task and .impediment */ - -/* dialog */ - -.task_editor_dialog.ui-dialog - .ui-widget-header - background-color: var(--bgColor-muted) - filter: alpha(opacity = 50) - .ui-dialog-title - float: right - margin-right: 0 - color: var(--body-font-color) - &.ui-widget-content - background: none - border: none - .ui-dialog-buttonpane.ui-widget-content - background: none - background-color: none - border: none - -.dark - #task_editor label, .subject, .assigned_to_id, div - color: #FFFFFF - option - color: var(--body-font-color) - -.light - #task_editor label, .subject, .assigned_to_id, div - color: var(--body-font-color) - -/* item editor */ - -#task_editor - label:first-letter - text-transform: capitalize - label - display: block - font-size: 11px - width: 100% - .editor - font-size: 11px - margin-bottom: 10px - width: 100% - .subject - height: 65px - width: 272px - .remaining_hours, .blocks - width: 268px - -/* compact view */ - -#rb - .compact - .story, .label_sprint_impediments - height: 15px - .story .subject - display: none - .work_package - height: 21px - padding: 0 - width: 21px - * - display: none - .placeholder - background-color: #FFFF00 - border: 1px dashed #333300 - height: 19px - width: 19px - #impediment_template, #task_template - display: none - -/* others */ - -.story - .story-bar - @include story-header - text-align: right - width: 180px - clear: both - .id - float: right - .status - float: left - -.story, -.label_sprint_impediments - font-size: 1rem - rem-calc(3px) - -.work_package - .id - @include story-header - text-align: right - width: 75px - a - opacity: 1.0 - filter: alpha(opacity = 100) - .editable:hover - background-color: transparent - .subject.editable - font-size: 1rem - rem-calc(3px) - height: 42px - line-height: 13px - margin-top: 0 - overflow: hidden - padding: 2px - width: 81px - -.story - .story-footer - .assigned_to_id - @include story-footer - @include ellipsis - .story-points - margin-top: 2px - float: right -.work_package - .assigned_to_id.editable - @include story-footer - .t - @include ellipsis - -/* Toolbar modifications (no support for labels form the component) */ - -#toolbar - label[for=col_width_input] - padding-top: rem-calc(20px) - - #col_width_input - max-width: 60px diff --git a/frontend/src/stimulus/controllers/dynamic/admin/backlogs-settings.controller.ts b/frontend/src/stimulus/controllers/dynamic/admin/backlogs-settings.controller.ts deleted file mode 100644 index 8482d0d0c322..000000000000 --- a/frontend/src/stimulus/controllers/dynamic/admin/backlogs-settings.controller.ts +++ /dev/null @@ -1,144 +0,0 @@ -/* - * -- copyright - * OpenProject is an open source project management software. - * Copyright (C) the OpenProject GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version 3. - * - * OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: - * Copyright (C) 2006-2013 Jean-Philippe Lang - * Copyright (C) 2010-2013 the ChiliProject Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * See COPYRIGHT and LICENSE files for more details. - * ++ - */ - -import { Controller } from '@hotwired/stimulus'; -import { - NgOption, - NgSelectComponent, -} from '@ng-select/ng-select'; - -/** - * Stimulus Controller adding behavior to Admin > Backlogs page. - * Ensures that story types and task types are mutually exclusive. - */ -export default class BacklogsSettings extends Controller { - static targets = ['storyTypes', 'taskType']; - - declare readonly storyTypesTarget:HTMLElement; - declare readonly taskTypeTarget:HTMLElement; - declare readonly hasStoryTypesTarget:boolean; - declare readonly hasTaskTypeTarget:boolean; - - private isUpdating = false; - - storyTypesTargetConnected(target:HTMLElement) { - target.addEventListener('change', this.onStoryTypesChanged); - } - - storyTypesTargetDisconnected(target:HTMLElement) { - target.removeEventListener('change', this.onStoryTypesChanged); - } - - taskTypeTargetConnected(target:HTMLElement) { - target.addEventListener('change', this.onTaskTypeChanged); - } - - taskTypeTargetDisconnected(target:HTMLElement) { - target.removeEventListener('change', this.onTaskTypeChanged); - } - - private onStoryTypesChanged = () => { - if (this.isUpdating || !this.hasTaskTypeTarget) return; - - this.syncDisabledOptions(this.storyTypesTarget, this.taskTypeTarget); - }; - - private onTaskTypeChanged = () => { - if (this.isUpdating || !this.hasStoryTypesTarget) return; - - this.syncDisabledOptions(this.taskTypeTarget, this.storyTypesTarget); - }; - - /** - * Syncs disabled options between two autocompleters. - * Selected values in the source autocompleter will be disabled in the target. - * - * @param sourceTarget The autocompleter whose selections should disable options in the target - * @param targetTarget The autocompleter whose options should be disabled - */ - private syncDisabledOptions(sourceTarget:HTMLElement, targetTarget:HTMLElement) { - this.isUpdating = true; - try { - const sourceNgSelect = this.getNgSelectComponent(sourceTarget); - const targetNgSelect = this.getNgSelectComponent(targetTarget); - - if (!sourceNgSelect || !targetNgSelect) { - return; - } - - this.syncAutocompleters(sourceNgSelect, targetNgSelect); - } finally { - this.isUpdating = false; - } - } - - /** - * Gets the NgSelectComponent instance from an op-autocompleter element. - */ - private getNgSelectComponent(target:HTMLElement):NgSelectComponent|null { - // Access the ng-select instance stored by op-autocompleter component - // eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-member-access - return (target as any).ngSelectComponentInstance ?? null; - } - - /** - * Syncs two ng-select autocompleters - ensuring selections are mutually exclusive. - * - * @param source source autocompleter - * @param target target autocompleter - */ - private syncAutocompleters(source:NgSelectComponent, target:NgSelectComponent) { - const sourceSelectedIds = new Set( - source.selectedItems - .map((item) => item.value.id) - .filter((id) => id != null) - ); - - // Directly mutate the items array to ensure ng-select updates properly - let hasChanges = false; - target.itemsList.items.forEach((targetItem:NgOption) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - const itemId = targetItem.value?.id; - - if (!itemId) return; - - const shouldBeDisabled = sourceSelectedIds.has(itemId); - if (targetItem.disabled !== shouldBeDisabled) { - targetItem.disabled = shouldBeDisabled; - hasChanges = true; - } - }); - - // Force ng-select to re-render if we made changes - if (hasChanges) { - target.detectChanges(); - } - } -} diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/common.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/common.ts deleted file mode 100644 index 12937fef187b..000000000000 --- a/frontend/src/stimulus/controllers/dynamic/backlogs/common.ts +++ /dev/null @@ -1,140 +0,0 @@ -//-- copyright -// OpenProject is an open source project management software. -// Copyright (C) the OpenProject GmbH -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License version 3. -// -// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -// Copyright (C) 2006-2013 Jean-Philippe Lang -// Copyright (C) 2010-2013 the ChiliProject Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// See COPYRIGHT and LICENSE files for more details. -//++ - -import 'jquery.cookie'; - -// @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 ($) { - let object:any; - let Factory; - let Dialog; - let UserPreferences; - - object = { - // Douglas Crockford's technique for object extension - // http://javascript.crockford.com/prototypal.html - create() { - let obj; - let i; - let methods; - let methodName; - - function F() { - } - - 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 - // 'write over' any existing methods - for (i = 1; i < arguments.length; i += 1) { - methods = arguments[i]; - if (typeof methods === 'object') { - for (methodName in methods) { - if (methods.hasOwnProperty(methodName)) { - obj[methodName] = methods[methodName]; - } - } - } - } - return obj; - }, - }; - - // Object factory for chiliproject_backlogs - Factory = object.create({ - - initialize(objType:any, el:any) { - let obj; - - obj = object.create(objType); - obj.initialize(el); - return obj; - }, - - }); - - // Utilities - Dialog = object.create({ - msg(msg:any) { - let dialog; - let baseClasses; - - baseClasses = 'ui-button ui-widget ui-state-default ui-corner-all'; - - if ($('#msgBox').length === 0) { - dialog = $('
').appendTo('body'); - } else { - dialog = $('#msgBox'); - } - - dialog.html(msg); - dialog.dialog({ - title: 'Backlogs Plugin', - buttons: [ - { - text: 'OK', - class: 'button -primary', - click() { - $(this).dialog('close'); - }, - }], - modal: true, - }); - $('.button').removeClass(baseClasses); - $('.ui-icon-closethick').prop('title', 'close'); - }, - }); - - // 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(key:any) { - return $.cookie(key); - }, - - set(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; -}(jQuery)); diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/editable_inplace.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/editable_inplace.ts deleted file mode 100644 index 22c947f995b4..000000000000 --- a/frontend/src/stimulus/controllers/dynamic/backlogs/editable_inplace.ts +++ /dev/null @@ -1,66 +0,0 @@ -//-- copyright -// OpenProject is an open source project management software. -// Copyright (C) the OpenProject GmbH -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License version 3. -// -// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -// Copyright (C) 2006-2013 Jean-Philippe Lang -// Copyright (C) 2010-2013 the ChiliProject Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// 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(editor:any) { - this.$.addClass('editing'); - editor.find('.editor').bind('keydown', this.handleKeydown); - }, - - getEditor() { - // Create the model editor container if it does not yet exist - let editor = this.$.children('.editors'); - - if (editor.length === 0) { - editor = $("
").appendTo(this.$); - } else if (!editor.hasClass('permanent')) { - editor.first().html(''); - } - return editor; - }, - - // For detecting Enter and ESC - handleKeydown(e:any) { - let j; - let that; - - j = $(this).parents('.model').first(); - that = j.data('this'); - - if (e.key === 'Enter') { - that.saveEdits(); - } 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 deleted file mode 100644 index 9393425dafbe..000000000000 --- a/frontend/src/stimulus/controllers/dynamic/backlogs/impediment.ts +++ /dev/null @@ -1,91 +0,0 @@ -//-- copyright -// OpenProject is an open source project management software. -// Copyright (C) the OpenProject GmbH -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License version 3. -// -// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -// Copyright (C) 2006-2013 Jean-Philippe Lang -// Copyright (C) 2010-2013 the ChiliProject Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// See COPYRIGHT and LICENSE files for more details. -//++ - -/************************************** - 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(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 - - // Associate this object with the element for later retrieval - j.data('this', this); - - j.on('mouseup', '.editable', this.handleClick); - }, - - // Override saveDirectives of RB.Task - saveDirectives() { - let j; - let prev; - let statusID; - - let method; - let url; - let data; - - j = this.$; - prev = this.$.prev(); - statusID = j.parent('td').first().attr('id').split('_')[1]; - - 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 }); - method = 'post'; - } else { - // @ts-expect-error TS(2304): Cannot find name 'RB'. - url = RB.urlFor('update_impediment', { id: this.getID(), sprint_id: RB.constants.sprint_id }); - method = 'put'; - } - - return { - url, - method, - data, - }; - }, - }); -}(jQuery)); diff --git a/frontend/src/stimulus/controllers/dynamic/backlogs/model.ts b/frontend/src/stimulus/controllers/dynamic/backlogs/model.ts deleted file mode 100644 index b77e59ad5806..000000000000 --- a/frontend/src/stimulus/controllers/dynamic/backlogs/model.ts +++ /dev/null @@ -1,486 +0,0 @@ -//-- copyright -// OpenProject is an open source project management software. -// Copyright (C) the OpenProject GmbH -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License version 3. -// -// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -// Copyright (C) 2006-2013 Jean-Philippe Lang -// Copyright (C) 2010-2013 the ChiliProject Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// See COPYRIGHT and LICENSE files for more details. -//++ - -import { FetchRequest, FetchResponse } from '@rails/request.js'; - -/*************************************** - MODEL - Common methods for sprint, work_package, - 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(el:any) { - this.$ = $(el); - this.el = el; - }, - - afterCreate(data:string, response:FetchResponse) { - // Do nothing. Child objects may optionally override this - }, - - afterSave(data:string, response:FetchResponse) { - let isNew; - let result; - - isNew = this.isNew(); - // @ts-expect-error TS(2304): Cannot find name 'RB'. - result = RB.Factory.initialize(RB.Model, data); - - this.unmarkSaving(); - this.refresh(result); - - if (isNew) { - const id = result.$.filter('.model').attr('id'); - this.$.attr('id', id); - - this.afterCreate(data, response); - } else { - this.afterUpdate(data, response); - } - }, - - afterUpdate(data:string, response:FetchResponse) { - // Do nothing. Child objects may optionally override this - }, - - beforeSave() { - // Do nothing. Child objects may or may not override this method - }, - - cancelEdit() { - this.endEdit(); - if (this.isNew()) { - this.$.hide('blind'); - } - }, - - close() { - this.$.addClass('closed'); - }, - - copyFromDialog() { - let editors; - - if (this.$.find('.editors').length === 0) { - editors = $("
").appendTo(this.$); - } else { - editors = this.$.find('.editors').first(); - } - editors.html(''); - editors.append($(`#${this.getType().toLowerCase()}_editor`).children('.editor')); - this.saveEdits(); - }, - - displayEditor(editor:any) { - const self = this; - let baseClasses; - - baseClasses = 'ui-button ui-widget ui-state-default ui-corner-all'; - - editor.dialog({ - buttons: [ - { - text: 'OK', - class: 'button -primary', - click() { - self.copyFromDialog(); - $(this).dialog('close'); - }, - }, - { - text: 'Cancel', - class: 'button', - click() { - self.cancelEdit(); - $(this).dialog('close'); - }, - }, - ], - 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()), - }); - editor.find('.editor').first().focus(); - $('.button').removeClass(baseClasses); - $('.ui-icon-closethick').prop('title', 'close'); - }, - - edit() { - const editor = this.getEditor(); - const self = this; - let maxTabIndex = 0; - - $('.stories .editors .editor').each(function (index) { - 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); - - if (maxTabIndex < value) { - maxTabIndex = value; - } - }); - - if (!editor.hasClass('permanent')) { - 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:any; - - if (fieldType === 'select') { - // Special handling for status_id => they are dependent of type_id - if (fieldName === 'status_id') { - typeId = $.trim(self.$.find('.type_id .v').html()); - // when creating stories we need to query the select directly - if (typeId === '') { - typeId = $('#type_id_options').val(); - } - statusId = $.trim(self.$.find('.status_id .v').html()); - input = self.findFactory(typeId, statusId, fieldName); - } else if (fieldName === 'type_id') { - 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 { - input = $(`#${fieldName}_options`).clone(true); - } - } else { - input = $(document.createElement(fieldType)); - } - - input = self.prepareInputFromFactory(input, fieldId, fieldName, fieldOrder, maxTabIndex, fieldEditable); - - // Copy the value in the field to the input element - input.val(fieldType === 'select' ? field.children('.v').first().text() : field.text()); - - // 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) { - self.$.data('focus', $(this).attr('name')); - }); - - input.blur(() => { - self.$.data('focus', ''); - }); - - $('