Commit bf13579b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Make admin sorting more obvious

parent 2b79706d
...@@ -2,7 +2,7 @@ class Admin::GroupsController < AdminController ...@@ -2,7 +2,7 @@ class Admin::GroupsController < AdminController
before_filter :group, only: [:edit, :show, :update, :destroy, :project_update] before_filter :group, only: [:edit, :show, :update, :destroy, :project_update]
def index def index
@groups = Group.scoped @groups = Group.order('name ASC')
@groups = @groups.search(params[:name]) if params[:name].present? @groups = @groups.search(params[:name]) if params[:name].present?
@groups = @groups.page(params[:page]).per(20) @groups = @groups.page(params[:page]).per(20)
end end
......
...@@ -3,7 +3,7 @@ class Admin::UsersController < AdminController ...@@ -3,7 +3,7 @@ class Admin::UsersController < AdminController
@admin_users = User.scoped @admin_users = User.scoped
@admin_users = @admin_users.filter(params[:filter]) @admin_users = @admin_users.filter(params[:filter])
@admin_users = @admin_users.search(params[:name]) if params[:name].present? @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 end
def show def show
......
...@@ -45,8 +45,22 @@ module Repository ...@@ -45,8 +45,22 @@ module Repository
end end
def has_post_receive_file? def has_post_receive_file?
hook_file = File.join(path_to_repo, 'hooks', 'post-receive') !!hook_file
File.exists?(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 end
# Returns an Array of branch names # Returns an Array of branch names
......
...@@ -12,16 +12,22 @@ ...@@ -12,16 +12,22 @@
%table %table
%thead %thead
%th Name %th
Name
%i.icon-sort-down
%th Path %th Path
%th Projects %th Projects
%th Owner
%th.cred Danger Zone! %th.cred Danger Zone!
- @groups.each do |group| - @groups.each do |group|
%tr %tr
%td= link_to group.name, [:admin, group] %td
%strong= link_to group.name, [:admin, group]
%td= group.path %td= group.path
%td= group.projects.count %td= group.projects.count
%td
= link_to group.owner_name, admin_user_path(group.owner_id)
%td.bgred %td.bgred
= link_to 'Rename', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn small" = 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" = link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn small danger"
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
%table %table
%thead %thead
%th Name %th
Name
%i.icon-sort-down
%th Path %th Path
%th Team Members %th Team Members
%th Last Commit %th Last Commit
......
...@@ -4,14 +4,24 @@ ...@@ -4,14 +4,24 @@
%i.icon-edit %i.icon-edit
Edit Edit
- if !@project.has_post_receive_file? && @project.has_commits? - if @project.has_commits?
%br - if !@project.has_post_receive_file?
.alert.alert-error %br
%span .alert.alert-error
%strong Important! %span
Project has commits but missing post-receive file. %strong Project has commits but missing post-receive file.
%br %br
If you exported project manually - copy post-receive hook to bare repository 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 %br
%table.zebra-striped %table.zebra-striped
...@@ -53,7 +63,7 @@ ...@@ -53,7 +63,7 @@
%td %td
= check_box_tag :post_receive_file, 1, @project.has_post_receive_file?, disabled: true = check_box_tag :post_receive_file, 1, @project.has_post_receive_file?, disabled: true
%br %br
%h3 %h5
Team Team
%small %small
(#{@project.users_projects.count}) (#{@project.users_projects.count})
...@@ -75,7 +85,7 @@ ...@@ -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" %td= link_to 'Remove from team', admin_team_member_path(tm), confirm: 'Are you sure?', method: :delete, class: "btn danger small"
%br %br
%h3 Add new team member %h5 Add new team member
%br %br
= form_tag team_update_admin_project_path(@project), class: "bulk_import", method: :put do = form_tag team_update_admin_project_path(@project), class: "bulk_import", method: :put do
%table.zebra-striped %table.zebra-striped
......
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
%table %table
%thead %thead
%th Admin %th Admin
%th Name %th
Name
%i.icon-sort-down
%th Username %th Username
%th Email %th Email
%th Projects %th Projects
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
= @admin_user.twitter = @admin_user.twitter
%br %br
%h3 Add User to Projects %h5 Add User to Projects
%br %br
= form_tag team_update_admin_user_path(@admin_user), class: "bulk_import", method: :put do = form_tag team_update_admin_user_path(@admin_user), class: "bulk_import", method: :put do
%table %table
...@@ -86,8 +86,22 @@ ...@@ -86,8 +86,22 @@
%strong= link_to "here", help_permissions_path, class: "vlink" %strong= link_to "here", help_permissions_path, class: "vlink"
%br %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? - if @admin_user.projects.present?
%h3 Projects %h5 Projects:
%br %br
%table.zebra-striped %table.zebra-striped
......
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