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

Show two month in the combined Datefield modal next to each other and make the input fields clearable individually

Henriette Darge4de5450ea934
diff --git a/frontend/src/app/components/datepicker/datepicker.modal.html b/frontend/src/app/components/datepicker/datepicker.modal.html
index 2070b9bd568..e6fe38c8266 100644
--- a/frontend/src/app/components/datepicker/datepicker.modal.html
+++ b/frontend/src/app/components/datepicker/datepicker.modal.html
@@ -5,7 +5,7 @@
tabindex="0">
<div class="op-modal--modal-body">
<form class="form -vertical">
- <div class="grid-block">
+ <div class="datepicker-modal--dates-container">
<ng-container *ngIf="singleDate">
<div class="form--field">
<label class="form--label"
@@ -21,6 +21,11 @@
(ngModelChange)="updateDate('date', $event)"
(click)="datepickerHelper.setCurrentActivatedField('date')">
</div>
+ <a class="form--field-inline-action"
+ [title]="text.clear"
+ (click)="clear('date')">
+ <span class="icon2 icon-small icon-cancel"></span>
+ </a>
</div>
</div>
</ng-container>
@@ -40,6 +45,11 @@
(ngModelChange)="updateDate('start', $event)"
(click)="datepickerHelper.setCurrentActivatedField('start')">
</div>
+ <a class="form--field-inline-action"
+ [title]="text.clear"
+ (click)="clear('start')">
+ <span class="icon2 icon-small icon-cancel"></span>
+ </a>
</div>
</div>
<div class="form--field">
@@ -56,26 +66,28 @@
(ngModelChange)="updateDate('end', $event)"
(click)="datepickerHelper.setCurrentActivatedField('end')">
</div>
+ <a class="form--field-inline-action"
+ [title]="text.clear"
+ (click)="clear('end')">
+ <span class="icon2 icon-small icon-cancel"></span>
+ </a>
</div>
</div>
</ng-container>
-
- <a (click)="clear()"
- class="datepicker-modal--action"
- [textContent]="text.clear">
- </a>
- </div>
- <div class="form--field">
- <label class="form--label-with-check-box">
- <div class="form--check-box-container">
- <input type="checkbox"
- name="scheduling"
- class="form--check-box datepicker-modal--scheduling-action"
- [ngModel]="scheduleManually"
- (ngModelChange)="changeSchedulingMode()">
+ <div class="form--field datepicker-modal--scheduling-action-container">
+ <div class="form--field-container">
+ <label class="form--label-with-check-box">
+ <div class="form--check-box-container">
+ <input type="checkbox"
+ name="scheduling"
+ class="form--check-box datepicker-modal--scheduling-action"
+ [ngModel]="scheduleManually"
+ (ngModelChange)="changeSchedulingMode()">
+ </div>
+ {{ text.manualScheduling }}
+ </label>
</div>
- {{ text.manualScheduling }}
- </label>
+ </div>
</div>
</form>
diff --git a/frontend/src/app/components/datepicker/datepicker.modal.sass b/frontend/src/app/components/datepicker/datepicker.modal.sass
index 2e619d28e70..c1f81cf53e2 100644
--- a/frontend/src/app/components/datepicker/datepicker.modal.sass
+++ b/frontend/src/app/components/datepicker/datepicker.modal.sass
@@ -11,6 +11,16 @@
.grid-block
align-items: center
+.datepicker-modal--dates-container
+ display: grid
+ grid-template-columns: 170px 1fr auto
+
+ .datepicker-modal--scheduling-action-container
+ margin-top: 28px
+
+ .form--label-with-check-box
+ padding: 0
+
.datepicker-modal--actions-container
display: grid
grid-template-columns: auto auto
@@ -24,3 +34,9 @@
&.-current,
&.-current:hover
outline: 2px solid var(--primary-color)
+
+.form--field-inline-action
+ .icon-small:before
+ vertical-align: text-bottom
+ &:hover, &:focus
+ text-decoration: none
diff --git a/frontend/src/app/components/datepicker/datepicker.modal.ts b/frontend/src/app/components/datepicker/datepicker.modal.ts
index 0b3ffd83f56..e5078bacf80 100644
--- a/frontend/src/app/components/datepicker/datepicker.modal.ts
+++ b/frontend/src/app/components/datepicker/datepicker.modal.ts
@@ -65,7 +65,7 @@ export class DatePickerModal extends OpModalComponent implements AfterViewInit {
text = {
save: this.I18n.t('js.button_save'),
cancel: this.I18n.t('js.button_cancel'),
- clear: this.I18n.t('js.modals.button_clear_all'),
+ clear: this.I18n.t('js.button_clear'),
manualScheduling: this.I18n.t('js.scheduling.manual'),
date: this.I18n.t('js.work_packages.properties.date'),
startDate: this.I18n.t('js.work_packages.properties.startDate'),
@@ -140,14 +140,9 @@ export class DatePickerModal extends OpModalComponent implements AfterViewInit {
this.closeMe();
}
- clear():void {
- this.dates = {
- date: '',
- start: '',
- end: ''
- };
-
- this.datePickerInstance.clear();
+ clear(key:DateKeys):void {
+ this.dates[key] = '';
+ this.setDatesToDatepicker();
}
updateDate(key:DateKeys, val:string) {
@@ -172,6 +167,7 @@ export class DatePickerModal extends OpModalComponent implements AfterViewInit {
this.singleDate ? this.dates.date : [this.dates.start, this.dates.end],
{
mode: this.singleDate ? 'single' : 'multiple',
+ showMonths: 2,
inline: true,
onChange: (dates:Date[]) => {
this.onDatePickerChange(dates);