Commit d0df8a6f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

remove project edit from admin area. Redesigned project page in admin area

parent e292d7c1
...@@ -19,34 +19,6 @@ class Admin::ProjectsController < Admin::ApplicationController ...@@ -19,34 +19,6 @@ class Admin::ProjectsController < Admin::ApplicationController
@users = @users.all @users = @users.all
end end
def edit
end
def team_update
@project.team.add_users_ids(params[:user_ids], params[:project_access])
redirect_to [:admin, @project], notice: 'Project was successfully updated.'
end
def update
project.creator = current_user unless project.creator
status = ::Projects::UpdateContext.new(project, current_user, params).execute(:admin)
if status
redirect_to [:admin, @project], notice: 'Project was successfully updated.'
else
render action: "edit"
end
end
def destroy
@project.team.truncate
@project.destroy
redirect_to admin_projects_path, notice: 'Project was successfully deleted.'
end
protected protected
def project def project
......
...@@ -52,8 +52,8 @@ ...@@ -52,8 +52,8 @@
%i.icon-lock.cgreen %i.icon-lock.cgreen
= link_to project.name_with_namespace, [:admin, project] = link_to project.name_with_namespace, [:admin, project]
.pull-right .pull-right
= link_to 'Edit', edit_admin_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small"
= link_to 'Destroy', [:admin, project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" = link_to 'Destroy', [project], confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
- if @projects.blank? - if @projects.blank?
%p.nothing_here_message 0 projects matches %p.nothing_here_message 0 projects matches
- else - else
......
%h3.page_title %h3.page_title
Project: #{@project.name_with_namespace} Project: #{@project.name_with_namespace}
= link_to edit_admin_project_path(@project), class: "btn pull-right" do = link_to edit_project_path(@project), class: "btn pull-right" do
%i.icon-edit %i.icon-edit
Edit Edit
%hr
.row
%br .span6
%table.zebra-striped .ui-box
%thead %h5.title
%tr Project info:
%th Project %ul.well-list
%th %li
%tr %span.light Name:
%td %strong= @project.name
%b %li
Name: %span.light Namespace:
%td %strong
= @project.name
%tr
%td
%b
Namespace:
%td
- if @project.namespace - if @project.namespace
= @project.namespace.human_name = link_to @project.namespace.human_name, [:admin, @project.group || @project.owner]
- else - else
Global Global
%tr %li
%td %span.light Owned by:
%b %strong
Owned by:
%td
- if @project.owner - if @project.owner
= link_to @project.owner_name, admin_user_path(@project.owner) = link_to @project.owner_name, admin_user_path(@project.owner)
- else - else
(deleted) (deleted)
%tr
%td %li
%b %span.light Created by:
Created by: %strong
%td
= @project.creator.try(:name) || '(deleted)' = @project.creator.try(:name) || '(deleted)'
%tr
%td %li
%b %span.light Created at:
Created at: %strong
%td
= @project.created_at.stamp("March 1, 1999") = @project.created_at.stamp("March 1, 1999")
%tr
%td %li
%b %span.light http:
Smart HTTP: %strong
%td
= link_to @project.http_url_to_repo = link_to @project.http_url_to_repo
%tr %li
%td %span.light ssh:
%b %strong
SSH:
%td
= link_to @project.ssh_url_to_repo = link_to @project.ssh_url_to_repo
- if @project.public %li
%tr.bgred %span.light fs:
%td %strong
%b = @repository.path_to_repo
Public Read-Only Code access:
%td
= check_box_tag 'public', nil, @project.public
- if @repository %li
%table.zebra-striped %span.light last commit:
%thead %strong
%tr - if @repository
%th Repository
%th
%tr
%td
%b
FS Path:
%td
%code= @repository.path_to_repo
%tr
%td
%b
Last commit at:
%td
= last_commit(@project) = last_commit(@project)
- else
never
%br %li
%h5 %span.light access:
%strong
- if @project.public
%span.cblue
%i.icon-share
Public
- else
%span.cgreen
%i.icon-lock
Private
.span6
.ui-box
%h5.title
Team Team
%small %small
(#{@project.users.count}) (#{@project.users.count})
%br = link_to project_team_index_path(@project), class: "btn btn-tiny" do
%table.zebra-striped.team_members %i.icon-edit
%thead Edit Team
%tr %ul.well-list
%th Name
%th Project Access
%th Repository Access
%th
- @project.users.each do |tm| - @project.users.each do |tm|
%tr %li
%td %strong
= link_to tm.name, admin_user_path(tm) = link_to tm.name, admin_user_path(tm)
%td= @project.project_access_human(tm) %span.pull-right.light= @project.project_access_human(tm)
%td= link_to 'Edit Access', edit_admin_project_member_path(@project, tm), class: "btn btn-small"
%td= link_to 'Remove from team', admin_project_member_path(@project, tm), confirm: 'Are you sure?', method: :delete, class: "btn btn-remove small"
%br
%h5 Add new team member
%br
= form_tag team_update_admin_project_path(@project), class: "bulk_import", method: :put do
%table.zebra-striped
%thead
%tr
%th Users
%th Project Access:
%tr
%td= select_tag :user_ids, options_from_collection_for_select(@users , :id, :name), multiple: true, data: {placeholder: 'Select users'}, class: 'chosen span5'
%td= select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3"}
%tr
%td= submit_tag 'Add', class: "btn btn-primary"
%td
Read more about project permissions
%strong= link_to "here", help_permissions_path, class: "vlink"
...@@ -85,11 +85,7 @@ Gitlab::Application.routes.draw do ...@@ -85,11 +85,7 @@ Gitlab::Application.routes.draw do
resource :logs, only: [:show] resource :logs, only: [:show]
resource :resque, controller: 'resque', only: [:show] resource :resque, controller: 'resque', only: [:show]
resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, except: [:new, :create] do resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] do
member do
get :team
put :team_update
end
scope module: :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do scope module: :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
resources :members, only: [:edit, :update, :destroy] resources :members, only: [:edit, :update, :destroy]
end end
......
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