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

Improved the new project page template selection UI (#9247)

Benjamin Bädorf3dc3568f6f31
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 7e5f7dc5257..e4a409d7022 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -574,6 +574,7 @@ en:
click_to_switch_context: 'Open this work package in that project.'
confirm_template_load: 'Switching the template will reload the page and you will lose all input to this form. Continue?'
use_template: "Use template"
+ no_template_selected: "(None)"
copy:
copy_options: "Copy options"
diff --git a/frontend/src/app/modules/common/forms/form.sass b/frontend/src/app/modules/common/forms/form.sass
index 3ac05b38a72..bf2ad2b787c 100644
--- a/frontend/src/app/modules/common/forms/form.sass
+++ b/frontend/src/app/modules/common/forms/form.sass
@@ -17,11 +17,18 @@
.op-form-field + .op-form-field,
.op-form-field + .op-fieldset,
.op-form-field + .op-button,
+ .op-form-field + .op-highlighted-input,
.op-fieldset + .op-form-field,
.op-fieldset + .op-fieldset,
.op-fieldset + .button,
+ .op-fieldset + .op-highlighted-input,
+ .op-highlighted-input + .op-form-field,
+ .op-highlighted-input + .op-fieldset,
+ .op-highlighted-input + .op-button,
+ .op-highlighted-input + .op-highlighted-input,
.button + .op-form-field,
.button + .op-fieldset,
- .button + .button
+ .button + .button,
+ .button + .op-highlighted-input
margin-top: 1.5rem
diff --git a/frontend/src/app/modules/common/forms/highlighted-input.sass b/frontend/src/app/modules/common/forms/highlighted-input.sass
new file mode 100644
index 00000000000..fcd4c090d69
--- /dev/null
+++ b/frontend/src/app/modules/common/forms/highlighted-input.sass
@@ -0,0 +1,12 @@
+.op-highlighted-input
+ padding: 1rem 1rem 0.5rem 0.75rem
+ display: flex
+ flex-direction: column
+ border: 1px solid #cbd5e0
+ background: #f7fafc
+ border-radius: 4px
+
+ &_active
+ border: 1px solid #90cdf4
+ background: #ebf8ff
+
diff --git a/frontend/src/app/modules/common/forms/index.sass b/frontend/src/app/modules/common/forms/index.sass
index fc92a60931e..f67b666db2d 100644
--- a/frontend/src/app/modules/common/forms/index.sass
+++ b/frontend/src/app/modules/common/forms/index.sass
@@ -1,3 +1,4 @@
@import './form-field/form-field'
@import './form'
@import './fieldset'
+@import './highlighted-input'
diff --git a/frontend/src/app/modules/projects/components/new-project/new-project.component.html b/frontend/src/app/modules/projects/components/new-project/new-project.component.html
index 4e571cf81e8..29152922c7a 100644
--- a/frontend/src/app/modules/projects/components/new-project/new-project.component.html
+++ b/frontend/src/app/modules/projects/components/new-project/new-project.component.html
@@ -2,19 +2,22 @@
class="op-form"
[formGroup]="templateForm"
>
- <op-form-field
- [label]="text.use_template"
- data-qa-field-name="use_template"
- >
- <ng-select
- [formControl]="templateControl"
- [items]="templateOptions$ | async"
- (ngModelChange)="onTemplateSelected($event)"
- bindLabel="name"
- slot="input"
+ <div [ngClass]="{ 'op-highlighted-input': true, 'op-highlighted-input_active': !!templateControl?.value }">
+ <op-form-field
+ [label]="text.use_template"
+ data-qa-field-name="use_template"
>
- </ng-select>
- </op-form-field>
+ <ng-select
+ [formControl]="templateControl"
+ [items]="templateOptions$ | async"
+ (ngModelChange)="onTemplateSelected($event)"
+ bindLabel="name"
+ [placeholder]="text.no_template_selected"
+ slot="input"
+ >
+ </ng-select>
+ </op-form-field>
+ </div>
</form>
<op-dynamic-form
diff --git a/frontend/src/app/modules/projects/components/new-project/new-project.component.sass b/frontend/src/app/modules/projects/components/new-project/new-project.component.sass
new file mode 100644
index 00000000000..446c5990f0e
--- /dev/null
+++ b/frontend/src/app/modules/projects/components/new-project/new-project.component.sass
@@ -0,0 +1,2 @@
+.op-form
+ margin-bottom: 1rem
diff --git a/frontend/src/app/modules/projects/components/new-project/new-project.component.ts b/frontend/src/app/modules/projects/components/new-project/new-project.component.ts
index bec7ddc017f..2426024866b 100644
--- a/frontend/src/app/modules/projects/components/new-project/new-project.component.ts
+++ b/frontend/src/app/modules/projects/components/new-project/new-project.component.ts
@@ -1,4 +1,4 @@
-import {ChangeDetectionStrategy, Component, OnInit} from '@angular/core';
+import {Component, OnInit} from '@angular/core';
import {StateService, UIRouterGlobals} from "@uirouter/core";
import {UntilDestroyedMixin} from "core-app/helpers/angular/until-destroyed.mixin";
import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service";
@@ -12,7 +12,6 @@ import {map} from "rxjs/operators";
import {Observable} from "rxjs";
import {JobStatusModal} from "core-app/modules/job-status/job-status-modal/job-status.modal";
import {OpModalService} from "core-app/modules/modal/modal.service";
-import { FormlyFieldConfig } from "@ngx-formly/core";
import {ProjectFormAttributeGroups} from "core-app/modules/projects/form-helpers/form-attribute-groups";
export interface ProjectTemplateOption {
@@ -22,7 +21,8 @@ export interface ProjectTemplateOption {
@Component({
selector: 'op-new-project',
- templateUrl: './new-project.component.html'
+ templateUrl: './new-project.component.html',
+ styleUrls: ['./new-project.component.sass'],
})
export class NewProjectComponent extends UntilDestroyedMixin implements OnInit {
resourcePath:string;
@@ -33,6 +33,7 @@ export class NewProjectComponent extends UntilDestroyedMixin implements OnInit {
formUrl:string;
text = {
use_template: this.I18n.t('js.project.use_template'),
+ no_template_selected: this.I18n.t('js.project.no_template_selected'),
advancedSettingsLabel: this.I18n.t("js.forms.advanced_settings"),
};