2013-11-05 10:21:11 +00:00
|
|
|
class Projects::NewTreeController < Projects::BaseTreeController
|
|
|
|
before_filter :require_branch_head
|
2014-10-13 19:31:49 +00:00
|
|
|
before_filter :authorize_push_code!
|
2013-11-05 08:28:49 +00:00
|
|
|
|
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2013-11-20 08:03:50 +00:00
|
|
|
file_path = File.join(@path, File.basename(params[:file_name]))
|
2014-01-16 17:03:42 +00:00
|
|
|
result = Files::CreateService.new(@project, current_user, params, @ref, file_path).execute
|
2013-11-05 08:28:49 +00:00
|
|
|
|
2013-11-05 10:06:52 +00:00
|
|
|
if result[:status] == :success
|
2013-12-16 08:57:50 +00:00
|
|
|
flash[:notice] = "Your changes have been successfully committed"
|
2013-11-20 08:03:50 +00:00
|
|
|
redirect_to project_blob_path(@project, File.join(@ref, file_path))
|
2013-11-05 08:28:49 +00:00
|
|
|
else
|
2014-09-24 16:15:37 +00:00
|
|
|
flash[:alert] = result[:message]
|
2013-11-05 08:28:49 +00:00
|
|
|
render :show
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|