[#68856] Move template selection to separate page

This commit is contained in:
Alexander Brandon Coles
2025-11-17 00:29:18 -03:00
committed by Dombi Attila
parent 7943292180
commit eeb2af082d
5 changed files with 54 additions and 17 deletions
@@ -28,14 +28,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<%=
component_wrapper(
tag: "turbo-frame",
refresh: :morph,
data: {
turbo_action: :replace
},
target: "_top"
) do
component_wrapper(target: "_top") do
settings_primer_form_with(model: project) do |f|
flex_layout do |container|
if template
@@ -31,14 +31,14 @@ See COPYRIGHT and LICENSE files for more details.
component_wrapper do
settings_primer_form_with(
url: new_workspace_path,
method: :get,
data: {
turbo_frame: Projects::NewComponent.wrapper_key,
controller: "auto-submit",
auto_submit_delay_value: 0
}
method: :get
) do |f|
render Projects::TemplateSelectForm.new(f, template_id:, parent_id:, workspace_type: project.workspace_type, current_user:)
render(
Primer::Forms::FormList.new(
Projects::TemplateSelectForm.new(f, template_id:, parent_id:, workspace_type: project.workspace_type, current_user:),
Projects::StepForm.new(f, step: 2)
)
)
end
end
%>
+42
View File
@@ -0,0 +1,42 @@
# 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 Projects
class StepForm < ApplicationForm
extend Dry::Initializer[undefined: false]
option :step, default: -> { 1 }
form do |f|
f.hidden(name: :step, value: step, scope_name_to_model: false)
f.submit(name: :submit, label: I18n.t(:label_next), scheme: :primary)
end
end
end
@@ -49,7 +49,6 @@ module Projects
label: I18n.t("create_project.template_label"),
scope_name_to_model: false,
data: {
action: "change->auto-submit#submit",
qa_field_name: "use_template"
}
) do |group|
+4 -1
View File
@@ -34,6 +34,8 @@ See COPYRIGHT and LICENSE files for more details.
end
%>
<% case params.fetch(:step, 1).to_i %>
<% when 1 %>
<%=
render Projects::TemplateSelectComponent.new(
project: @new_project,
@@ -42,7 +44,7 @@ See COPYRIGHT and LICENSE files for more details.
current_user:
)
%>
<% when 2 %>
<%=
render Projects::NewComponent.new(
project: @new_project,
@@ -50,3 +52,4 @@ See COPYRIGHT and LICENSE files for more details.
copy_options: @copy_options
)
%>
<% end %>