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

The split screen should always go back to the list (even if the state before was e.g. the full view)

Henriette Dingeracbe76e799f9
diff --git a/frontend/src/app/modules/common/back-routing/back-routing.service.ts b/frontend/src/app/modules/common/back-routing/back-routing.service.ts
index 9b7c9fbe570..a6b24933642 100644
--- a/frontend/src/app/modules/common/back-routing/back-routing.service.ts
+++ b/frontend/src/app/modules/common/back-routing/back-routing.service.ts
@@ -67,6 +67,11 @@ export class BackRoutingService {
}
}
+ public goToBaseState() {
+ const baseRoute = this.$state.current.data.baseRoute || 'work-packages.partitioned.list';
+ this.$state.go(baseRoute, this.$state.params);
+ }
+
public sync(transition:Transition) {
const fromState = transition.from();
const toState = transition.to();
diff --git a/frontend/src/app/modules/work_packages/routing/wp-split-view/wp-split-view.component.ts b/frontend/src/app/modules/work_packages/routing/wp-split-view/wp-split-view.component.ts
index b92f15d9009..944e1d2d1ba 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-split-view/wp-split-view.component.ts
+++ b/frontend/src/app/modules/work_packages/routing/wp-split-view/wp-split-view.component.ts
@@ -36,6 +36,7 @@ import {WorkPackageViewSelectionService} from "core-app/modules/work_packages/ro
import {WorkPackageSingleViewBase} from "core-app/modules/work_packages/routing/wp-view-base/work-package-single-view.base";
import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";
import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service";
+import {BackRoutingService} from "core-app/modules/common/back-routing/back-routing.service";
@Component({
templateUrl: './wp-split-view.html',
@@ -56,7 +57,8 @@ export class WorkPackageSplitViewComponent extends WorkPackageSingleViewBase imp
public keepTab:KeepTabService,
public wpTableSelection:WorkPackageViewSelectionService,
public wpTableFocus:WorkPackageViewFocusService,
- readonly $state:StateService) {
+ readonly $state:StateService,
+ readonly backRouting:BackRoutingService) {
super(injector, $state.params['workPackageId']);
}
@@ -111,6 +113,10 @@ export class WorkPackageSplitViewComponent extends WorkPackageSingleViewBase imp
return this.baseRoute.includes('bim');
}
+ public backToList() {
+ this.backRouting.goToBaseState();
+ }
+
protected initializeTexts() {
super.initializeTexts();
this.text.closeDetailsView = this.I18n.t('js.button_close_details');
diff --git a/frontend/src/app/modules/work_packages/routing/wp-split-view/wp-split-view.html b/frontend/src/app/modules/work_packages/routing/wp-split-view/wp-split-view.html
index 158b7b36e6c..58b88782cdd 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-split-view/wp-split-view.html
+++ b/frontend/src/app/modules/work_packages/routing/wp-split-view/wp-split-view.html
@@ -50,7 +50,10 @@
<edit-form [resource]="workPackage">
<div class="wp-show--header-container">
- <back-button *ngIf="showBackButton()"></back-button>
+ <back-button *ngIf="showBackButton()"
+ linkClass="work-packages-back-button"
+ [customBackMethod]="backToList.bind(this)">
+ </back-button>
<div class="subject-header">
<wp-subject></wp-subject>
diff --git a/modules/bim/spec/features/bim_navigation_spec.rb b/modules/bim/spec/features/bim_navigation_spec.rb
index a8ceaa9b298..7410ba9ec77 100644
--- a/modules/bim/spec/features/bim_navigation_spec.rb
+++ b/modules/bim/spec/features/bim_navigation_spec.rb
@@ -47,6 +47,7 @@ describe 'BIM navigation spec', type: :feature, js: true do
let(:card_view) { ::Pages::WorkPackageCards.new(project) }
let(:details_view) { ::Pages::BcfDetailsPage.new(work_package, project) }
+ let(:full_view) { Pages::FullWorkPackage.new(work_package) }
let(:model_tree) { ::Components::XeokitModelTree.new }
shared_examples 'can switch from split to viewer to list-only' do
@@ -79,8 +80,18 @@ describe 'BIM navigation spec', type: :feature, js: true do
details_view.expect_subject
details_view.switch_to_tab tab: 'Activity'
details_view.expect_tab 'Activity'
- details_view.close
+
+ # Going to full screen and back again
+ details_view.switch_to_fullscreen
+ full_view.expect_tab 'Activity'
+ full_view.go_back
+
+ details_view.ensure_page_loaded
+ details_view.expect_subject
+ details_view.go_back
+
details_view.expect_closed
+ card_view.expect_work_package_listed work_package
# Go to viewer only
model_page.switch_view 'Viewer'
diff --git a/spec/features/work_packages/cancel_editing_spec.rb b/spec/features/work_packages/cancel_editing_spec.rb
index ec38ce8506b..af7457bda76 100644
--- a/spec/features/work_packages/cancel_editing_spec.rb
+++ b/spec/features/work_packages/cancel_editing_spec.rb
@@ -168,14 +168,14 @@ describe 'Cancel editing work package', js: true do
description.click_and_type_slowly 'foobar'
# Try to move back to list, expect warning
- find('.work-packages-back-button').click
+ wp_page.go_back
wp_page.dismiss_alert_dialog!
# Now cancel the field
description.cancel_by_click
# Now we should be able to get back to list
- find('.work-packages-back-button').click
+ wp_page.go_back
wp_table.expect_work_package_listed(work_package, work_package2)
end
diff --git a/spec/features/work_packages/navigation_spec.rb b/spec/features/work_packages/navigation_spec.rb
index 06847b50e8f..b619693b90f 100644
--- a/spec/features/work_packages/navigation_spec.rb
+++ b/spec/features/work_packages/navigation_spec.rb
@@ -129,7 +129,7 @@ RSpec.feature 'Work package navigation', js: true, selenium: true do
project_html_title.expect_first_segment wp_title_segment
# Back to split screen using the button
- find('.work-packages-back-button').click
+ full_work_package.go_back
global_work_packages.expect_work_package_listed(work_package)
expect(current_path).to eq project_work_packages_path(project) + "/details/#{work_package.id}/relations"
@@ -237,7 +237,7 @@ RSpec.feature 'Work package navigation', js: true, selenium: true do
full_view.expect_and_dismiss_notification message: 'Successful update.'
# Go back to list
- find('.work-packages-back-button').click
+ full_view.go_back
wp_table.ensure_work_package_not_listed! work_package
end
diff --git a/spec/features/work_packages/zen_mode_spec.rb b/spec/features/work_packages/zen_mode_spec.rb
index 0e5c1b2126b..9d573dabd67 100644
--- a/spec/features/work_packages/zen_mode_spec.rb
+++ b/spec/features/work_packages/zen_mode_spec.rb
@@ -39,7 +39,7 @@ describe 'Zen mode', js: true do
wp_page.expect_no_zen_mode
wp_page.page.find('#work-packages-zen-mode-toggle-button').click
wp_page.expect_zen_mode
- wp_page.page.find('.work-packages-back-button').click
+ wp_page.go_back
wp_page.expect_zen_mode
wp_page.page.find('#work-packages-zen-mode-toggle-button').click
wp_page.expect_no_zen_mode
diff --git a/spec/support/pages/work_packages/abstract_work_package.rb b/spec/support/pages/work_packages/abstract_work_package.rb
index c6643671678..6096cafe07b 100644
--- a/spec/support/pages/work_packages/abstract_work_package.rb
+++ b/spec/support/pages/work_packages/abstract_work_package.rb
@@ -274,6 +274,10 @@ module Pages
find('.inline-edit--container.subject input')
end
+ def go_back
+ find('.work-packages-back-button').click
+ end
+
private
def create_page(_args)