Fix wording of ignore non working days

Also renames the field to match the backend, avoiding further confusion.

https://community.openproject.org/wp/41341
pull/11222/head
Oliver Günther 2 years ago
parent 56925df9ad
commit 59cfaf06a8
  1. 6
      config/locales/js-en.yml
  2. 4
      frontend/src/app/shared/components/datepicker/helpers/date-modal.helpers.ts
  3. 8
      frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html
  4. 28
      frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
  5. 8
      frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.html
  6. 26
      frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.ts
  7. 4
      spec/support/components/datepicker/work_package_datepicker.rb

@ -919,10 +919,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:
ignore_non_working_days:
title: 'Working days'
false: 'Working days only'
true: 'Include non-working days'
false: 'Work week'
true: 'Include weekends'
description_filter: "Filter"
description_enter_text: "Enter text"
description_options_hide: "Hide options"

@ -100,12 +100,12 @@ export function setDates(dates:DateOption|DateOption[], datePicker:DatePicker, e
export function onDayCreate(
dayElem:DayElement,
includeNonWorkingDays:boolean,
ignoreNonWorkingDays:boolean,
isNonWorkingDay:boolean,
minimalDate:Date|null|undefined,
isDayDisabled:boolean,
):void {
if (!includeNonWorkingDays && isNonWorkingDay) {
if (!ignoreNonWorkingDays && isNonWorkingDay) {
dayElem.classList.add('flatpickr-non-working-day');
}

@ -28,14 +28,14 @@
<div class="form--field">
<label class="form--label">
{{ text.includeNonWorkingDays.title }}
{{ text.ignoreNonWorkingDays.title }}
</label>
<div class="form--field-container">
<spot-toggle
[options]="includeNonWorkingDaysOptions"
[value]="includeNonWorkingDays"
[options]="ignoreNonWorkingDaysOptions"
[value]="ignoreNonWorkingDays"
[name]="'include-non-working-days'"
[(ngModel)]="includeNonWorkingDays"
[(ngModel)]="ignoreNonWorkingDays"
(ngModelChange)="changeNonWorkingDays()"
data-qa-selector="op-datepicker-modal--include-non-working-days"
></spot-toggle>

@ -139,10 +139,10 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
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'),
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'),
},
};
@ -151,15 +151,15 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
scheduleManually = false;
schedulingOptions = [
{ value: true, title: this.text.scheduling.manual },
{ value: false, title: this.text.scheduling.default },
{ value: true, title: this.text.scheduling.manual },
];
includeNonWorkingDays = false;
ignoreNonWorkingDays = false;
includeNonWorkingDaysOptions = [
{ value: true, title: this.text.includeNonWorkingDays.yes },
{ value: false, title: this.text.includeNonWorkingDays.no },
ignoreNonWorkingDaysOptions = [
{ value: false, title: this.text.ignoreNonWorkingDays.no },
{ value: true, title: this.text.ignoreNonWorkingDays.yes },
];
duration:number|null;
@ -243,7 +243,7 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
.forPayload({
...fieldsToUpdate,
lockVersion: this.changeset.value<string>('lockVersion'),
ignoreNonWorkingDays: this.includeNonWorkingDays,
ignoreNonWorkingDays: this.ignoreNonWorkingDays,
scheduleManually: this.scheduleManually,
})),
)
@ -262,7 +262,7 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
this.htmlId = `wp-datepicker-${locals.fieldName as string}`;
this.scheduleManually = !!this.changeset.value('scheduleManually');
this.includeNonWorkingDays = !!this.changeset.value('ignoreNonWorkingDays');
this.ignoreNonWorkingDays = !!this.changeset.value('ignoreNonWorkingDays');
this.setDurationDaysFromUpstream(this.changeset.value('duration'));
@ -313,7 +313,7 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
this.changeset.setValue('scheduleManually', this.scheduleManually);
// Apply include NWD
this.changeset.setValue('ignoreNonWorkingDays', this.includeNonWorkingDays);
this.changeset.setValue('ignoreNonWorkingDays', this.ignoreNonWorkingDays);
// Apply the dates if they could be changed
if (this.isSchedulable) {
@ -469,7 +469,7 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
onDayCreate: (dObj:Date[], dStr:string, fp:flatpickr.Instance, dayElem:DayElement) => {
onDayCreate(
dayElem,
this.includeNonWorkingDays,
this.ignoreNonWorkingDays,
this.weekdayService.isNonWorkingDay(dayElem.dateObj),
minimalDate,
this.isDayDisabled(dayElem, minimalDate),
@ -678,7 +678,7 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
const payload = form.payload as { startDate:string, dueDate:string, duration:string, ignoreNonWorkingDays:boolean };
this.dates.start = payload.startDate;
this.dates.end = payload.dueDate;
this.includeNonWorkingDays = payload.ignoreNonWorkingDays;
this.ignoreNonWorkingDays = payload.ignoreNonWorkingDays;
this.setDurationDaysFromUpstream(payload.duration);

@ -28,14 +28,14 @@
<div class="form--field">
<label class="form--label">
{{ text.includeNonWorkingDays.title }}
{{ text.ignoreNonWorkingDays.title }}
</label>
<div class="form--field-container">
<spot-toggle
[options]="includeNonWorkingDaysOptions"
[value]="includeNonWorkingDays"
[options]="ignoreNonWorkingDaysOptions"
[value]="ignoreNonWorkingDays"
[name]="'include-non-working-days'"
[(ngModel)]="includeNonWorkingDays"
[(ngModel)]="ignoreNonWorkingDays"
(ngModelChange)="changeNonWorkingDays()"
data-qa-selector="op-datepicker-modal--include-non-working-days"
></spot-toggle>

@ -108,10 +108,10 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV
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'),
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'),
},
};
@ -124,11 +124,11 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV
{ value: false, title: this.text.scheduling.default },
];
includeNonWorkingDays = false;
ignoreNonWorkingDays = false;
includeNonWorkingDaysOptions = [
{ value: true, title: this.text.includeNonWorkingDays.yes },
{ value: false, title: this.text.includeNonWorkingDays.no },
ignoreNonWorkingDaysOptions = [
{ value: true, title: this.text.ignoreNonWorkingDays.yes },
{ value: false, title: this.text.ignoreNonWorkingDays.no },
];
htmlId = '';
@ -157,7 +157,7 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV
.forPayload({
date,
lockVersion: this.changeset.value<string>('lockVersion'),
ignoreNonWorkingDays: this.includeNonWorkingDays,
ignoreNonWorkingDays: this.ignoreNonWorkingDays,
})),
)
.subscribe((form) => this.updateDatesFromForm(form));
@ -174,7 +174,7 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV
this.changeset = locals.changeset as ResourceChangeset;
this.htmlId = `wp-datepicker-${locals.fieldName as string}`;
this.includeNonWorkingDays = !!this.changeset.value('ignoreNonWorkingDays');
this.ignoreNonWorkingDays = !!this.changeset.value('ignoreNonWorkingDays');
this.date = this.changeset.value('date');
}
@ -219,7 +219,7 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV
this.initializeDatepicker();
// If we're single date, update the date
if (!this.includeNonWorkingDays && this.date) {
if (!this.ignoreNonWorkingDays && this.date) {
// Resent the current start and end dates so duration can be calculated again.
this.dateUpdates$.next(this.date);
}
@ -295,7 +295,7 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV
onDayCreate: (dObj:Date[], dStr:string, fp:flatpickr.Instance, dayElem:DayElement) => {
onDayCreate(
dayElem,
this.includeNonWorkingDays,
this.ignoreNonWorkingDays,
this.datePickerInstance?.weekdaysService.isNonWorkingDay(dayElem.dateObj),
minimalDate,
this.dateModalScheduling.isDayDisabled(dayElem, minimalDate),
@ -326,7 +326,7 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV
const payload = form.payload as { date:string, ignoreNonWorkingDays:boolean };
this.date = payload.date;
this.includeNonWorkingDays = payload.ignoreNonWorkingDays;
this.ignoreNonWorkingDays = payload.ignoreNonWorkingDays;
const parsedDate = parseDate(payload.date) as Date;
this.enforceManualChangesToDatepicker(parsedDate);

@ -155,9 +155,9 @@ module Components
def ignore_non_working_days_option(val)
if val
'Include non-working days'
'Include weekends'
else
'Working days only'
'Work week'
end
end

Loading…
Cancel
Save