BigW Consortium Gitlab

Commit e53b47b4 by Valeriy Sizov

WebEditor: sceleton

parent 02c83f12
......@@ -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
......@@ -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'
......
module Gitlab
class FileEditor
attr_accessor :user, :project
def initialize(user, project)
self.user = user
self.project = project
end
def can_edit?(path, last_commit)
true
end
def update(path, content)
true
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment