summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorValeriy Sizov <vsv2711@gmail.com>2012-10-12 00:15:24 +0300
committerValeriy Sizov <vsv2711@gmail.com>2012-10-12 20:07:24 +0300
commite53b47b447b1f1ba8185aa07b8c53102c592ead8 (patch)
tree2f5e1f8deba8403fcf90ec29b3611b66881eb687 /app/controllers
parent02c83f122a28edc18e7e2184fa079c28e46375cb (diff)
downloadgitlab-ce-e53b47b447b1f1ba8185aa07b8c53102c592ead8.tar.gz
WebEditor: sceleton
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/tree_controller.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/controllers/tree_controller.rb b/app/controllers/tree_controller.rb
index 6224ed060e3..0a67e033b83 100644
--- a/app/controllers/tree_controller.rb
+++ b/app/controllers/tree_controller.rb
@@ -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