diff options
author | Rémy Coutable <remy@rymai.me> | 2017-02-21 19:59:03 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-02-21 19:59:03 +0300 |
commit | 2d2ed828880f620238dc7ef5c9f75fb6e7fef59a (patch) | |
tree | ce99ede6c982502d6a909bc4ffab8ce3e2468822 /app | |
parent | 316a7312341fd2d359b44da3f386c3739c1bdb4d (diff) | |
parent | 3f7b7a3b0f2199c56b9f5acab07539610ae10c7c (diff) |
Merge branch '26879-fix-preselected-namespace-when-creating-project' into 'master'
Fix preselected namespace when creating a project
Closes #26879
See merge request !9389
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/namespaces_helper.rb | 4 | ||||
-rw-r--r-- | app/views/projects/new.html.haml | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb index 0676767d910..dc5ae8edbb2 100644 --- a/app/helpers/namespaces_helper.rb +++ b/app/helpers/namespaces_helper.rb @@ -1,4 +1,8 @@ module NamespacesHelper + def namespace_id_from(params) + params.dig(:project, :namespace_id) || params[:namespace_id] + end + def namespaces_options(selected = :current_user, display_path: false, extra_group: nil) groups = current_user.owned_groups + current_user.masters_groups diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index a07885537b9..2a98bba05ee 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -22,7 +22,7 @@ - if current_user.can_select_namespace? .input-group-addon = root_url - = f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user, display_path: true), {}, {class: 'select2 js-select-namespace', tabindex: 1} + = f.select :namespace_id, namespaces_options(namespace_id_from(params) || :current_user, display_path: true), {}, {class: 'select2 js-select-namespace', tabindex: 1} - else .input-group-addon.static-namespace |