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
[#64347] move details form to `app/forms`
Tobias Dillmannee09c0e0c9c9
diff --git a/app/components/admin/custom_fields/calculated_values/details_component.html.erb b/app/components/admin/custom_fields/calculated_values/details_component.html.erbindex 6bdceda3369..00b49b65975 100644--- a/app/components/admin/custom_fields/calculated_values/details_component.html.erb+++ b/app/components/admin/custom_fields/calculated_values/details_component.html.erb@@ -41,7 +41,7 @@ See COPYRIGHT and LICENSE files for more details.id: "custom_field_form",url: form_url,method: form_method- ) { |form| render Admin::CustomFields::CalculatedValues::DetailsForm.new(form) }+ ) { |form| render CustomFields::CalculatedValues::DetailsForm.new(form) }endendenddiff --git a/app/components/admin/custom_fields/calculated_values/details_form.rb b/app/components/admin/custom_fields/calculated_values/details_form.rbdeleted file mode 100644index 4ea618de393..00000000000--- a/app/components/admin/custom_fields/calculated_values/details_form.rb+++ /dev/null@@ -1,78 +0,0 @@-# frozen_string_literal: true--#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2013 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See COPYRIGHT and LICENSE files for more details.-#++--module Admin::CustomFields::CalculatedValues- class DetailsForm < ApplicationForm- form do |details_form|- if model.new_record?- details_form.hidden(name: :field_format)- details_form.hidden(name: :type, scope_name_to_model: false)- end-- details_form.text_field(- name: :name,- label: I18n.t(:label_name),- required: true- )-- details_form.select_list(- name: :custom_field_section_id,- label: I18n.t("activerecord.attributes.project_custom_field.custom_field_section"),- required: true- ) do |li|- ProjectCustomFieldSection.find_each do |cs|- li.option(value: cs.id, label: cs.name)- end- end-- details_form.text_field(- name: :formula,- value: model.formula_string,- label: I18n.t(:label_formula),- required: true,- caption: I18n.t("custom_fields.instructions.formula")- )-- details_form.check_box(- name: :is_required,- label: I18n.t("activerecord.attributes.project_custom_field.is_required"),- caption: I18n.t("custom_fields.instructions.is_required_for_project")- )-- details_form.check_box(- name: :admin_only,- label: I18n.t("activerecord.attributes.custom_field.admin_only"),- caption: I18n.t("custom_fields.instructions.admin_only")- )-- details_form.submit(name: :submit, label: I18n.t(:button_save), scheme: :primary)- end- end-enddiff --git a/app/forms/custom_fields/calculated_values/details_form.rb b/app/forms/custom_fields/calculated_values/details_form.rbnew file mode 100644index 00000000000..3bb8fd62f79--- /dev/null+++ b/app/forms/custom_fields/calculated_values/details_form.rb@@ -0,0 +1,80 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module CustomFields+ module CalculatedValues+ class DetailsForm < ApplicationForm+ form do |details_form|+ if model.new_record?+ details_form.hidden(name: :field_format)+ details_form.hidden(name: :type, scope_name_to_model: false)+ end++ details_form.text_field(+ name: :name,+ label: I18n.t(:label_name),+ required: true+ )++ details_form.select_list(+ name: :custom_field_section_id,+ label: I18n.t("activerecord.attributes.project_custom_field.custom_field_section"),+ required: true+ ) do |li|+ ProjectCustomFieldSection.find_each do |cs|+ li.option(value: cs.id, label: cs.name)+ end+ end++ details_form.text_field(+ name: :formula,+ value: model.formula_string,+ label: I18n.t(:label_formula),+ required: true,+ caption: I18n.t("custom_fields.instructions.formula")+ )++ details_form.check_box(+ name: :is_required,+ label: I18n.t("activerecord.attributes.project_custom_field.is_required"),+ caption: I18n.t("custom_fields.instructions.is_required_for_project")+ )++ details_form.check_box(+ name: :admin_only,+ label: I18n.t("activerecord.attributes.custom_field.admin_only"),+ caption: I18n.t("custom_fields.instructions.admin_only")+ )++ details_form.submit(name: :submit, label: I18n.t(:button_save), scheme: :primary)+ end+ end+ end+end