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

Switch from checkboxes to toggles as specified.

Henriette Darge0e28aca13c6e
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 93cd9acedf7..6ce3c8056fb 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -804,8 +804,9 @@ en:
project_menu_details: "Details"
scheduling:
- manual: 'Manual scheduling'
- automatic: 'Automatic scheduling'
+ title: 'Scheduling'
+ manual: 'Manual'
+ default: 'Default'
sort:
sorted_asc: 'Ascending sort applied, '
@@ -917,7 +918,10 @@ en:
changing_dates_affects_follow_relations: "Changing these dates will affect dates of related work packages."
click_on_show_relations_to_open_gantt: 'Click on "%{button_name}" for GANTT overview.'
show_relations: 'Show relations'
- include_non_working_days: 'Include non-working days'
+ include_non_working_days:
+ title: 'Working days'
+ false: 'Working days only'
+ true: 'Include non-working days'
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.html b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html
index ed29e896329..21e2785b06f 100644
--- a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html
+++ b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html
@@ -7,20 +7,39 @@
(submit)="save($event)"
>
<op-datepicker-banner [scheduleManually]="scheduleManually"></op-datepicker-banner>
+
<div class="op-modal--body form -vertical">
- <div class="form--field op-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 op-datepicker-modal--scheduling-action"
- data-qa-selector="op-datepicker-modal--scheduling-action"
- [ngModel]="scheduleManually"
- (ngModelChange)="changeSchedulingMode()">
- </div>
- {{ text.manualScheduling }}
+ <div class="op-datepicker-modal--toggle-actions-container">
+ <div class="form--field">
+ <label class="form--label">
+ {{text.scheduling.title}}
+ </label>
+ <div class="form--field-container">
+ <spot-toggle
+ [options]="schedulingOptions"
+ [value]="scheduleManually"
+ [name]="'scheduling'"
+ [(ngModel)]="scheduleManually"
+ (ngModelChange)="changeSchedulingMode()"
+ data-qa-selector="op-datepicker-modal--scheduling-action"
+ ></spot-toggle>
+ </div>
+ </div>
+
+ <div class="form--field">
+ <label class="form--label">
+ {{ text.includeNonWorkingDays.title }}
</label>
+ <div class="form--field-container">
+ <spot-toggle
+ [options]="includeNonWorkingDaysOptions"
+ [value]="includeNonWorkingDays"
+ [name]="'include-non-working-days'"
+ [(ngModel)]="includeNonWorkingDays"
+ (ngModelChange)="changeNonWorkingDays()"
+ data-qa-selector="op-datepicker-modal--include-non-working-days"
+ ></spot-toggle>
+ </div>
</div>
</div>
@@ -109,38 +128,17 @@
hidden>
</div>
- <div class="op-modal--footer op-modal--footer_split-actions">
- <div>
- <div class="form--field -no-margin op-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="include-non-working-days"
- class="form--check-box"
- data-qa-selector="op-datepicker-modal--include-non-working-days"
- [ngModel]="includeNonWorkingDays"
- (ngModelChange)="changeNonWorkingDays()">
- </div>
- {{ text.includeNonWorkingDays }}
- </label>
- </div>
- </div>
- </div>
-
- <div>
- <button
- (click)="cancel()"
- class="op-datepicker-modal--action button"
- data-qa-selector="op-datepicker-modal--action"
- [textContent]="text.cancel"
- ></button>
- <button
- class="op-datepicker-modal--action button -highlight"
- data-qa-selector="op-datepicker-modal--action"
- [textContent]="text.save"
- ></button>
- </div>
-
+ <div class="op-modal--footer">
+ <button
+ (click)="cancel()"
+ class="op-datepicker-modal--action button"
+ data-qa-selector="op-datepicker-modal--action"
+ [textContent]="text.cancel"
+ ></button>
+ <button
+ class="op-datepicker-modal--action button -highlight"
+ data-qa-selector="op-datepicker-modal--action"
+ [textContent]="text.save"
+ ></button>
</div>
</form>
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 bb14c7395bc..a53c270d7dc 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
@@ -113,22 +113,40 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
text = {
save: this.I18n.t('js.button_save'),
cancel: this.I18n.t('js.button_cancel'),
- manualScheduling: this.I18n.t('js.scheduling.manual'),
startDate: this.I18n.t('js.work_packages.properties.startDate'),
endDate: this.I18n.t('js.work_packages.properties.dueDate'),
duration: this.I18n.t('js.work_packages.properties.duration'),
- includeNonWorkingDays: this.I18n.t('js.work_packages.datepicker_modal.include_non_working_days'),
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'),
+ },
+ includeNonWorkingDays: {
+ title: this.I18n.t('js.work_packages.datepicker_modal.include_non_working_days.title'),
+ yes: this.I18n.t('js.work_packages.datepicker_modal.include_non_working_days.true'),
+ no: this.I18n.t('js.work_packages.datepicker_modal.include_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 },
+ ];
+
includeNonWorkingDays = false;
+ includeNonWorkingDaysOptions = [
+ { value: true, title: this.text.includeNonWorkingDays.yes },
+ { value: false, title: this.text.includeNonWorkingDays.no },
+ ];
+
duration:number;
displayedDuration:string;
@@ -251,13 +269,11 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
}
changeSchedulingMode():void {
- this.scheduleManually = !this.scheduleManually;
this.initializeDatepicker();
this.cdRef.detectChanges();
}
changeNonWorkingDays():void {
- this.includeNonWorkingDays = !this.includeNonWorkingDays;
this.initializeDatepicker();
// Resent the current start and end dates so duration can be calculated again.
diff --git a/frontend/src/app/shared/components/datepicker/services/date-modal-scheduling.service.ts b/frontend/src/app/shared/components/datepicker/services/date-modal-scheduling.service.ts
index 9f9f8fcb4d0..6744ba1e46b 100644
--- a/frontend/src/app/shared/components/datepicker/services/date-modal-scheduling.service.ts
+++ b/frontend/src/app/shared/components/datepicker/services/date-modal-scheduling.service.ts
@@ -47,10 +47,6 @@ export class DateModalSchedulingService {
readonly dateModalRelations:DateModalRelationsService,
) {}
- toggleSchedulingMode():void {
- this.scheduleManually = !this.scheduleManually;
- }
-
/**
* Returns whether the user can alter the dates of the work package.
*/
diff --git a/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.html b/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.html
index 650c9afc010..05d7d24be9d 100644
--- a/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.html
+++ b/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.html
@@ -7,20 +7,39 @@
(submit)="save($event)"
>
<op-datepicker-banner [scheduleManually]="scheduleManually"></op-datepicker-banner>
+
<div class="op-modal--body form -vertical">
- <div class="form--field op-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 op-datepicker-modal--scheduling-action"
- data-qa-selector="op-datepicker-modal--scheduling-action"
- [ngModel]="scheduleManually"
- (ngModelChange)="changeSchedulingMode()">
- </div>
- {{ text.manualScheduling }}
+ <div class="op-datepicker-modal--toggle-actions-container">
+ <div class="form--field">
+ <label class="form--label">
+ {{text.scheduling.title}}
+ </label>
+ <div class="form--field-container">
+ <spot-toggle
+ [options]="schedulingOptions"
+ [value]="scheduleManually"
+ [name]="'scheduling'"
+ [(ngModel)]="scheduleManually"
+ (ngModelChange)="changeSchedulingMode()"
+ data-qa-selector="op-datepicker-modal--scheduling-action"
+ ></spot-toggle>
+ </div>
+ </div>
+
+ <div class="form--field">
+ <label class="form--label">
+ {{ text.includeNonWorkingDays.title }}
</label>
+ <div class="form--field-container">
+ <spot-toggle
+ [options]="includeNonWorkingDaysOptions"
+ [value]="includeNonWorkingDays"
+ [name]="'include-non-working-days'"
+ [(ngModel)]="includeNonWorkingDays"
+ (ngModelChange)="changeNonWorkingDays()"
+ data-qa-selector="op-datepicker-modal--include-non-working-days"
+ ></spot-toggle>
+ </div>
</div>
</div>
@@ -54,38 +73,17 @@
hidden>
</div>
- <div class="op-modal--footer op-modal--footer_split-actions">
- <div>
- <div class="form--field -no-margin op-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="include-non-working-days"
- class="form--check-box"
- data-qa-selector="op-datepicker-modal--include-non-working-days"
- [ngModel]="includeNonWorkingDays"
- (ngModelChange)="changeNonWorkingDays()">
- </div>
- {{ text.includeNonWorkingDays }}
- </label>
- </div>
- </div>
- </div>
-
- <div>
- <button
- (click)="cancel()"
- class="op-datepicker-modal--action button"
- data-qa-selector="op-datepicker-modal--action"
- [textContent]="text.cancel"
- ></button>
- <button
- class="op-datepicker-modal--action button -highlight"
- data-qa-selector="op-datepicker-modal--action"
- [textContent]="text.save"
- ></button>
- </div>
-
+ <div class="op-modal--footer">
+ <button
+ (click)="cancel()"
+ class="op-datepicker-modal--action button"
+ data-qa-selector="op-datepicker-modal--action"
+ [textContent]="text.cancel"
+ ></button>
+ <button
+ class="op-datepicker-modal--action button -highlight"
+ data-qa-selector="op-datepicker-modal--action"
+ [textContent]="text.save"
+ ></button>
</div>
</form>
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 dd89f6055c3..dc4e64a6452 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
@@ -99,19 +99,37 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV
text = {
save: this.I18n.t('js.button_save'),
cancel: this.I18n.t('js.button_cancel'),
- manualScheduling: this.I18n.t('js.scheduling.manual'),
date: this.I18n.t('js.work_packages.properties.date'),
- includeNonWorkingDays: this.I18n.t('js.work_packages.datepicker_modal.include_non_working_days'),
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'),
+ },
+ includeNonWorkingDays: {
+ title: this.I18n.t('js.work_packages.datepicker_modal.include_non_working_days.title'),
+ yes: this.I18n.t('js.work_packages.datepicker_modal.include_non_working_days.true'),
+ no: this.I18n.t('js.work_packages.datepicker_modal.include_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 },
+ ];
+
includeNonWorkingDays = false;
+ includeNonWorkingDaysOptions = [
+ { value: true, title: this.text.includeNonWorkingDays.yes },
+ { value: false, title: this.text.includeNonWorkingDays.no },
+ ];
+
htmlId = '';
date:string|null = null;
@@ -192,13 +210,11 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV
}
changeSchedulingMode():void {
- this.dateModalScheduling.toggleSchedulingMode();
this.initializeDatepicker();
this.cdRef.detectChanges();
}
changeNonWorkingDays():void {
- this.includeNonWorkingDays = !this.includeNonWorkingDays;
this.initializeDatepicker();
// If we're single date, update the date
diff --git a/frontend/src/app/shared/components/datepicker/styles/datepicker.modal.sass b/frontend/src/app/shared/components/datepicker/styles/datepicker.modal.sass
index 7b9152a89d9..7286243155d 100644
--- a/frontend/src/app/shared/components/datepicker/styles/datepicker.modal.sass
+++ b/frontend/src/app/shared/components/datepicker/styles/datepicker.modal.sass
@@ -12,6 +12,11 @@
// to avoid overlapping
margin-bottom: 60px
+ &--toggle-actions-container
+ display: grid
+ grid-template-columns: auto 1fr
+ grid-column-gap: $spot-spacing-1
+
&--dates-container
display: grid
grid-template-columns: 1fr 1fr 150px