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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
remove format toggle from custom field create form
ulferts146fd6866c78
diff --git a/app/views/admin/settings/project_custom_fields/edit.html.erb b/app/views/admin/settings/project_custom_fields/edit.html.erbindex 3d2b785876b..02678f1ccdb 100644--- a/app/views/admin/settings/project_custom_fields/edit.html.erb+++ b/app/views/admin/settings/project_custom_fields/edit.html.erb@@ -41,6 +41,7 @@ See COPYRIGHT and LICENSE files for more details.<%= error_messages_for "custom_field" %><% content_controller "admin--custom-fields",+ "admin--custom-fields-format-value": @custom_field.field_format,"admin--custom-fields-format-config-value": OpenProject::CustomFieldFormatDependent.stimulus_config %><%= labelled_tabular_form_for @custom_field, as: :custom_field,diff --git a/app/views/admin/settings/project_custom_fields/new.html.erb b/app/views/admin/settings/project_custom_fields/new.html.erbindex 520aa58a272..565857a63a9 100644--- a/app/views/admin/settings/project_custom_fields/new.html.erb+++ b/app/views/admin/settings/project_custom_fields/new.html.erb@@ -34,6 +34,7 @@ See COPYRIGHT and LICENSE files for more details.<%= error_messages_for "custom_field" %><% content_controller "admin--custom-fields",+ "admin--custom-fields-format-value": @custom_field.field_format,"admin--custom-fields-format-config-value": OpenProject::CustomFieldFormatDependent.stimulus_config %><%= labelled_tabular_form_for @custom_field, as: :custom_field,diff --git a/app/views/custom_fields/_form.html.erb b/app/views/custom_fields/_form.html.erbindex 933dbd6de5a..e21ff4ac0dd 100644--- a/app/views/custom_fields/_form.html.erb+++ b/app/views/custom_fields/_form.html.erb@@ -47,14 +47,6 @@ See COPYRIGHT and LICENSE files for more details.</div><% end %><div class="form--field">- <%= f.select :field_format,- custom_field_formats_for_select(@custom_field),- { container_class: "-slim" },- disabled: !@custom_field.new_record?,- data: {- action: "admin--custom-fields#formatChanged",- "admin--custom-fields-target": "format"- } %><div class="form--field-extra-actions" <%= format_dependent.attributes(:enterpriseBanner) %>><%=render(EnterpriseEdition::BannerComponent.new(:custom_field_hierarchies, mt: 2))diff --git a/app/views/custom_fields/edit.html.erb b/app/views/custom_fields/edit.html.erbindex e8d5788a06d..50680dbae1d 100644--- a/app/views/custom_fields/edit.html.erb+++ b/app/views/custom_fields/edit.html.erb@@ -31,19 +31,20 @@ See COPYRIGHT and LICENSE files for more details.<%= render(Admin::CustomFields::EditFormHeaderComponent.new(custom_field: @custom_field, selected: :edit)) %>-<%= error_messages_for 'custom_field' %>+<%= error_messages_for "custom_field" %><% content_controller "admin--custom-fields",- 'admin--custom-fields-format-config-value': OpenProject::CustomFieldFormatDependent.stimulus_config-%>+ "admin--custom-fields-format-config-value": OpenProject::CustomFieldFormatDependent.stimulus_config,+ "admin--custom-fields-format-value": @custom_field.field_format %><% if @custom_field.field_format_hierarchy? %><%= render CustomFields::DetailsComponent.new(@custom_field) %><% else %>- <%= labelled_tabular_form_for @custom_field, as: :custom_field,+ <%= labelled_tabular_form_for @custom_field,+ as: :custom_field,url: custom_field_path(@custom_field),- html: { method: :put, id: 'custom_field_form' } do |f| %>- <%= render partial: 'form', locals: { f: f } %>- <%= styled_button_tag t(:button_save), class: '-primary -with-icon icon-checkmark' %>+ html: { method: :put, id: "custom_field_form" } do |f| %>+ <%= render partial: "form", locals: { f: f } %>+ <%= styled_button_tag t(:button_save), class: "-primary -with-icon icon-checkmark" %><% end %><% end %>diff --git a/app/views/custom_fields/new.html.erb b/app/views/custom_fields/new.html.erbindex 4f178ed487d..f1bd20b59ad 100644--- a/app/views/custom_fields/new.html.erb+++ b/app/views/custom_fields/new.html.erb@@ -45,6 +45,7 @@ See COPYRIGHT and LICENSE files for more details.<% content_controller "admin--custom-fields","admin--custom-fields-format-config-value": OpenProject::CustomFieldFormatDependent.stimulus_config,+ "admin--custom-fields-format-value": @custom_field.field_format,"admin--custom-fields-hierarchy-enabled-value": EnterpriseToken.allows_to?(:custom_field_hierarchies) %><%= labelled_tabular_form_for @custom_field, as: :custom_field,diff --git a/frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts b/frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.tsindex 06b8ac05944..4ae929c6518 100644--- a/frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/admin/custom-fields.controller.ts@@ -56,9 +56,11 @@ export default class CustomFieldsController extends Controller {static values = {formatConfig: Array,hierarchyEnabled: Boolean,+ format: String,};declare readonly formatConfigValue:[string, string, string[]][];+ declare readonly formatValue:string;declare readonly hierarchyEnabledValue:boolean;declare readonly formatTarget:HTMLInputElement;@@ -88,11 +90,7 @@ export default class CustomFieldsController extends Controller {this.setupDragAndDrop();}- this.formatChanged();- }-- formatChanged() {- this.toggleFormat(this.formatTarget.value);+ this.adaptInputsToFormat(this.formatValue);}moveRowUp(event:{ target:HTMLElement }) {@@ -250,7 +248,7 @@ export default class CustomFieldsController extends Controller {});}- private toggleFormat(format:string) {+ private adaptInputsToFormat(format:string) {if (this.hasSubmitButtonTarget) {this.submitButtonTarget.disabled = format === 'hierarchy' && !this.hierarchyEnabledValue;}