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

Fix switches behavior and labels in datepicker

Oliver Günther22a3e50ae394
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 13c701e8b5b..61302916e0b 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -818,9 +818,7 @@ en:
project_menu_details: "Details"
scheduling:
- title: 'Scheduling'
- manual: 'Manual'
- default: 'Default'
+ manual: 'Manual scheduling'
sort:
sorted_asc: 'Ascending sort applied, '
@@ -932,9 +930,7 @@ en:
click_on_show_relations_to_open_gantt: 'Click on "%{button_name}" for GANTT overview.'
show_relations: 'Show relations'
ignore_non_working_days:
- title: 'Working days'
- false: 'Work week'
- true: 'Include weekends'
+ title: 'Working days only'
description_filter: "Filter"
description_enter_text: "Enter text"
description_options_hide: "Hide options"
diff --git a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
index 95ac9911cba..50d04f7f760 100644
--- a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
+++ b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
@@ -137,16 +137,6 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
placeholder: this.I18n.t('js.placeholders.default'),
today: this.I18n.t('js.label_today'),
days: (count:number):string => this.I18n.t('js.units.day', { count }),
- scheduling: {
- title: this.I18n.t('js.scheduling.title'),
- manual: this.I18n.t('js.scheduling.manual'),
- default: this.I18n.t('js.scheduling.default'),
- },
- ignoreNonWorkingDays: {
- title: this.I18n.t('js.work_packages.datepicker_modal.ignore_non_working_days.title'),
- yes: this.I18n.t('js.work_packages.datepicker_modal.ignore_non_working_days.true'),
- no: this.I18n.t('js.work_packages.datepicker_modal.ignore_non_working_days.false'),
- },
};
onDataUpdated = new EventEmitter<string>();
diff --git a/frontend/src/app/shared/components/datepicker/scheduling-mode/datepicker-scheduling-toggle.component.html b/frontend/src/app/shared/components/datepicker/scheduling-mode/datepicker-scheduling-toggle.component.html
index 8f417e95f45..d1ef534ce43 100644
--- a/frontend/src/app/shared/components/datepicker/scheduling-mode/datepicker-scheduling-toggle.component.html
+++ b/frontend/src/app/shared/components/datepicker/scheduling-mode/datepicker-scheduling-toggle.component.html
@@ -1,4 +1,5 @@
<spot-selector-field
+ [reverseLabel]="true"
[label]="text.scheduling.title"
>
<spot-switch
diff --git a/frontend/src/app/shared/components/datepicker/scheduling-mode/datepicker-scheduling-toggle.component.ts b/frontend/src/app/shared/components/datepicker/scheduling-mode/datepicker-scheduling-toggle.component.ts
index 36868c92c10..816ca57b005 100644
--- a/frontend/src/app/shared/components/datepicker/scheduling-mode/datepicker-scheduling-toggle.component.ts
+++ b/frontend/src/app/shared/components/datepicker/scheduling-mode/datepicker-scheduling-toggle.component.ts
@@ -24,19 +24,12 @@ import {
export class DatepickerSchedulingToggleComponent implements ControlValueAccessor {
text = {
scheduling: {
- title: this.I18n.t('js.scheduling.title'),
- manual: this.I18n.t('js.scheduling.manual'),
- default: this.I18n.t('js.scheduling.default'),
+ title: this.I18n.t('js.scheduling.manual')
},
};
@Input() scheduleManually:boolean;
- schedulingOptions = [
- { value: false, title: this.text.scheduling.default },
- { value: true, title: this.text.scheduling.manual },
- ];
-
constructor(
private I18n:I18nService,
private cdRef:ChangeDetectorRef,
diff --git a/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.ts b/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.ts
index 87297b07655..ff6758db42f 100644
--- a/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.ts
+++ b/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.ts
@@ -103,27 +103,12 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV
date: this.I18n.t('js.work_packages.properties.date'),
placeholder: this.I18n.t('js.placeholders.default'),
today: this.I18n.t('js.label_today'),
- scheduling: {
- title: this.I18n.t('js.scheduling.title'),
- manual: this.I18n.t('js.scheduling.manual'),
- default: this.I18n.t('js.scheduling.default'),
- },
- ignoreNonWorkingDays: {
- title: this.I18n.t('js.work_packages.datepicker_modal.ignore_non_working_days.title'),
- yes: this.I18n.t('js.work_packages.datepicker_modal.ignore_non_working_days.true'),
- no: this.I18n.t('js.work_packages.datepicker_modal.ignore_non_working_days.false'),
- },
};
onDataUpdated = new EventEmitter<string>();
scheduleManually = false;
- schedulingOptions = [
- { value: true, title: this.text.scheduling.manual },
- { value: false, title: this.text.scheduling.default },
- ];
-
ignoreNonWorkingDays = false;
htmlId = '';
diff --git a/frontend/src/app/shared/components/datepicker/toggle/datepicker-working-days-toggle.component.html b/frontend/src/app/shared/components/datepicker/toggle/datepicker-working-days-toggle.component.html
index 9278d7b773e..1cffa14665a 100644
--- a/frontend/src/app/shared/components/datepicker/toggle/datepicker-working-days-toggle.component.html
+++ b/frontend/src/app/shared/components/datepicker/toggle/datepicker-working-days-toggle.component.html
@@ -1,11 +1,12 @@
<spot-selector-field
+ [reverseLabel]="true"
[label]="text.ignoreNonWorkingDays.title"
>
<spot-switch
slot="input"
name="include-non-working-days"
[disabled]="disabled"
- [ngModel]="ignoreNonWorkingDays"
+ [ngModel]="!ignoreNonWorkingDays"
(ngModelChange)="onToggle($event)"
data-qa-selector="op-datepicker-modal--include-non-working-days"
></spot-switch>
diff --git a/frontend/src/app/shared/components/datepicker/toggle/datepicker-working-days-toggle.component.ts b/frontend/src/app/shared/components/datepicker/toggle/datepicker-working-days-toggle.component.ts
index e0c33b0311f..5dd6c23324e 100644
--- a/frontend/src/app/shared/components/datepicker/toggle/datepicker-working-days-toggle.component.ts
+++ b/frontend/src/app/shared/components/datepicker/toggle/datepicker-working-days-toggle.component.ts
@@ -29,16 +29,9 @@ export class DatepickerWorkingDaysToggleComponent implements ControlValueAccesso
text = {
ignoreNonWorkingDays: {
title: this.I18n.t('js.work_packages.datepicker_modal.ignore_non_working_days.title'),
- yes: this.I18n.t('js.work_packages.datepicker_modal.ignore_non_working_days.true'),
- no: this.I18n.t('js.work_packages.datepicker_modal.ignore_non_working_days.false'),
},
};
- ignoreNonWorkingDaysOptions = [
- { value: false, title: this.text.ignoreNonWorkingDays.no },
- { value: true, title: this.text.ignoreNonWorkingDays.yes },
- ];
-
constructor(
private I18n:I18nService,
private cdRef:ChangeDetectorRef,
@@ -63,7 +56,7 @@ export class DatepickerWorkingDaysToggleComponent implements ControlValueAccesso
}
writeValue(val:boolean):void {
- this.ignoreNonWorkingDays = val;
+ this.ignoreNonWorkingDays = !val;
this.cdRef.markForCheck();
}
}
diff --git a/frontend/src/app/spot/components/selector-field/selector-field.component.html b/frontend/src/app/spot/components/selector-field/selector-field.component.html
index c7b9c709294..8b7dfd8188c 100644
--- a/frontend/src/app/spot/components/selector-field/selector-field.component.html
+++ b/frontend/src/app/spot/components/selector-field/selector-field.component.html
@@ -5,6 +5,7 @@
>
<div
class="spot-form-field--input spot-selector-field--input"
+ [ngClass]="{ 'spot-selector-field--input_reversed': reverseLabel }"
[attr.aria-describedby]="describedByID"
>
<ng-content select="[slot=input]"></ng-content>
diff --git a/frontend/src/app/spot/styles/sass/components/selector-field.sass b/frontend/src/app/spot/styles/sass/components/selector-field.sass
index c4987ca544c..a3f8e9ba83b 100644
--- a/frontend/src/app/spot/styles/sass/components/selector-field.sass
+++ b/frontend/src/app/spot/styles/sass/components/selector-field.sass
@@ -4,12 +4,10 @@
&--label-wrap
display: grid
grid-template-columns: auto 1fr
- grid-template-rows: auto auto
grid-template-areas: "input label" "description description"
&_reversed
grid-template-areas: "label input" "description description"
- grid-template-columns: 1fr auto
&--input
grid-area: input
@@ -19,6 +17,10 @@
margin-top: 0.1rem
display: flex
+ &_reversed
+ padding-left: 1rem
+ padding-right: 0
+
&--label
grid-area: label
margin-bottom: 0