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

Viewer and Table display mode without icon

Aleix Suau31f2a4213f92
diff --git a/frontend/src/app/modules/bim/ifc_models/bcf/list-container/bcf-list-container.component.ts b/frontend/src/app/modules/bim/ifc_models/bcf/list-container/bcf-list-container.component.ts
index ba234a270bc..84f740b5819 100644
--- a/frontend/src/app/modules/bim/ifc_models/bcf/list-container/bcf-list-container.component.ts
+++ b/frontend/src/app/modules/bim/ifc_models/bcf/list-container/bcf-list-container.component.ts
@@ -7,7 +7,7 @@ import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-
import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service";
import {DragAndDropService} from "core-app/modules/common/drag-and-drop/drag-and-drop.service";
import {CausedUpdatesService} from "core-app/modules/boards/board/caused-updates/caused-updates.service";
-import {bimSplitViewIdentifier, BimViewService} from "core-app/modules/bim/ifc_models/pages/viewer/bim-view.service";
+import {bimSplitViewCardsIdentifier, bimSplitViewListIdentifier, BimViewService} from "core-app/modules/bim/ifc_models/pages/viewer/bim-view.service";
import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
import {wpDisplayCardRepresentation, wpDisplayListRepresentation} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-display-representation.service";
import {IfcModelsDataService} from "core-app/modules/bim/ifc_models/pages/viewer/ifc-models-data.service";
@@ -53,10 +53,10 @@ export class BcfListContainerComponent extends WorkPackageListViewComponent impl
distinctUntilChanged(),
)
.subscribe((cards:boolean) => {
- if (cards || cards == null) {
- this.wpDisplayRepresentation.setDisplayRepresentation(wpDisplayCardRepresentation);
+ if (cards == null || cards || this.deviceService.isMobile) {
+ this.showTableView = false;
} else {
- this.wpDisplayRepresentation.setDisplayRepresentation(wpDisplayListRepresentation);
+ this.showTableView = true;
}
this.cdRef.detectChanges();
@@ -64,18 +64,16 @@ export class BcfListContainerComponent extends WorkPackageListViewComponent impl
}
protected updateViewRepresentation(query:QueryResource) {
- if (this.wpDisplayRepresentation.current === null) {
- this.wpDisplayRepresentation.setDisplayRepresentation(wpDisplayCardRepresentation);
- }
-
- super.updateViewRepresentation(query);
+ // Overwrite the parent method because we are setting the view
+ // above through the cards parameter (showTableView)
}
protected showResizerInCardView():boolean {
if (this.noResults && this.ifcModelsService.models.length === 0) {
return false;
} else {
- return this.bimView.currentViewerState() === bimSplitViewIdentifier;
+ return this.bimView.currentViewerState() === bimSplitViewCardsIdentifier ||
+ this.bimView.currentViewerState() === bimSplitViewListIdentifier;
}
}
}
diff --git a/frontend/src/app/modules/bim/ifc_models/openproject-ifc-models.routes.ts b/frontend/src/app/modules/bim/ifc_models/openproject-ifc-models.routes.ts
index a574c648d41..4a9e5a7d881 100644
--- a/frontend/src/app/modules/bim/ifc_models/openproject-ifc-models.routes.ts
+++ b/frontend/src/app/modules/bim/ifc_models/openproject-ifc-models.routes.ts
@@ -66,10 +66,7 @@ export const IFC_ROUTES:Ng2StateDeclaration[] = [
},
{
name: 'bim.partitioned.list',
- url: '/list',
- params: {
- cards: true,
- },
+ url: '/list?{cards:bool}',
data: {
baseRoute: 'bim.partitioned.list',
newRoute: 'bim.partitioned.list.new',
@@ -82,7 +79,7 @@ export const IFC_ROUTES:Ng2StateDeclaration[] = [
},
{
name: 'bim.partitioned.split',
- url: '/split',
+ url: '/split?{cards:bool}',
data: {
baseRoute: 'bim.partitioned.split',
partition: '-split',
diff --git a/frontend/src/app/modules/bim/ifc_models/pages/viewer/bim-view.service.ts b/frontend/src/app/modules/bim/ifc_models/pages/viewer/bim-view.service.ts
index 762fe2c85ca..80c5ed9cc02 100644
--- a/frontend/src/app/modules/bim/ifc_models/pages/viewer/bim-view.service.ts
+++ b/frontend/src/app/modules/bim/ifc_models/pages/viewer/bim-view.service.ts
@@ -36,10 +36,11 @@ import {takeUntil} from "rxjs/operators";
export const bimListViewIdentifier = 'list';
export const bimTableViewIdentifier = 'table';
-export const bimSplitViewIdentifier = 'split';
+export const bimSplitViewCardsIdentifier = 'splitCards';
+export const bimSplitViewListIdentifier = 'splitList';
export const bimViewerViewIdentifier = 'viewer';
-export type BimViewState = 'list'|'viewer'|'split'|'table';
+export type BimViewState = 'list'|'viewer'|'splitList'|'splitCards'|'table';
@Injectable()
export class BimViewService implements OnDestroy {
@@ -48,14 +49,16 @@ export class BimViewService implements OnDestroy {
public text:any = {
list: this.I18n.t('js.views.card'),
viewer: this.I18n.t('js.ifc_models.views.viewer'),
- split: this.I18n.t('js.ifc_models.views.split'),
+ splitList: this.I18n.t('js.ifc_models.views.split'),
+ splitCards: this.I18n.t('js.ifc_models.views.split-cards'),
table: this.I18n.t('js.views.list'),
};
public icon:any = {
list: 'icon-view-card',
viewer: 'icon-view-model',
- split: 'icon-view-split2',
+ splitList: 'icon-view-split2',
+ splitCards: 'icon-view-split2',
table: 'icon-view-list',
};
@@ -81,7 +84,7 @@ export class BimViewService implements OnDestroy {
}
get current():BimViewState {
- return this._state.getValueOr(bimSplitViewIdentifier);
+ return this._state.getValueOr(bimSplitViewCardsIdentifier);
}
public currentViewerState():BimViewState {
@@ -92,7 +95,9 @@ export class BimViewService implements OnDestroy {
} else if (this.state.includes('bim.**.model')) {
return bimViewerViewIdentifier;
} else {
- return bimSplitViewIdentifier;
+ return this.state.params?.cards || this.state.params?.cards == null ?
+ bimSplitViewCardsIdentifier :
+ bimSplitViewListIdentifier;
}
}
diff --git a/frontend/src/app/modules/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-dropdown.directive.ts b/frontend/src/app/modules/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-dropdown.directive.ts
index b6a89f35cf8..7a5e8442ec6 100644
--- a/frontend/src/app/modules/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-dropdown.directive.ts
+++ b/frontend/src/app/modules/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-dropdown.directive.ts
@@ -34,7 +34,7 @@ import {StateService} from "@uirouter/core";
import {WorkPackageFiltersService} from "core-components/filters/wp-filters/wp-filters.service";
import {
- bimListViewIdentifier, bimSplitViewIdentifier, bimTableViewIdentifier,
+ bimListViewIdentifier, bimSplitViewListIdentifier, bimSplitViewCardsIdentifier, bimTableViewIdentifier,
bimViewerViewIdentifier,
BimViewService
} from "core-app/modules/bim/ifc_models/pages/viewer/bim-view.service";
@@ -78,7 +78,7 @@ export class BimViewToggleDropdownDirective extends OpContextMenuTrigger {
const current = this.bimView.current;
const viewRoute = this.state.current.data.viewRoute;
let items = this.viewerBridgeService.shouldShowViewer ?
- [bimViewerViewIdentifier, bimListViewIdentifier, bimSplitViewIdentifier, bimTableViewIdentifier] :
+ [bimViewerViewIdentifier, bimListViewIdentifier, bimSplitViewCardsIdentifier, bimSplitViewListIdentifier, bimTableViewIdentifier] :
[bimListViewIdentifier, bimTableViewIdentifier];
this.items = items
@@ -114,8 +114,11 @@ export class BimViewToggleDropdownDirective extends OpContextMenuTrigger {
case bimViewerViewIdentifier:
this.state.go('bim.partitioned.model');
break;
- case bimSplitViewIdentifier:
- this.state.go('bim.partitioned.split');
+ case bimSplitViewCardsIdentifier:
+ this.state.go('bim.partitioned.split', {cards: true});
+ break;
+ case bimSplitViewListIdentifier:
+ this.state.go('bim.partitioned.split', {cards: false});
break;
}
diff --git a/modules/bim/config/locales/js-en.yml b/modules/bim/config/locales/js-en.yml
index d49e07780b9..fc3e7a1bfa4 100644
--- a/modules/bim/config/locales/js-en.yml
+++ b/modules/bim/config/locales/js-en.yml
@@ -18,4 +18,5 @@ en:
manage: 'Manage models'
views:
viewer: 'Viewer'
- split: 'Viewer and cards'
+ split: 'Viewer and table'
+ split-cards: 'Viewer and cards'