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

Change the new board modal to be selected in tile mode in collaboration with task number [33864] (#8524)

Behrokh Satarnejadf3ec94857a42
diff --git a/frontend/src/app/modules/boards/board/board-actions/assignee/assignee-action.service.ts b/frontend/src/app/modules/boards/board/board-actions/assignee/assignee-action.service.ts
index a95ce8706d4..e93f215cc84 100644
--- a/frontend/src/app/modules/boards/board/board-actions/assignee/assignee-action.service.ts
+++ b/frontend/src/app/modules/boards/board/board-actions/assignee/assignee-action.service.ts
@@ -11,6 +11,14 @@ import {take} from "rxjs/operators";
export class BoardAssigneeActionService extends BoardActionService {
filterName = 'assignee';
+ text = this.I18n.t('js.boards.board_type.action_by_attribute',
+ { attribute: this.I18n.t('js.boards.board_type.action_type.assignee')});
+
+ description = this.I18n.t('js.boards.board_type.action_text',
+ { attribute: this.I18n.t('js.boards.board_type.action_type.assignee')});
+
+ icon = 'icon-user';
+
public get localizedName() {
return this.I18n.t('js.work_packages.properties.assignee');
}
diff --git a/frontend/src/app/modules/boards/board/board-actions/board-action.service.ts b/frontend/src/app/modules/boards/board/board-actions/board-action.service.ts
index e7a4c8a815c..e9d61026ec4 100644
--- a/frontend/src/app/modules/boards/board/board-actions/board-action.service.ts
+++ b/frontend/src/app/modules/boards/board/board-actions/board-action.service.ts
@@ -47,6 +47,21 @@ export abstract class BoardActionService {
*/
filterName:string;
+ /**
+ * The icon used in tile
+ */
+ icon:string;
+
+ /**
+ * The description used in tile
+ */
+ description:string;
+
+ /**
+ * The text used in tile header
+ */
+ text:string;
+
/**
* Returns the current filter value ID if any
* @param query
diff --git a/frontend/src/app/modules/boards/board/board-actions/board-actions-registry.service.ts b/frontend/src/app/modules/boards/board/board-actions/board-actions-registry.service.ts
index 50d82d0fde1..d9580321db5 100644
--- a/frontend/src/app/modules/boards/board/board-actions/board-actions-registry.service.ts
+++ b/frontend/src/app/modules/boards/board/board-actions/board-actions-registry.service.ts
@@ -12,7 +12,7 @@ export class BoardActionsRegistryService {
public available() {
return _.map(this.mapping, (service:BoardActionService, attribute:string) => {
- return { attribute: attribute, text: service.localizedName };
+ return { attribute: attribute, text: service.localizedName, icon:'', description:'' };
});
}
diff --git a/frontend/src/app/modules/boards/board/board-actions/status/status-action.service.ts b/frontend/src/app/modules/boards/board/board-actions/status/status-action.service.ts
index e9367b6f75b..4ec33929721 100644
--- a/frontend/src/app/modules/boards/board/board-actions/status/status-action.service.ts
+++ b/frontend/src/app/modules/boards/board/board-actions/status/status-action.service.ts
@@ -7,6 +7,14 @@ import {BoardActionService} from "core-app/modules/boards/board/board-actions/bo
export class BoardStatusActionService extends BoardActionService {
filterName = 'status';
+ text = this.I18n.t('js.boards.board_type.action_by_attribute',
+ { attribute: this.I18n.t('js.boards.board_type.action_type.status')});
+
+ description = this.I18n.t('js.boards.board_type.action_text',
+ { attribute: this.I18n.t('js.boards.board_type.action_type.status')});
+
+ icon = 'icon-workflow';
+
public get localizedName() {
return this.I18n.t('js.work_packages.properties.status');
}
diff --git a/frontend/src/app/modules/boards/board/board-actions/subproject/subproject-action.service.ts b/frontend/src/app/modules/boards/board/board-actions/subproject/subproject-action.service.ts
index 90e1be060db..b914c56439b 100644
--- a/frontend/src/app/modules/boards/board/board-actions/subproject/subproject-action.service.ts
+++ b/frontend/src/app/modules/boards/board/board-actions/subproject/subproject-action.service.ts
@@ -15,6 +15,14 @@ import {SubprojectBoardHeaderComponent} from "core-app/modules/boards/board/boar
export class BoardSubprojectActionService extends BoardActionService {
filterName = 'onlySubproject';
+ text = this.I18n.t('js.boards.board_type.action_by_attribute',
+ { attribute: this.I18n.t('js.boards.board_type.action_type.subproject')}) ;
+
+ description = this.I18n.t('js.boards.board_type.action_text',
+ { attribute: this.I18n.t('js.boards.board_type.action_type.subproject')});
+
+ icon = 'icon-projects';
+
private subprojects = input<HalResource[]>();
get localizedName() {
diff --git a/frontend/src/app/modules/boards/board/board-actions/version/version-action.service.ts b/frontend/src/app/modules/boards/board/board-actions/version/version-action.service.ts
index 3da4a101b9e..da2c997e8b2 100644
--- a/frontend/src/app/modules/boards/board/board-actions/version/version-action.service.ts
+++ b/frontend/src/app/modules/boards/board/board-actions/version/version-action.service.ts
@@ -20,6 +20,14 @@ export class BoardVersionActionService extends BoardActionService {
filterName = 'version';
+ text = this.I18n.t('js.boards.board_type.action_by_attribute',
+ { attribute: this.I18n.t('js.boards.board_type.action_type.version')});
+
+ description = this.I18n.t('js.boards.board_type.action_text',
+ { attribute: this.I18n.t('js.boards.board_type.action_type.version')});
+
+ icon = 'icon-getting-started';
+
private writable$:Promise<boolean>;
public get localizedName() {
diff --git a/frontend/src/app/modules/boards/new-board-modal/new-board-modal.component.ts b/frontend/src/app/modules/boards/new-board-modal/new-board-modal.component.ts
index 8538847fee2..d06bebf5715 100644
--- a/frontend/src/app/modules/boards/new-board-modal/new-board-modal.component.ts
+++ b/frontend/src/app/modules/boards/new-board-modal/new-board-modal.component.ts
@@ -37,9 +37,11 @@ import {BoardService} from "core-app/modules/boards/board/board.service";
import {BoardActionsRegistryService} from "core-app/modules/boards/board/board-actions/board-actions-registry.service";
import {LoadingIndicatorService} from "core-app/modules/common/loading-indicator/loading-indicator.service";
import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";
+import { ITileViewEntry } from '../tile-view/tile-view.component';
+
@Component({
- templateUrl: './new-board-modal.html'
+ templateUrl: './new-board-modal.html',
})
export class NewBoardModalComponent extends OpModalComponent {
@ViewChild('actionAttributeSelect', { static: true }) actionAttributeSelect:ElementRef;
@@ -62,6 +64,7 @@ export class NewBoardModalComponent extends OpModalComponent {
action_board: this.I18n.t('js.boards.board_type.action'),
action_board_text: this.I18n.t('js.boards.board_type.action_text'),
select_attribute: this.I18n.t('js.boards.board_type.select_attribute'),
+ select_board_type: this.I18n.t('js.boards.board_type.select_board_type'),
placeholder: this.I18n.t('js.placeholders.selection'),
};
@@ -73,17 +76,34 @@ export class NewBoardModalComponent extends OpModalComponent {
readonly boardActions:BoardActionsRegistryService,
readonly halNotification:HalResourceNotificationService,
readonly loadingIndicatorService:LoadingIndicatorService,
- readonly I18n:I18nService) {
+ readonly I18n:I18nService,
+ readonly boardActionRegistry:BoardActionsRegistryService) {
super(locals, cdRef, elementRef);
+ this.initiateTiles();
}
- createFree() {
+ public createBoard(attribute:string) {
+ if (attribute === 'basic') {
+ this.createFree();
+ }
+ else {
+ this.createAction(attribute);
+ }
+ }
+ private initiateTiles() {
+ this.available.unshift({attribute:'basic', text:this.text.free_board,
+ icon:'icon-boards', description:this.text.free_board_text});
+ this.addIcon(this.available);
+ this.addDescription(this.available);
+ this.addText(this.available);
+ }
+ private createFree() {
this.create({ type: 'free' });
}
- createAction() {
- this.create({ type: 'action', attribute: this.actionAttributeSelect.nativeElement.value! });
+ private createAction(attribute:string) {
+ this.create({ type: 'action', attribute: attribute! });
}
private create(params:{ type:BoardType, attribute?:string }) {
@@ -101,5 +121,27 @@ export class NewBoardModalComponent extends OpModalComponent {
this.halNotification.handleRawError(error);
});
}
+ private addDescription(tiles:ITileViewEntry[]) {
+ tiles.forEach(element => {
+ if (element.attribute !== 'basic') {
+ const service = this.boardActionRegistry.get(element.attribute!);
+ element.description = service.description; }
+ });
+ }
+ private addIcon(tiles:ITileViewEntry[]) {
+ tiles.forEach(element => {
+ if (element.attribute !== 'basic') {
+ const service = this.boardActionRegistry.get(element.attribute!);
+ element.icon = service.icon;
+ }
+ });
+ }
+ private addText(tiles:ITileViewEntry[]) {
+ tiles.forEach(element => {
+ if (element.attribute !== 'basic') {
+ const service = this.boardActionRegistry.get(element.attribute!);
+ element.text = service.text;
+ }
+ });
+ }
}
-
diff --git a/frontend/src/app/modules/boards/new-board-modal/new-board-modal.html b/frontend/src/app/modules/boards/new-board-modal/new-board-modal.html
index b4dbcadcba5..18da0ed6a62 100644
--- a/frontend/src/app/modules/boards/new-board-modal/new-board-modal.html
+++ b/frontend/src/app/modules/boards/new-board-modal/new-board-modal.html
@@ -1,55 +1,27 @@
<div class="op-modal--portal confirm-form-submit--modal ngdialog-theme-openproject">
<div class="op-modal--modal-container confirm-dialog--modal loading-indicator--location"
data-indicator-name="modal"
- tabindex="0">
+ tabindex="0">
<div class="op-modal--modal-header">
<a class="op-modal--modal-close-button" *ngIf="showClose">
- <i
- class="icon-close"
- (click)="closeMe($event)"
- [attr.title]="text.close_popup">
+ <i
+ class="icon-close"
+ (click)="closeMe($event)"
+ [attr.title]="text.close_popup">
</i>
</a>
<h3 class="icon-context icon-add" [textContent]="text.board_type"></h3>
</div>
<div class="ngdialog-body op-modal--modal-body">
+ <p [textContent]="text.select_board_type"></p>
<section class="new-board--section">
- <h3 [textContent]="text.free_board"></h3>
- <p [textContent]="text.free_board_text"></p>
-
- <button class="button"
- [disabled]="inFlight"
- (accessibleClick)="createFree()">
- <op-icon icon-classes="icon4 icon-add"></op-icon>
- <span [textContent]="text.free_board"></span>
- </button>
- </section>
- <section class="new-board--section">
- <h3 [textContent]="text.action_board"></h3>
- <p [textContent]="text.action_board_text"></p>
-
- <div class="form--field">
- <div class="form--field-container">
- <div class="form--select-container -slim">
- <label class="form--label" for="new_board_action_select" [textContent]="text.select_attribute"></label>
- <select #actionAttributeSelect
- name="new_board_action_select"
- id="new_board_action_select"
- class="new-board--action-select">
- <option *ngFor="let item of available" [value]="item.attribute" [textContent]="item.text"></option>
- </select>
- </div>
- </div>
- </div>
-
- <button class="button"
- [disabled]="inFlight"
- (accessibleClick)="createAction()">
- <op-icon icon-classes="icon4 icon-add"></op-icon>
- <span [textContent]="text.action_board"></span>
- </button>
+ <tile-view
+ [tiles]="available"
+ [disable]="inFlight"
+ (create)="createBoard($event)">
+ </tile-view>
</section>
</div>
</div>
-</div>
+</div>
\ No newline at end of file
diff --git a/frontend/src/app/modules/boards/openproject-boards.module.ts b/frontend/src/app/modules/boards/openproject-boards.module.ts
index 0464d935e65..4bca52a85a8 100644
--- a/frontend/src/app/modules/boards/openproject-boards.module.ts
+++ b/frontend/src/app/modules/boards/openproject-boards.module.ts
@@ -51,6 +51,7 @@ import {BoardPartitionedPageComponent} from "core-app/modules/boards/board/board
import {BoardListContainerComponent} from "core-app/modules/boards/board/board-partitioned-page/board-list-container.component";
import {BoardsMenuButtonComponent} from "core-app/modules/boards/board/toolbar-menu/boards-menu-button.component";
import {AssigneeBoardHeaderComponent} from "core-app/modules/boards/board/board-actions/assignee/assignee-board-header.component";
+import { TileViewComponent } from './tile-view/tile-view.component';
import {SubprojectBoardHeaderComponent} from "core-app/modules/boards/board/board-actions/subproject/subproject-board-header.component";
@NgModule({
@@ -87,7 +88,8 @@ import {SubprojectBoardHeaderComponent} from "core-app/modules/boards/board/boar
BoardFilterComponent,
VersionBoardHeaderComponent,
AssigneeBoardHeaderComponent,
- SubprojectBoardHeaderComponent,
+ TileViewComponent,
+ SubprojectBoardHeaderComponent
]
})
export class OpenprojectBoardsModule {
diff --git a/frontend/src/app/modules/boards/tile-view/tile-view.component.html b/frontend/src/app/modules/boards/tile-view/tile-view.component.html
new file mode 100644
index 00000000000..ed30e3e2de4
--- /dev/null
+++ b/frontend/src/app/modules/boards/tile-view/tile-view.component.html
@@ -0,0 +1,14 @@
+<div class="tile-blocks--container">
+ <div class="tile-block button"
+ [disabled]="disabled()"
+ (accessibleClick)="created(tile.attribute)"
+ *ngFor="let tile of tiles">
+
+ <div class="row tile-block-header">
+ <i class="tile-block--icon icon3" [ngClass]="tile.icon" aria-hidden="true"></i>
+ <span>{{ tile.text | titlecase}}</span>
+ </div>
+
+ <p [textContent]="tile.description"></p>
+ </div>
+</div>
\ No newline at end of file
diff --git a/frontend/src/app/modules/boards/tile-view/tile-view.component.sass b/frontend/src/app/modules/boards/tile-view/tile-view.component.sass
new file mode 100644
index 00000000000..5cc1bc7c62d
--- /dev/null
+++ b/frontend/src/app/modules/boards/tile-view/tile-view.component.sass
@@ -0,0 +1,32 @@
+.tile-blocks--container
+ display: grid
+ grid-template: repeat(auto-fit, 220px) / repeat(auto-fit, 450px)
+ grid-auto-rows: 220px
+ grid-column-gap: 10px
+ grid-row-gap: 10px
+ min-width: 500px
+ margin: 5px
+
+.tile-block
+ border-radius: 3px
+ display: grid
+ grid-template: 95px 1fr / 1fr
+ grid-row-gap: 5px
+ justify-items: left
+ background: #f8f8f8
+
+ &:hover
+ outline: 1px solid grey
+ text-decoration: none
+
+.tile-block--icon
+ font-size: 50px
+
+.tile-block-header
+ padding-left: 10px
+ color: var(--primary-color-dark)
+ display: flex
+ align-items: center
+
+.tile-block p
+ text-align: left
\ No newline at end of file
diff --git a/frontend/src/app/modules/boards/tile-view/tile-view.component.spec.ts b/frontend/src/app/modules/boards/tile-view/tile-view.component.spec.ts
new file mode 100644
index 00000000000..9ead365954d
--- /dev/null
+++ b/frontend/src/app/modules/boards/tile-view/tile-view.component.spec.ts
@@ -0,0 +1,50 @@
+import {ComponentFixture, TestBed, async} from '@angular/core/testing';
+import {DebugElement} from '@angular/core';
+import {By} from '@angular/platform-browser';
+import {TileViewComponent} from './tile-view.component';
+
+describe('shows tiles', () => {
+ let app:TileViewComponent;
+ let fixture:ComponentFixture<TileViewComponent>;
+ let element:DebugElement;
+
+ let tilesStub = [{
+ attribute: 'basic', text: 'Basic board',
+ icon: 'icon-boards', description: `Create a board in which you can freely
+ create lists and order your work packages within.
+ Moving work packages between lists do not change the work package itself.`
+ }];
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ declarations: [
+ TileViewComponent],
+ providers: [],
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(TileViewComponent);
+ app = fixture.debugElement.componentInstance;
+ app.tiles = tilesStub;
+ element = fixture.debugElement;
+ });
+
+ it('should render the componenet successfully', () => {
+ fixture.detectChanges();
+ let tile = document.querySelector('.tile-blocks--container');
+ expect(document.contains(tile)).toBeTruthy();
+ });
+
+ it('should show each tile', () => {
+ fixture.detectChanges();
+ let tile:HTMLElement = element.query(By.css('.tile-block')).nativeElement;
+ expect(tile.textContent).toContain('Basic Board');
+
+ });
+
+ it('should show the icon', () => {
+ fixture.detectChanges();
+ let tile = document.querySelector('.tile-block--icon');
+ expect(document.contains(tile)).toBeTruthy();
+
+ });
+});
\ No newline at end of file
diff --git a/frontend/src/app/modules/boards/tile-view/tile-view.component.ts b/frontend/src/app/modules/boards/tile-view/tile-view.component.ts
new file mode 100644
index 00000000000..f7ee7b5c21a
--- /dev/null
+++ b/frontend/src/app/modules/boards/tile-view/tile-view.component.ts
@@ -0,0 +1,30 @@
+import {ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output} from "@angular/core";
+
+export interface ITileViewEntry {
+ text:string;
+ attribute:string;
+ icon:string;
+ description:string;
+ }
+
+ @Component({
+ selector: 'tile-view',
+ styleUrls: ['./tile-view.component.sass'],
+ templateUrl: './tile-view.component.html',
+ changeDetection: ChangeDetectionStrategy.OnPush
+ })
+ export class TileViewComponent {
+ @Input() public tiles:ITileViewEntry[];
+ @Input() public disable:boolean = false;
+
+ @Output() public create = new EventEmitter<string>();
+
+ public disabled() {
+ return this.disable;
+ }
+
+ public created(attribute:string) {
+ this.create.emit(attribute);
+ }
+
+}
diff --git a/modules/boards/config/locales/js-en.yml b/modules/boards/config/locales/js-en.yml
index a0aca9f1723..6357391b8ac 100644
--- a/modules/boards/config/locales/js-en.yml
+++ b/modules/boards/config/locales/js-en.yml
@@ -36,19 +36,20 @@ en:
board_type:
text: 'Board type'
free: 'Basic board'
+ select_board_type: 'Please choose the type of board you need.'
free_text: >
Create a board in which you can freely create lists and order your work packages within.
Moving work packages between lists do not change the work package itself.
action: 'Action board'
action_by_attribute: 'Action board (%{attribute})'
action_text: >
- Create a board with filtered lists on a single attribute. Moving work packages to other lists
+ Create a board with filtered lists on %{attribute} attribute. Moving work packages to other lists
will update their attribute.
action_type:
assignee: assignee
status: status
version: version
- subproject: Subproject
+ subproject: subproject
select_attribute: "Action attribute"
add_list_modal:
diff --git a/modules/boards/spec/features/action_boards/subproject_board_spec.rb b/modules/boards/spec/features/action_boards/subproject_board_spec.rb
index 224bd05d6c0..afc3df21f13 100644
--- a/modules/boards/spec/features/action_boards/subproject_board_spec.rb
+++ b/modules/boards/spec/features/action_boards/subproject_board_spec.rb
@@ -119,7 +119,7 @@ describe 'Subproject action board', type: :feature, js: true do
board_page.expect_movable 'Child 1', 'Foo', movable: true
board_page.board(reload: true) do |board|
- expect(board.name).to eq 'Action board (Subproject)'
+ expect(board.name).to eq 'Action board (subproject)'
queries = board.contained_queries
expect(queries.count).to eq(1)
diff --git a/modules/boards/spec/features/support/board_index_page.rb b/modules/boards/spec/features/support/board_index_page.rb
index 8980d48006e..0fd4f1dd10a 100644
--- a/modules/boards/spec/features/support/board_index_page.rb
+++ b/modules/boards/spec/features/support/board_index_page.rb
@@ -60,10 +60,9 @@ module Pages
page.find('.toolbar-item a', text: 'Board').click
if action == nil
- find('.button', text: 'Basic board').click
+ find('.tile-block', text: 'Basic Board').click
else
- select action.to_s, from: 'new_board_action_select'
- find('.button', text: 'Action board').click
+ find('.tile-block', text: action.to_s).click
end
if expect_empty