Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorValeriy Sizov <vsv2711@gmail.com>2012-10-12 01:15:24 +0400
committerValeriy Sizov <vsv2711@gmail.com>2012-10-12 21:07:24 +0400
commite53b47b447b1f1ba8185aa07b8c53102c592ead8 (patch)
tree2f5e1f8deba8403fcf90ec29b3611b66881eb687 /app
parent02c83f122a28edc18e7e2184fa079c28e46375cb (diff)
WebEditor: sceleton
Diffstat (limited to 'app')
-rw-r--r--app/controllers/tree_controller.rb8
-rw-r--r--app/views/tree/edit.html.haml4
2 files changed, 10 insertions, 2 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
diff --git a/app/views/tree/edit.html.haml b/app/views/tree/edit.html.haml
index c65d8fd33ef..170001a8bdd 100644
--- a/app/views/tree/edit.html.haml
+++ b/app/views/tree/edit.html.haml
@@ -8,9 +8,9 @@
#editor= @tree.data
.editor-commit-comment
- = label_tag 'text-commit' do
+ = label_tag 'commit_message' do
%p.slead Commit message
- = text_area_tag 'text_commit'
+ = text_area_tag 'commit_message'
.form-actions
= hidden_field_tag 'last_commit', @last_commit
= hidden_field_tag 'content'