From 5d40bf04cf951e7b0e929f57187551fe4dedb75e Mon Sep 17 00:00:00 2001 From: Meghan Chua <17057809+malchua@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:57:30 -0600 Subject: [PATCH] Set user namespace as default for new projects without a parent group --- app/views/projects/_project_namespace_fields.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/projects/_project_namespace_fields.erb b/app/views/projects/_project_namespace_fields.erb index 0f53126259..4648e20b34 100644 --- a/app/views/projects/_project_namespace_fields.erb +++ b/app/views/projects/_project_namespace_fields.erb @@ -16,7 +16,10 @@
<%= builder.label :parent_id %>
- <%= viral_prefixed_select2(form: builder, name: :parent_id, selected_value: params[:group_id], placeholder: t(:"projects.new.select_namespace")) do |select| %> + <% params.has_key?(:group_id) ? + selected_value = params[:group_id] : + selected_value = current_user.namespace.id %> + <%= viral_prefixed_select2(form: builder, name: :parent_id, selected_value: , placeholder: t(:"projects.new.select_namespace")) do |select| %> <% authorized_namespaces.each do |namespace| %> <% select.with_option( primary: namespace.full_path,