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

Relocate copy options to top of create/copy pages

Alexander Brandon Coles40ccf94f5402
diff --git a/app/components/projects/copy_form_component.html.erb b/app/components/projects/copy_form_component.html.erb
index 421806db994..4011da0064b 100644
--- a/app/components/projects/copy_form_component.html.erb
+++ b/app/components/projects/copy_form_component.html.erb
@@ -31,6 +31,12 @@ See COPYRIGHT and LICENSE files for more details.
component_wrapper do
settings_primer_form_with(model: target_project, url: copy_project_path(source_project), method: :post) do |f|
flex_layout do |container|
+ container.with_row(mb: 3) do
+ render(Primer::Box.new(border: true, border_radius: 2, bg: :inset, p: 3)) do
+ render(Projects::CopyForm.new(f, copy_options:))
+ end
+ end
+
container.with_row(mb: 3) do
render(
Primer::Forms::FormList.new(
@@ -41,12 +47,6 @@ See COPYRIGHT and LICENSE files for more details.
)
end
- container.with_row(mb: 3) do
- render(Primer::Box.new(border: true, border_radius: 2, bg: :inset, p: 3)) do
- render(Projects::CopyForm.new(f, copy_options:))
- end
- end
-
container.with_row(mb: 3) do
render Projects::SubmitOrCancel.new(f, submit_options: { label: I18n.t(:button_copy) })
end
diff --git a/app/components/projects/new_component.html.erb b/app/components/projects/new_component.html.erb
index b8ad0548587..2476f81e135 100644
--- a/app/components/projects/new_component.html.erb
+++ b/app/components/projects/new_component.html.erb
@@ -38,16 +38,6 @@ See COPYRIGHT and LICENSE files for more details.
) do
settings_primer_form_with(model: project) do |f|
flex_layout do |container|
- container.with_row(mb: 3) do
- render(
- Primer::Forms::FormList.new(
- Projects::Settings::NameForm.new(f),
- Projects::Settings::RelationsForm.new(f),
- Projects::Settings::CustomFieldsForm.new(f)
- )
- )
- end
-
if template
container.with_row(mb: 3) do
render(Primer::Box.new(border: true, border_radius: 2, bg: :inset, p: 3)) do
@@ -58,6 +48,16 @@ See COPYRIGHT and LICENSE files for more details.
end
end
+ container.with_row(mb: 3) do
+ render(
+ Primer::Forms::FormList.new(
+ Projects::Settings::NameForm.new(f),
+ Projects::Settings::RelationsForm.new(f),
+ Projects::Settings::CustomFieldsForm.new(f)
+ )
+ )
+ end
+
container.with_row(mb: 3) do
render Projects::SubmitOrCancel.new(f)
end
diff --git a/app/components/projects/template_select_component.html.erb b/app/components/projects/template_select_component.html.erb
index 028d3704558..5e2736ee5cd 100644
--- a/app/components/projects/template_select_component.html.erb
+++ b/app/components/projects/template_select_component.html.erb
@@ -44,12 +44,7 @@ See COPYRIGHT and LICENSE files for more details.
border_radius: 2,
bg: :inset,
my: 3,
- p: 3,
- data: {
- controller: "highlight-when-value-selected",
- highlight_when_value_selected_highlight_class: resolve_css_classes(bg: :accent),
- highlight_when_value_selected_target: "content"
- }
+ p: 3
)
) do
render Projects::TemplateAutocompleter.new(f, template_id:, parent_id:)
diff --git a/app/components/projects/template_select_component.rb b/app/components/projects/template_select_component.rb
index 389bb9d9349..27d4ed96893 100644
--- a/app/components/projects/template_select_component.rb
+++ b/app/components/projects/template_select_component.rb
@@ -36,10 +36,6 @@ module Projects
options :template, :parent
- def resolve_css_classes(**)
- Primer::Classify.(**)[:class]
- end
-
private
def template_id = template&.id
diff --git a/app/forms/projects/template_autocompleter.rb b/app/forms/projects/template_autocompleter.rb
index 0c1d5d41083..62f365542ae 100644
--- a/app/forms/projects/template_autocompleter.rb
+++ b/app/forms/projects/template_autocompleter.rb
@@ -49,7 +49,7 @@ module Projects
{ name: "templated", operator: "=", values: ["t"] }
],
data: {
- action: "change->highlight-when-value-selected#itemSelected change->auto-submit#submit",
+ action: "change->auto-submit#submit",
"qa-field-name": "use_template"
}
}
diff --git a/spec/forms/projects/template_autocompleter_spec.rb b/spec/forms/projects/template_autocompleter_spec.rb
index 8f6fa30aac5..04c6a596fb5 100644
--- a/spec/forms/projects/template_autocompleter_spec.rb
+++ b/spec/forms/projects/template_autocompleter_spec.rb
@@ -55,7 +55,6 @@ RSpec.describe Projects::TemplateAutocompleter, type: :forms do
it "connects Stimulus controller actions" do
expect(page).to have_element "opce-project-autocompleter", "data-input-name": "\"template_id\"" do |element|
- expect(element["data-action"]).to include "change->highlight-when-value-selected#itemSelected"
expect(element["data-action"]).to include "change->auto-submit#submit"
end
end