Commit bf13579b929151aa80ca957486b1851b067aa4ac
1 parent
2b79706d
Exists in
master
and in
4 other branches
Make admin sorting more obvious
Showing
8 changed files
with
68 additions
and
20 deletions
Show diff stats
app/controllers/admin/groups_controller.rb
... | ... | @@ -2,7 +2,7 @@ class Admin::GroupsController < AdminController |
2 | 2 | before_filter :group, only: [:edit, :show, :update, :destroy, :project_update] |
3 | 3 | |
4 | 4 | def index |
5 | - @groups = Group.scoped | |
5 | + @groups = Group.order('name ASC') | |
6 | 6 | @groups = @groups.search(params[:name]) if params[:name].present? |
7 | 7 | @groups = @groups.page(params[:page]).per(20) |
8 | 8 | end | ... | ... |
app/controllers/admin/users_controller.rb
... | ... | @@ -3,7 +3,7 @@ class Admin::UsersController < AdminController |
3 | 3 | @admin_users = User.scoped |
4 | 4 | @admin_users = @admin_users.filter(params[:filter]) |
5 | 5 | @admin_users = @admin_users.search(params[:name]) if params[:name].present? |
6 | - @admin_users = @admin_users.order("updated_at DESC").page(params[:page]) | |
6 | + @admin_users = @admin_users.order("name ASC").page(params[:page]) | |
7 | 7 | end |
8 | 8 | |
9 | 9 | def show | ... | ... |
app/roles/repository.rb
... | ... | @@ -45,8 +45,22 @@ module Repository |
45 | 45 | end |
46 | 46 | |
47 | 47 | def has_post_receive_file? |
48 | - hook_file = File.join(path_to_repo, 'hooks', 'post-receive') | |
49 | - File.exists?(hook_file) | |
48 | + !!hook_file | |
49 | + end | |
50 | + | |
51 | + def valid_post_receive_file? | |
52 | + valid_hook_file == hook_file | |
53 | + end | |
54 | + | |
55 | + def valid_hook_file | |
56 | + @valid_hook_file ||= File.read(Rails.root.join('lib', 'hooks', 'post-receive')) | |
57 | + end | |
58 | + | |
59 | + def hook_file | |
60 | + @hook_file ||= begin | |
61 | + hook_path = File.join(path_to_repo, 'hooks', 'post-receive') | |
62 | + File.read(hook_path) if File.exists?(hook_path) | |
63 | + end | |
50 | 64 | end |
51 | 65 | |
52 | 66 | # Returns an Array of branch names | ... | ... |
app/views/admin/groups/index.html.haml
... | ... | @@ -12,16 +12,22 @@ |
12 | 12 | |
13 | 13 | %table |
14 | 14 | %thead |
15 | - %th Name | |
15 | + %th | |
16 | + Name | |
17 | + %i.icon-sort-down | |
16 | 18 | %th Path |
17 | 19 | %th Projects |
20 | + %th Owner | |
18 | 21 | %th.cred Danger Zone! |
19 | 22 | |
20 | 23 | - @groups.each do |group| |
21 | 24 | %tr |
22 | - %td= link_to group.name, [:admin, group] | |
25 | + %td | |
26 | + %strong= link_to group.name, [:admin, group] | |
23 | 27 | %td= group.path |
24 | 28 | %td= group.projects.count |
29 | + %td | |
30 | + = link_to group.owner_name, admin_user_path(group.owner_id) | |
25 | 31 | %td.bgred |
26 | 32 | = link_to 'Rename', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn small" |
27 | 33 | = link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn small danger" | ... | ... |
app/views/admin/projects/index.html.haml
app/views/admin/projects/show.html.haml
... | ... | @@ -4,14 +4,24 @@ |
4 | 4 | %i.icon-edit |
5 | 5 | Edit |
6 | 6 | |
7 | -- if !@project.has_post_receive_file? && @project.has_commits? | |
8 | - %br | |
9 | - .alert.alert-error | |
10 | - %span | |
11 | - %strong Important! | |
12 | - Project has commits but missing post-receive file. | |
13 | - %br | |
14 | - If you exported project manually - copy post-receive hook to bare repository | |
7 | +- if @project.has_commits? | |
8 | + - if !@project.has_post_receive_file? | |
9 | + %br | |
10 | + .alert.alert-error | |
11 | + %span | |
12 | + %strong Project has commits but missing post-receive file. | |
13 | + %br | |
14 | + If you exported project manually - make a link of post-receive hook file from gitolite to project repository | |
15 | + - elsif !@project.valid_post_receive_file? | |
16 | + %br | |
17 | + .alert.alert-error | |
18 | + %span | |
19 | + %strong Project has invalid post-receive file. | |
20 | + %br | |
21 | + 1. Make sure your gitolite instace has latest post-receive file. | |
22 | + %br | |
23 | + 2. Make a link of post-receive hook file from gitolite to project repository | |
24 | + | |
15 | 25 | |
16 | 26 | %br |
17 | 27 | %table.zebra-striped |
... | ... | @@ -53,7 +63,7 @@ |
53 | 63 | %td |
54 | 64 | = check_box_tag :post_receive_file, 1, @project.has_post_receive_file?, disabled: true |
55 | 65 | %br |
56 | -%h3 | |
66 | +%h5 | |
57 | 67 | Team |
58 | 68 | %small |
59 | 69 | (#{@project.users_projects.count}) |
... | ... | @@ -75,7 +85,7 @@ |
75 | 85 | %td= link_to 'Remove from team', admin_team_member_path(tm), confirm: 'Are you sure?', method: :delete, class: "btn danger small" |
76 | 86 | |
77 | 87 | %br |
78 | -%h3 Add new team member | |
88 | +%h5 Add new team member | |
79 | 89 | %br |
80 | 90 | = form_tag team_update_admin_project_path(@project), class: "bulk_import", method: :put do |
81 | 91 | %table.zebra-striped | ... | ... |
app/views/admin/users/index.html.haml
app/views/admin/users/show.html.haml
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | = @admin_user.twitter |
67 | 67 | |
68 | 68 | %br |
69 | -%h3 Add User to Projects | |
69 | +%h5 Add User to Projects | |
70 | 70 | %br |
71 | 71 | = form_tag team_update_admin_user_path(@admin_user), class: "bulk_import", method: :put do |
72 | 72 | %table |
... | ... | @@ -86,8 +86,22 @@ |
86 | 86 | %strong= link_to "here", help_permissions_path, class: "vlink" |
87 | 87 | %br |
88 | 88 | |
89 | +- if @admin_user.groups.present? | |
90 | + %h5 Owner of groups: | |
91 | + %br | |
92 | + | |
93 | + %table.zebra-striped | |
94 | + %thead | |
95 | + %tr | |
96 | + %th Name | |
97 | + | |
98 | + - @admin_user.groups.each do |group| | |
99 | + %tr | |
100 | + %td= link_to group.name, admin_group_path(group) | |
101 | + | |
102 | + | |
89 | 103 | - if @admin_user.projects.present? |
90 | - %h3 Projects | |
104 | + %h5 Projects: | |
91 | 105 | %br |
92 | 106 | |
93 | 107 | %table.zebra-striped | ... | ... |