WebEditor: sceleton

This commit is contained in:
Valeriy Sizov 2012-10-12 00:15:24 +03:00
parent 02c83f122a
commit e53b47b447
3 changed files with 30 additions and 2 deletions

View file

@ -26,5 +26,13 @@ class TreeController < ProjectResourceController
def update
last_commit = @project.commits(@ref, @path, 1).first.sha
file_editor = Gitlab::FileEditor.new(current_user, @project)
if file_editor.can_edit?(@path, last_commit)
file_editor.update(@path, params[:content])
redirect_to project_tree_path(@project, @id), :notice => "File has been successfully changed"
else
flash[:notice] = "You can't save file because it has been changed"
render :edit
end
end
end