Commit ba74fa1413d3274f7a3282d7f59046beecb32912
1 parent
7f6bbf06
Exists in
master
and in
4 other branches
Remove some bugs. Add warnings for renaming group. Add ability to cahnge group owner.
Showing
11 changed files
with
101 additions
and
51 deletions
Show diff stats
app/assets/stylesheets/gitlab_bootstrap/common.scss
| @@ -100,17 +100,3 @@ input[type='search'].search-text-input { | @@ -100,17 +100,3 @@ input[type='search'].search-text-input { | ||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | fieldset legend { font-size: 17px; } | 102 | fieldset legend { font-size: 17px; } |
| 103 | - | ||
| 104 | -ul.nav.nav-projects-tabs { | ||
| 105 | - @extend .nav-tabs; | ||
| 106 | - | ||
| 107 | - padding-left: 8px; | ||
| 108 | - | ||
| 109 | - li { | ||
| 110 | - a { | ||
| 111 | - padding: 4px 20px; | ||
| 112 | - margin-top: 2px; | ||
| 113 | - border-color: #DDD; | ||
| 114 | - } | ||
| 115 | - } | ||
| 116 | -} |
app/assets/stylesheets/sections/projects.scss
| @@ -4,7 +4,6 @@ | @@ -4,7 +4,6 @@ | ||
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | .side { | 6 | .side { |
| 7 | - @extend .span4; | ||
| 8 | @extend .right; | 7 | @extend .right; |
| 9 | 8 | ||
| 10 | .groups_box, | 9 | .groups_box, |
| @@ -117,3 +116,25 @@ | @@ -117,3 +116,25 @@ | ||
| 117 | } | 116 | } |
| 118 | 117 | ||
| 119 | } | 118 | } |
| 119 | + | ||
| 120 | +ul.nav.nav-projects-tabs { | ||
| 121 | + @extend .nav-tabs; | ||
| 122 | + | ||
| 123 | + padding-left: 8px; | ||
| 124 | + | ||
| 125 | + li { | ||
| 126 | + a { | ||
| 127 | + padding: 4px 20px; | ||
| 128 | + margin-top: 2px; | ||
| 129 | + border-color: #DDD; | ||
| 130 | + background-color: #EEE; | ||
| 131 | + text-shadow: 0 1px 1px white; | ||
| 132 | + color: #555; | ||
| 133 | + } | ||
| 134 | + &.active { | ||
| 135 | + a { | ||
| 136 | + font-weight: bold; | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | +} |
app/controllers/admin/groups_controller.rb
| @@ -11,6 +11,7 @@ class Admin::GroupsController < AdminController | @@ -11,6 +11,7 @@ class Admin::GroupsController < AdminController | ||
| 11 | @projects = Project.scoped | 11 | @projects = Project.scoped |
| 12 | @projects = @projects.not_in_group(@group) if @group.projects.present? | 12 | @projects = @projects.not_in_group(@group) if @group.projects.present? |
| 13 | @projects = @projects.all | 13 | @projects = @projects.all |
| 14 | + @projects.reject!(&:empty_repo?) | ||
| 14 | end | 15 | end |
| 15 | 16 | ||
| 16 | def new | 17 | def new |
app/controllers/admin/projects_controller.rb
| @@ -4,6 +4,7 @@ class Admin::ProjectsController < AdminController | @@ -4,6 +4,7 @@ class Admin::ProjectsController < AdminController | ||
| 4 | def index | 4 | def index |
| 5 | @projects = Project.scoped | 5 | @projects = Project.scoped |
| 6 | @projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present? | 6 | @projects = @projects.where(namespace_id: params[:namespace_id]) if params[:namespace_id].present? |
| 7 | + @projects = @projects.where(namespace_id: nil) if params[:namespace_id] == Namespace.global_id | ||
| 7 | @projects = @projects.search(params[:name]) if params[:name].present? | 8 | @projects = @projects.search(params[:name]) if params[:name].present? |
| 8 | @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20) | 9 | @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20) |
| 9 | end | 10 | end |
app/views/admin/groups/_form.html.haml
| @@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
| 1 | -= form_for [:admin, @group] do |f| | ||
| 2 | - - if @group.errors.any? | ||
| 3 | - .alert-message.block-message.error | ||
| 4 | - %span= @group.errors.full_messages.first | ||
| 5 | - .clearfix.group_name_holder | ||
| 6 | - = f.label :name do | ||
| 7 | - Group name is | ||
| 8 | - .input | ||
| 9 | - = f.text_field :name, placeholder: "Example Group", class: "xxlarge" | ||
| 10 | - | ||
| 11 | - .form-actions | ||
| 12 | - = f.submit 'Save group', class: "btn save-btn" |
app/views/admin/groups/edit.html.haml
| 1 | -%h3.page_title Edit Group | ||
| 2 | -%br | ||
| 3 | -= render 'form' | 1 | +%h3.page_title Rename Group |
| 2 | +%hr | ||
| 3 | +.alert | ||
| 4 | + Renaming group can have unintended side effects. | ||
| 5 | + %br | ||
| 6 | + Renaming group will rename directory for all related projects | ||
| 7 | += form_for [:admin, @group] do |f| | ||
| 8 | + - if @group.errors.any? | ||
| 9 | + .alert-message.block-message.error | ||
| 10 | + %span= @group.errors.full_messages.first | ||
| 11 | + .clearfix.group_name_holder | ||
| 12 | + = f.label :name do | ||
| 13 | + Group name is | ||
| 14 | + .input | ||
| 15 | + = f.text_field :name, placeholder: "Example Group", class: "xxlarge" | ||
| 16 | + | ||
| 17 | + .form-actions | ||
| 18 | + = f.submit 'Rename group', class: "btn save-btn" | ||
| 19 | + = link_to 'Cancel', admin_groups_path, class: "btn cancel-btn" |
app/views/admin/groups/index.html.haml
| @@ -15,7 +15,6 @@ | @@ -15,7 +15,6 @@ | ||
| 15 | %th Name | 15 | %th Name |
| 16 | %th Path | 16 | %th Path |
| 17 | %th Projects | 17 | %th Projects |
| 18 | - %th Edit | ||
| 19 | %th.cred Danger Zone! | 18 | %th.cred Danger Zone! |
| 20 | 19 | ||
| 21 | - @groups.each do |group| | 20 | - @groups.each do |group| |
| @@ -23,6 +22,7 @@ | @@ -23,6 +22,7 @@ | ||
| 23 | %td= link_to group.name, [:admin, group] | 22 | %td= link_to group.name, [:admin, group] |
| 24 | %td= group.path | 23 | %td= group.path |
| 25 | %td= group.projects.count | 24 | %td= group.projects.count |
| 26 | - %td= link_to 'Edit', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn small" | ||
| 27 | - %td.bgred= link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn small danger" | 25 | + %td.bgred |
| 26 | + = link_to 'Rename', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn small" | ||
| 27 | + = link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn small danger" | ||
| 28 | = paginate @groups, theme: "admin" | 28 | = paginate @groups, theme: "admin" |
app/views/admin/groups/show.html.haml
| 1 | %h3.page_title | 1 | %h3.page_title |
| 2 | Group: #{@group.name} | 2 | Group: #{@group.name} |
| 3 | - = link_to edit_admin_group_path(@group), class: "btn right" do | ||
| 4 | - %i.icon-edit | ||
| 5 | - Edit | ||
| 6 | 3 | ||
| 7 | %br | 4 | %br |
| 8 | %table.zebra-striped | 5 | %table.zebra-striped |
| @@ -16,6 +13,10 @@ | @@ -16,6 +13,10 @@ | ||
| 16 | Name: | 13 | Name: |
| 17 | %td | 14 | %td |
| 18 | = @group.name | 15 | = @group.name |
| 16 | + | ||
| 17 | + = link_to edit_admin_group_path(@group), class: "btn btn-small right" do | ||
| 18 | + %i.icon-edit | ||
| 19 | + Rename | ||
| 19 | %tr | 20 | %tr |
| 20 | %td | 21 | %td |
| 21 | %b | 22 | %b |
| @@ -28,24 +29,43 @@ | @@ -28,24 +29,43 @@ | ||
| 28 | Owner: | 29 | Owner: |
| 29 | %td | 30 | %td |
| 30 | = @group.owner_name | 31 | = @group.owner_name |
| 31 | -.ui-box | ||
| 32 | - %h5 | ||
| 33 | - Projects | ||
| 34 | - %small | ||
| 35 | - (#{@group.projects.count}) | ||
| 36 | - %ul.unstyled | 32 | + .right |
| 33 | + = link_to "#", class: "btn btn-small change-owner-link" do | ||
| 34 | + %i.icon-edit | ||
| 35 | + Change owner | ||
| 36 | + .change-owner-holder.hide | ||
| 37 | + = form_for [:admin, @group] do |f| | ||
| 38 | + = f.select :owner_id, User.all.map { |user| [user.name, user.id] }, {}, {class: 'chosen'} | ||
| 39 | + = f.submit 'Save', class: "btn btn-small save-btn" | ||
| 40 | + = link_to "Cancel", "#", class: "btn btn-small change-owner-cancel-link" | ||
| 41 | + | ||
| 42 | +%fieldset | ||
| 43 | + %legend Projects (#{@group.projects.count}) | ||
| 44 | + %table | ||
| 45 | + %thead | ||
| 46 | + %tr | ||
| 47 | + %th Project name | ||
| 48 | + %th Path | ||
| 49 | + %th Users | ||
| 50 | + %th.cred Danger Zone! | ||
| 37 | - @group.projects.each do |project| | 51 | - @group.projects.each do |project| |
| 38 | - %li.wll | ||
| 39 | - %strong | ||
| 40 | - = link_to project.name, [:admin, project] | ||
| 41 | - .right | ||
| 42 | - = link_to 'Remove from group', remove_project_admin_group_path(@group, project_id: project.id), confirm: 'Are you sure?', method: :delete, class: "btn danger small" | ||
| 43 | - .clearfix | 52 | + %tr |
| 53 | + %td | ||
| 54 | + = link_to project.name_with_namespace, [:admin, project] | ||
| 55 | + %td | ||
| 56 | + %span.monospace= project.path_with_namespace + ".git" | ||
| 57 | + %td= project.users.count | ||
| 58 | + %td.bgred | ||
| 59 | + = link_to 'Transfer project to global namespace', remove_project_admin_group_path(@group, project_id: project.id), confirm: 'Remove project from group and move to global namespace. Are you sure?', method: :delete, class: "btn danger small" | ||
| 44 | 60 | ||
| 45 | 61 | ||
| 46 | = form_tag project_update_admin_group_path(@group), class: "bulk_import", method: :put do | 62 | = form_tag project_update_admin_group_path(@group), class: "bulk_import", method: :put do |
| 47 | %fieldset | 63 | %fieldset |
| 48 | %legend Move projects to group | 64 | %legend Move projects to group |
| 65 | + .alert | ||
| 66 | + You can move only projects with existing repos | ||
| 67 | + %br | ||
| 68 | + Group projects will be moved in group directory and will not be accessible by old path | ||
| 49 | .clearfix | 69 | .clearfix |
| 50 | = label_tag :project_ids do | 70 | = label_tag :project_ids do |
| 51 | Projects | 71 | Projects |
| @@ -53,3 +73,17 @@ | @@ -53,3 +73,17 @@ | ||
| 53 | = select_tag :project_ids, options_from_collection_for_select(@projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span5' | 73 | = select_tag :project_ids, options_from_collection_for_select(@projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span5' |
| 54 | .form-actions | 74 | .form-actions |
| 55 | = submit_tag 'Add', class: "btn primary" | 75 | = submit_tag 'Add', class: "btn primary" |
| 76 | + | ||
| 77 | +:javascript | ||
| 78 | + $(function(){ | ||
| 79 | + var modal = $('.change-owner-holder'); | ||
| 80 | + $('.change-owner-link').bind("click", function(){ | ||
| 81 | + $(this).hide(); | ||
| 82 | + modal.show(); | ||
| 83 | + }); | ||
| 84 | + $('.change-owner-cancel-link').bind("click", function(){ | ||
| 85 | + modal.hide(); | ||
| 86 | + $('.change-owner-link').show(); | ||
| 87 | + }) | ||
| 88 | + }) | ||
| 89 | + |
app/views/admin/projects/_form.html.haml
| @@ -22,7 +22,10 @@ | @@ -22,7 +22,10 @@ | ||
| 22 | - unless project.new_record? | 22 | - unless project.new_record? |
| 23 | .clearfix | 23 | .clearfix |
| 24 | = f.label :namespace_id | 24 | = f.label :namespace_id |
| 25 | - .input= f.select :namespace_id, namespaces_options(@project.namespace_id), {}, {class: 'chosen'} | 25 | + .input |
| 26 | + = f.select :namespace_id, namespaces_options(@project.namespace_id), {}, {class: 'chosen'} | ||
| 27 | + | ||
| 28 | + %span.cred Be careful. Changing project namespace can have unintended side effects | ||
| 26 | 29 | ||
| 27 | - if project.repo_exists? | 30 | - if project.repo_exists? |
| 28 | .clearfix | 31 | .clearfix |
app/views/dashboard/index.html.haml
app/views/groups/show.html.haml
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | - else | 11 | - else |
| 12 | %p.nothing_here_message Projects activity will be displayed here | 12 | %p.nothing_here_message Projects activity will be displayed here |
| 13 | .loading.hide | 13 | .loading.hide |
| 14 | - .side | 14 | + .side.span4 |
| 15 | = render "projects", projects: @projects | 15 | = render "projects", projects: @projects |
| 16 | %div | 16 | %div |
| 17 | %span.rss-icon | 17 | %span.rss-icon |