From 44209861e8a3ed4e5d0e0e59823d4bf61c338f1f Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Fri, 14 Dec 2012 06:14:05 +0300
Subject: [PATCH] Allow group path renaming. Dont show project transfer if no
 permissions. More danger messages :)

---
 .../stylesheets/gitlab_bootstrap/common.scss  |  6 ++++
 app/views/admin/groups/edit.html.haml         | 19 ++++++++----
 app/views/admin/groups/show.html.haml         | 15 ++++++----
 app/views/projects/_form.html.haml            | 29 ++++++++++---------
 4 files changed, 46 insertions(+), 23 deletions(-)

diff --git a/app/assets/stylesheets/gitlab_bootstrap/common.scss b/app/assets/stylesheets/gitlab_bootstrap/common.scss
index a663326ee0..b8e89e7c78 100644
--- a/app/assets/stylesheets/gitlab_bootstrap/common.scss
+++ b/app/assets/stylesheets/gitlab_bootstrap/common.scss
@@ -100,6 +100,12 @@ input[type='search'].search-text-input {
   border: 1px solid #ccc;
 }
 
+input[type='text'].danger {
+  background: #F2DEDE!important;
+  border-color: #D66;
+  text-shadow: 0 1px 1px #fff
+}
+
 fieldset legend { font-size: 17px; }
 
 /** PAGINATION **/
diff --git a/app/views/admin/groups/edit.html.haml b/app/views/admin/groups/edit.html.haml
index 4026817496..901d07e74f 100644
--- a/app/views/admin/groups/edit.html.haml
+++ b/app/views/admin/groups/edit.html.haml
@@ -1,9 +1,5 @@
 %h3.page_title Rename Group
 %hr
-.alert
-  Renaming group can have unintended side effects.
-  %br
-  Renaming group will rename directory for all related projects
 = form_for [:admin, @group] do |f|
   - if @group.errors.any?
     .alert-message.block-message.error
@@ -14,6 +10,19 @@
     .input
       = f.text_field :name, placeholder: "Example Group", class: "xxlarge"
 
+
+
+  .clearfix.group_name_holder
+    = f.label :path do
+      %span.cred Group path is
+    .input
+      = f.text_field :path, placeholder: "example-group", class: "xxlarge danger"
+      %ul.cred
+        %li Changing group path can have unintended side effects.
+        %li Renaming group path will rename directory for all related projects
+        %li It will change web url for access group and group projects.
+        %li It will change the git path to repositories under this group.
+
   .form-actions
-    = f.submit 'Rename group', class: "btn save-btn"
+    = f.submit 'Rename group', class: "btn danger"
     = link_to  'Cancel', admin_groups_path, class: "btn cancel-btn"
diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml
index 4b6fedfd36..1b02475fa8 100644
--- a/app/views/admin/groups/show.html.haml
+++ b/app/views/admin/groups/show.html.haml
@@ -33,12 +33,17 @@
         = link_to "#", class: "btn btn-small change-owner-link" do
           %i.icon-edit
           Change owner
-        .change-owner-holder.hide
-          = form_for [:admin, @group] do |f|
-            = f.select :owner_id, User.all.map { |user| [user.name, user.id] }, {}, {class: 'chosen'}
-            = f.submit 'Save', class: "btn btn-small save-btn"
-            = link_to "Cancel", "#", class: "btn btn-small change-owner-cancel-link"
 
+  %tr.change-owner-holder.hide
+    %td.bgred
+      %b.cred
+        New Owner:
+    %td.bgred
+      = form_for [:admin, @group] do |f|
+        = f.select :owner_id, User.all.map { |user| [user.name, user.id] }, {}, {class: 'chosen'}
+        %div
+          = f.submit 'Change Owner', class: "btn danger"
+          = link_to "Cancel", "#", class: "btn change-owner-cancel-link"
 %fieldset
   %legend Projects (#{@group.projects.count})
   %table
diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml
index d0da21451a..7044d1f20b 100644
--- a/app/views/projects/_form.html.haml
+++ b/app/views/projects/_form.html.haml
@@ -17,19 +17,6 @@
       .controls
         = text_field_tag :ppath, @project.path_to_repo, class: "xxlarge", readonly: true
 
-    .control-group
-      = f.label :namespace_id do
-        %span Namespace
-      .controls
-        - if can? current_user, :change_namespace, @project
-          = f.select :namespace_id, namespaces_options(@project.namespace_id || Namespace::global_id), {prompt: 'Choose a project namespace'}, {class: 'chosen'}
-          &nbsp;
-          %span.cred Be careful. Changing project namespace can have unintended side effects
-        - else
-          %a.btn.disabled= @project.namespace.try(:human_name) || "/"
-          &nbsp;
-          %span.cred Only owner can change project namespace.
-
 
     - unless @project.heads.empty?
       .clearfix
@@ -63,6 +50,22 @@
         = f.check_box :wiki_enabled
         %span.descr Pages for project documentation
 
+
+  - if can? current_user, :change_namespace, @project
+    %fieldset.features
+      %legend Transfer:
+      .control-group
+        = f.label :namespace_id do
+          %span Namespace
+        .controls
+          = f.select :namespace_id, namespaces_options(@project.namespace_id || Namespace::global_id), {prompt: 'Choose a project namespace'}, {class: 'chosen'}
+          %br
+          %ul.prepend-top-10.cred
+            %li Be careful. Changing project namespace can have unintended side effects
+            %li You can transfer project only to namespaces you can manage
+            %li You will need to update your local repositories to point to the new location.
+
+
   %br
 
   .actions
-- 
2.30.9