WebEditor: base implementation

This commit is contained in:
Valeriy Sizov 2012-10-12 17:14:52 +03:00
parent 0b3e9fd218
commit 42bdfd021b
4 changed files with 55 additions and 10 deletions

View file

@ -26,8 +26,14 @@ class TreeController < ProjectResourceController
def update
file_editor = Gitlab::FileEditor.new(current_user, @project, @ref)
if file_editor.can_edit?(@path, params[:last_commit])
file_editor.update(@path, params[:content])
update_status = file_editor.update(
@path,
params[:content],
params[:commit_message],
params[:last_commit]
)
if update_status
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"