Commit d0df8a6ff80a25dc36157e8f412ed9d56afda4e5
1 parent
e292d7c1
Exists in
master
and in
4 other branches
remove project edit from admin area. Redesigned project page in admin area
Showing
4 changed files
with
81 additions
and
155 deletions
Show diff stats
app/controllers/admin/projects_controller.rb
... | ... | @@ -19,34 +19,6 @@ class Admin::ProjectsController < Admin::ApplicationController |
19 | 19 | @users = @users.all |
20 | 20 | end |
21 | 21 | |
22 | - def edit | |
23 | - end | |
24 | - | |
25 | - def team_update | |
26 | - @project.team.add_users_ids(params[:user_ids], params[:project_access]) | |
27 | - | |
28 | - redirect_to [:admin, @project], notice: 'Project was successfully updated.' | |
29 | - end | |
30 | - | |
31 | - def update | |
32 | - project.creator = current_user unless project.creator | |
33 | - | |
34 | - status = ::Projects::UpdateContext.new(project, current_user, params).execute(:admin) | |
35 | - | |
36 | - if status | |
37 | - redirect_to [:admin, @project], notice: 'Project was successfully updated.' | |
38 | - else | |
39 | - render action: "edit" | |
40 | - end | |
41 | - end | |
42 | - | |
43 | - def destroy | |
44 | - @project.team.truncate | |
45 | - @project.destroy | |
46 | - | |
47 | - redirect_to admin_projects_path, notice: 'Project was successfully deleted.' | |
48 | - end | |
49 | - | |
50 | 22 | protected |
51 | 23 | |
52 | 24 | def project | ... | ... |
app/views/admin/projects/index.html.haml
... | ... | @@ -52,8 +52,8 @@ |
52 | 52 | %i.icon-lock.cgreen |
53 | 53 | = link_to project.name_with_namespace, [:admin, project] |
54 | 54 | .pull-right |
55 | - = link_to 'Edit', edit_admin_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" | |
56 | - = link_to 'Destroy', [:admin, project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" | |
55 | + = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" | |
56 | + = link_to 'Destroy', [project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" | |
57 | 57 | - if @projects.blank? |
58 | 58 | %p.nothing_here_message 0 projects matches |
59 | 59 | - else | ... | ... |
app/views/admin/projects/show.html.haml
1 | 1 | %h3.page_title |
2 | 2 | Project: #{@project.name_with_namespace} |
3 | - = link_to edit_admin_project_path(@project), class: "btn pull-right" do | |
3 | + = link_to edit_project_path(@project), class: "btn pull-right" do | |
4 | 4 | %i.icon-edit |
5 | 5 | Edit |
6 | +%hr | |
7 | +.row | |
8 | + .span6 | |
9 | + .ui-box | |
10 | + %h5.title | |
11 | + Project info: | |
12 | + %ul.well-list | |
13 | + %li | |
14 | + %span.light Name: | |
15 | + %strong= @project.name | |
16 | + %li | |
17 | + %span.light Namespace: | |
18 | + %strong | |
19 | + - if @project.namespace | |
20 | + = link_to @project.namespace.human_name, [:admin, @project.group || @project.owner] | |
21 | + - else | |
22 | + Global | |
23 | + %li | |
24 | + %span.light Owned by: | |
25 | + %strong | |
26 | + - if @project.owner | |
27 | + = link_to @project.owner_name, admin_user_path(@project.owner) | |
28 | + - else | |
29 | + (deleted) | |
6 | 30 | |
31 | + %li | |
32 | + %span.light Created by: | |
33 | + %strong | |
34 | + = @project.creator.try(:name) || '(deleted)' | |
7 | 35 | |
8 | -%br | |
9 | -%table.zebra-striped | |
10 | - %thead | |
11 | - %tr | |
12 | - %th Project | |
13 | - %th | |
14 | - %tr | |
15 | - %td | |
16 | - %b | |
17 | - Name: | |
18 | - %td | |
19 | - = @project.name | |
20 | - %tr | |
21 | - %td | |
22 | - %b | |
23 | - Namespace: | |
24 | - %td | |
25 | - - if @project.namespace | |
26 | - = @project.namespace.human_name | |
27 | - - else | |
28 | - Global | |
29 | - %tr | |
30 | - %td | |
31 | - %b | |
32 | - Owned by: | |
33 | - %td | |
34 | - - if @project.owner | |
35 | - = link_to @project.owner_name, admin_user_path(@project.owner) | |
36 | - - else | |
37 | - (deleted) | |
38 | - %tr | |
39 | - %td | |
40 | - %b | |
41 | - Created by: | |
42 | - %td | |
43 | - = @project.creator.try(:name) || '(deleted)' | |
44 | - %tr | |
45 | - %td | |
46 | - %b | |
47 | - Created at: | |
48 | - %td | |
49 | - = @project.created_at.stamp("March 1, 1999") | |
50 | - %tr | |
51 | - %td | |
52 | - %b | |
53 | - Smart HTTP: | |
54 | - %td | |
55 | - = link_to @project.http_url_to_repo | |
56 | - %tr | |
57 | - %td | |
58 | - %b | |
59 | - SSH: | |
60 | - %td | |
61 | - = link_to @project.ssh_url_to_repo | |
62 | - - if @project.public | |
63 | - %tr.bgred | |
64 | - %td | |
65 | - %b | |
66 | - Public Read-Only Code access: | |
67 | - %td | |
68 | - = check_box_tag 'public', nil, @project.public | |
36 | + %li | |
37 | + %span.light Created at: | |
38 | + %strong | |
39 | + = @project.created_at.stamp("March 1, 1999") | |
69 | 40 | |
70 | -- if @repository | |
71 | - %table.zebra-striped | |
72 | - %thead | |
73 | - %tr | |
74 | - %th Repository | |
75 | - %th | |
76 | - %tr | |
77 | - %td | |
78 | - %b | |
79 | - FS Path: | |
80 | - %td | |
81 | - %code= @repository.path_to_repo | |
82 | - %tr | |
83 | - %td | |
84 | - %b | |
85 | - Last commit at: | |
86 | - %td | |
87 | - = last_commit(@project) | |
41 | + %li | |
42 | + %span.light http: | |
43 | + %strong | |
44 | + = link_to @project.http_url_to_repo | |
45 | + %li | |
46 | + %span.light ssh: | |
47 | + %strong | |
48 | + = link_to @project.ssh_url_to_repo | |
49 | + %li | |
50 | + %span.light fs: | |
51 | + %strong | |
52 | + = @repository.path_to_repo | |
88 | 53 | |
89 | -%br | |
90 | -%h5 | |
91 | - Team | |
92 | - %small | |
93 | - (#{@project.users.count}) | |
94 | -%br | |
95 | -%table.zebra-striped.team_members | |
96 | - %thead | |
97 | - %tr | |
98 | - %th Name | |
99 | - %th Project Access | |
100 | - %th Repository Access | |
101 | - %th | |
54 | + %li | |
55 | + %span.light last commit: | |
56 | + %strong | |
57 | + - if @repository | |
58 | + = last_commit(@project) | |
59 | + - else | |
60 | + never | |
102 | 61 | |
103 | - - @project.users.each do |tm| | |
104 | - %tr | |
105 | - %td | |
106 | - = link_to tm.name, admin_user_path(tm) | |
107 | - %td= @project.project_access_human(tm) | |
108 | - %td= link_to 'Edit Access', edit_admin_project_member_path(@project, tm), class: "btn btn-small" | |
109 | - %td= link_to 'Remove from team', admin_project_member_path(@project, tm), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove small" | |
110 | - | |
111 | -%br | |
112 | -%h5 Add new team member | |
113 | -%br | |
114 | -= form_tag team_update_admin_project_path(@project), class: "bulk_import", method: :put do | |
115 | - %table.zebra-striped | |
116 | - %thead | |
117 | - %tr | |
118 | - %th Users | |
119 | - %th Project Access: | |
120 | - | |
121 | - %tr | |
122 | - %td= select_tag :user_ids, options_from_collection_for_select(@users , :id, :name), multiple: true, data: {placeholder: 'Select users'}, class: 'chosen span5' | |
123 | - %td= select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3"} | |
124 | - | |
125 | - %tr | |
126 | - %td= submit_tag 'Add', class: "btn btn-primary" | |
127 | - %td | |
128 | - Read more about project permissions | |
129 | - %strong= link_to "here", help_permissions_path, class: "vlink" | |
62 | + %li | |
63 | + %span.light access: | |
64 | + %strong | |
65 | + - if @project.public | |
66 | + %span.cblue | |
67 | + %i.icon-share | |
68 | + Public | |
69 | + - else | |
70 | + %span.cgreen | |
71 | + %i.icon-lock | |
72 | + Private | |
73 | + .span6 | |
74 | + .ui-box | |
75 | + %h5.title | |
76 | + Team | |
77 | + %small | |
78 | + (#{@project.users.count}) | |
79 | + = link_to project_team_index_path(@project), class: "btn btn-tiny" do | |
80 | + %i.icon-edit | |
81 | + Edit Team | |
82 | + %ul.well-list | |
83 | + - @project.users.each do |tm| | |
84 | + %li | |
85 | + %strong | |
86 | + = link_to tm.name, admin_user_path(tm) | |
87 | + %span.pull-right.light= @project.project_access_human(tm) | ... | ... |
config/routes.rb
... | ... | @@ -85,11 +85,7 @@ Gitlab::Application.routes.draw do |
85 | 85 | resource :logs, only: [:show] |
86 | 86 | resource :resque, controller: 'resque', only: [:show] |
87 | 87 | |
88 | - resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, except: [:new, :create] do | |
89 | - member do | |
90 | - get :team | |
91 | - put :team_update | |
92 | - end | |
88 | + resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] do | |
93 | 89 | scope module: :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do |
94 | 90 | resources :members, only: [:edit, :update, :destroy] |
95 | 91 | end | ... | ... |