diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 4fad8d2bdea..a492e66611f 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -2,7 +2,7 @@ class Admin::GroupsController < AdminController before_filter :group, only: [:edit, :show, :update, :destroy, :project_update] def index - @groups = Group.scoped + @groups = Group.order('name ASC') @groups = @groups.search(params[:name]) if params[:name].present? @groups = @groups.page(params[:page]).per(20) end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 744b1912a6c..5614aaa2a67 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -3,7 +3,7 @@ class Admin::UsersController < AdminController @admin_users = User.scoped @admin_users = @admin_users.filter(params[:filter]) @admin_users = @admin_users.search(params[:name]) if params[:name].present? - @admin_users = @admin_users.order("updated_at DESC").page(params[:page]) + @admin_users = @admin_users.order("name ASC").page(params[:page]) end def show diff --git a/app/roles/repository.rb b/app/roles/repository.rb index 74cae5c8d5d..4e80d50cc72 100644 --- a/app/roles/repository.rb +++ b/app/roles/repository.rb @@ -45,8 +45,22 @@ module Repository end def has_post_receive_file? - hook_file = File.join(path_to_repo, 'hooks', 'post-receive') - File.exists?(hook_file) + !!hook_file + end + + def valid_post_receive_file? + valid_hook_file == hook_file + end + + def valid_hook_file + @valid_hook_file ||= File.read(Rails.root.join('lib', 'hooks', 'post-receive')) + end + + def hook_file + @hook_file ||= begin + hook_path = File.join(path_to_repo, 'hooks', 'post-receive') + File.read(hook_path) if File.exists?(hook_path) + end end # Returns an Array of branch names diff --git a/app/views/admin/groups/index.html.haml b/app/views/admin/groups/index.html.haml index 455730a06c4..6fbeed82a77 100644 --- a/app/views/admin/groups/index.html.haml +++ b/app/views/admin/groups/index.html.haml @@ -12,16 +12,22 @@ %table %thead - %th Name + %th + Name + %i.icon-sort-down %th Path %th Projects + %th Owner %th.cred Danger Zone! - @groups.each do |group| %tr - %td= link_to group.name, [:admin, group] + %td + %strong= link_to group.name, [:admin, group] %td= group.path %td= group.projects.count + %td + = link_to group.owner_name, admin_user_path(group.owner_id) %td.bgred = link_to 'Rename', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn small" = link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn small danger" diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index 9bbcbc71111..605a733574c 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -9,7 +9,9 @@ %table %thead - %th Name + %th + Name + %i.icon-sort-down %th Path %th Team Members %th Last Commit diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index 47185308f41..1ca3128523f 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -4,14 +4,24 @@ %i.icon-edit Edit -- if !@project.has_post_receive_file? && @project.has_commits? - %br - .alert.alert-error - %span - %strong Important! - Project has commits but missing post-receive file. - %br - If you exported project manually - copy post-receive hook to bare repository +- if @project.has_commits? + - if !@project.has_post_receive_file? + %br + .alert.alert-error + %span + %strong Project has commits but missing post-receive file. + %br + If you exported project manually - make a link of post-receive hook file from gitolite to project repository + - elsif !@project.valid_post_receive_file? + %br + .alert.alert-error + %span + %strong Project has invalid post-receive file. + %br + 1. Make sure your gitolite instace has latest post-receive file. + %br + 2. Make a link of post-receive hook file from gitolite to project repository + %br %table.zebra-striped @@ -53,7 +63,7 @@ %td = check_box_tag :post_receive_file, 1, @project.has_post_receive_file?, disabled: true %br -%h3 +%h5 Team %small (#{@project.users_projects.count}) @@ -75,7 +85,7 @@ %td= link_to 'Remove from team', admin_team_member_path(tm), confirm: 'Are you sure?', method: :delete, class: "btn danger small" %br -%h3 Add new team member +%h5 Add new team member %br = form_tag team_update_admin_project_path(@project), class: "bulk_import", method: :put do %table.zebra-striped diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 5d0f6fe1153..7544a732db2 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -22,7 +22,9 @@ %table %thead %th Admin - %th Name + %th + Name + %i.icon-sort-down %th Username %th Email %th Projects diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml index f9410161453..1af7549c074 100644 --- a/app/views/admin/users/show.html.haml +++ b/app/views/admin/users/show.html.haml @@ -66,7 +66,7 @@ = @admin_user.twitter %br -%h3 Add User to Projects +%h5 Add User to Projects %br = form_tag team_update_admin_user_path(@admin_user), class: "bulk_import", method: :put do %table @@ -86,8 +86,22 @@ %strong= link_to "here", help_permissions_path, class: "vlink" %br +- if @admin_user.groups.present? + %h5 Owner of groups: + %br + + %table.zebra-striped + %thead + %tr + %th Name + + - @admin_user.groups.each do |group| + %tr + %td= link_to group.name, admin_group_path(group) + + - if @admin_user.projects.present? - %h3 Projects + %h5 Projects: %br %table.zebra-striped