add ability to change namespace from project edit page

This commit is contained in:
Dmitriy Zaporozhets 2012-11-24 22:00:30 +02:00
parent f997947664
commit f37fa968b2
9 changed files with 64 additions and 26 deletions

View file

@ -64,9 +64,8 @@ class ApplicationController < ActionController::Base
def project
id = params[:project_id] || params[:id]
id = id.split("/") if id.include?("/")
@project ||= current_user.projects.find_by_path(id)
@project ||= current_user.projects.find_with_namespace(id)
@project || render_404
end

View file

@ -4,6 +4,7 @@ class GroupsController < ApplicationController
before_filter :group
before_filter :projects
before_filter :add_project_abilities
def show
@events = Event.in_projects(project_ids).limit(20).offset(params[:offset] || 0)

View file

@ -34,8 +34,16 @@ class ProjectsController < ProjectResourceController
end
def update
namespace_id = params[:project].delete(:namespace_id)
if namespace_id
namespace = Namespace.find(namespace_id)
project.transfer(namespace)
end
respond_to do |format|
if project.update_attributes(params[:project])
flash[:notice] = 'Project was successfully updated.'
format.html { redirect_to edit_project_path(project), notice: 'Project was successfully updated.' }
format.js
else