Commit 6252fe45 authored by Douwe Maan's avatar Douwe Maan

Unify new project namespace select and path input

parent 09e712c0
...@@ -88,7 +88,15 @@ label { ...@@ -88,7 +88,15 @@ label {
} }
.input-group { .input-group {
.select2-container {
display: table-cell;
width: 200px !important;
}
.input-group-addon { .input-group-addon {
background-color: #f7f8fa; background-color: #f7f8fa;
} }
.input-group-addon:not(:first-child):not(:last-child) {
border-left: 0;
border-right: 0;
}
} }
module NamespacesHelper module NamespacesHelper
def namespaces_options(selected = :current_user, scope = :default) def namespaces_options(selected = :current_user, display_path: false)
groups = current_user.owned_groups + current_user.masters_groups groups = current_user.owned_groups + current_user.masters_groups
users = [current_user.namespace] users = [current_user.namespace]
group_opts = ["Groups", groups.sort_by(&:human_name).map {|g| [g.human_name, g.id]} ] group_opts = ["Groups", groups.sort_by(&:human_name).map {|g| [display_path ? g.path : g.human_name, g.id]} ]
users_opts = [ "Users", users.sort_by(&:human_name).map {|u| [u.human_name, u.id]} ] users_opts = [ "Users", users.sort_by(&:human_name).map {|u| [display_path ? u.path : u.human_name, u.id]} ]
options = [] options = []
options << group_opts options << group_opts
......
...@@ -11,16 +11,16 @@ ...@@ -11,16 +11,16 @@
Project path Project path
.col-sm-10 .col-sm-10
.input-group .input-group
= f.text_field :path, placeholder: "my-awesome-project", class: "form-control", tabindex: 1, autofocus: true, required: true
.input-group-addon
\.git
- if current_user.can_select_namespace? - if current_user.can_select_namespace?
.form-group .input-group-addon
= f.label :namespace_id, class: 'control-label' do = root_url
%span Namespace = f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user, display_path: true), {}, {class: 'select2', tabindex: 1}
.col-sm-10 .input-group-addon
= f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user), {}, {class: 'select2', tabindex: 2} \/
- else
.input-group-addon
#{root_url}#{current_user.username}/
= f.text_field :path, placeholder: "my-awesome-project", class: "form-control", tabindex: 2, autofocus: true, required: true
- if import_sources_enabled? - if import_sources_enabled?
.project-import.js-toggle-container .project-import.js-toggle-container
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment