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

Revert "Display the "Working days only" switch to projects date custom field"

Dombi Attila8ed79f7fa636
diff --git a/frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/date-input/date-input.component.html b/frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/date-input/date-input.component.html
index c21827e0676..db89510d581 100644
--- a/frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/date-input/date-input.component.html
+++ b/frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/date-input/date-input.component.html
@@ -3,5 +3,4 @@
[disabled]="to.disabled"
[formControl]="formControl"
[formlyAttributes]="field"
- [showIgnoreNonWorkingDays]="showIgnoreNonWorkingDays"
></op-single-date-picker>
diff --git a/frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/date-input/date-input.component.ts b/frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/date-input/date-input.component.ts
index e616cfd91e4..0f9cc3a5888 100644
--- a/frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/date-input/date-input.component.ts
+++ b/frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/date-input/date-input.component.ts
@@ -1,19 +1,9 @@
-import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
+import { Component } from '@angular/core';
import { FieldType } from '@ngx-formly/core';
@Component({
selector: 'op-date-input',
- changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './date-input.component.html',
styleUrls: ['./date-input.component.scss'],
})
-export class DateInputComponent extends FieldType implements OnInit {
- model:IOPFormModel;
-
- showIgnoreNonWorkingDays = false;
-
- ngOnInit():void {
- // Display the "Working days only" switch to projects date custom field only.
- this.showIgnoreNonWorkingDays = this.model?.id === 'projects' && this.key.toString().startsWith('customField');
- }
-}
+export class DateInputComponent extends FieldType {}
diff --git a/spec/features/projects/projects_custom_fields_spec.rb b/spec/features/projects/projects_custom_fields_spec.rb
index 45fa5f2b881..a0789e29b81 100644
--- a/spec/features/projects/projects_custom_fields_spec.rb
+++ b/spec/features/projects/projects_custom_fields_spec.rb
@@ -190,43 +190,6 @@ describe 'Projects custom fields', js: true do
end
end
- describe 'with date CF' do
- let!(:date_cf) do
- create(:date_project_custom_field, name: 'MyDate')
- end
- let(:date_field) { FormFields::InputFormField.new date_cf }
- let(:datepicker) { Components::Datepicker.new }
-
- it 'displays the date with the datepicker' do
- visit new_project_path
-
- name_field.set_value 'My project name'
- find('.op-fieldset--toggle', text: 'ADVANCED SETTINGS').click
-
- # Set the date
- date_field.click
- datepicker.expect_working_days_only_enabled
- datepicker.set_date Time.zone.tomorrow
-
- # Switching the working days toggle on-off-on should keep the current date selection
- datepicker.working_days_label.click.click
- datepicker.expect_current_date Time.zone.tomorrow
-
- datepicker.save!
-
- # Save project settings
- click_on 'Save'
-
- expect(page).to have_current_path /\/projects\/my-project-name\/?/
- project = Project.find_by(name: 'My project name')
- cv = project.custom_values.find_by(custom_field_id: date_cf.id).typed_value
- expect(cv).to eq Time.zone.tomorrow
-
- visit project_settings_general_path(project)
- date_field.expect_value Time.zone.tomorrow.iso8601
- end
- end
-
describe 'with boolean CF' do
let!(:custom_field) do
create(:bool_project_custom_field)
diff --git a/spec/support/components/datepicker/datepicker.rb b/spec/support/components/datepicker/datepicker.rb
index 4184d60bce0..624f97e323d 100644
--- a/spec/support/components/datepicker/datepicker.rb
+++ b/spec/support/components/datepicker/datepicker.rb
@@ -36,10 +36,6 @@ module Components
container.find(".flatpickr-calendar")
end
- def working_days_label
- container.find(:label, text: 'Working days only')
- end
-
##
# Clear all values
def clear!
@@ -141,12 +137,6 @@ module Components
}
end
- ##
- # Expect the date input value
- def expect_input(value)
- expect(container).to have_field('date', with: value)
- end
-
##
# Expect the current selection to match the
# given ISO601 date
@@ -156,7 +146,6 @@ module Components
expect_year(date.year)
expect_month(date.month)
expect_day(date.day)
- expect_input(date.iso8601)
end
##
diff --git a/spec/support/form_fields/input_form_field.rb b/spec/support/form_fields/input_form_field.rb
index a4894a5cab3..de2d25a4974 100644
--- a/spec/support/form_fields/input_form_field.rb
+++ b/spec/support/form_fields/input_form_field.rb
@@ -27,10 +27,6 @@ module FormFields
input_element.send_keys(*args)
end
- def click
- scroll_to_and_click(input_element)
- end
-
def input_element
field_container.find 'input'
end