Commit e7452c6b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'ui/new-project' into 'master'

UI: New Project form tweaks

Depends on !1953 

See the commits for more details, the messages mostly speak for themselves.

Before:

![Screen_Shot_2015-12-02_at_17.43.23](/uploads/302e734f6796a85a9f4be9c2f494869d/Screen_Shot_2015-12-02_at_17.43.23.png)

After:

![Screen_Shot_2015-12-02_at_17.44.11](/uploads/411980e53a4f87cf0a04e5bcb7329f82/Screen_Shot_2015-12-02_at_17.44.11.png)


See merge request !1964
parents 805b4cf5 fc5afc60
......@@ -91,9 +91,17 @@ label {
}
.input-group {
.select2-container {
display: table-cell;
width: 200px !important;
}
.input-group-addon {
background-color: #f7f8fa;
}
.input-group-addon:not(:first-child):not(:last-child) {
border-left: 0;
border-right: 0;
}
}
.help-block {
......
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
users = [current_user.namespace]
group_opts = ["Groups", groups.sort_by(&:human_name).map {|g| [g.human_name, g.id]} ]
users_opts = [ "Users", users.sort_by(&:human_name).map {|u| [u.human_name, u.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| [display_path ? u.path : u.human_name, u.id]} ]
options = []
options << group_opts
......
......@@ -11,16 +11,21 @@
Project path
.col-sm-10
.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?
.form-group
= f.label :namespace_id, class: 'control-label' do
%span Namespace
.col-sm-10
= f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user), {}, {class: 'select2', tabindex: 2}
- 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', tabindex: 1}
.input-group-addon
\/
- 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 current_user.can_create_group?
.help-block
Want to house several dependent projects under the same namespace?
= link_to "Create a group", new_group_path
- if import_sources_enabled?
.project-import.js-toggle-container
......@@ -96,14 +101,6 @@
.form-actions
= f.submit 'Create project', class: "btn btn-create project-submit", tabindex: 4
- if current_user.can_create_group?
.pull-right
.light.inline
.space-right
Need a group for several dependent projects?
= link_to new_group_path, class: "btn" do
Create a group
.save-project-loader.hide
.center
%h2
......
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