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-16 15:03:38 +0400
committerValeriy Sizov <vsv2711@gmail.com>2012-10-16 15:03:38 +0400
commit2a750bf2ca649fb7aac6ae352a6eb1c4d7820c9f (patch)
tree2ac00ef792152685090f3d72e8ca66c58414fdf5 /app
parent76e1ca64301d52fb25b0a0e8cb9d513ba7d33c46 (diff)
parent8e8d82d49ac80b230e89f034f7aac00ddd555d1e (diff)
Merge pull request #1704 from riyad/small-file-edit-fixes
Small fixes for editing files
Diffstat (limited to 'app')
-rw-r--r--app/controllers/tree_controller.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/controllers/tree_controller.rb b/app/controllers/tree_controller.rb
index 475e2b61a18..c9098cca678 100644
--- a/app/controllers/tree_controller.rb
+++ b/app/controllers/tree_controller.rb
@@ -8,6 +8,7 @@ class TreeController < ProjectResourceController
before_filter :require_non_empty_project
before_filter :assign_ref_vars
+ before_filter :edit_requirements, only: [:edit, :update]
def show
@hex_path = Digest::SHA1.hexdigest(@path)
@@ -34,10 +35,18 @@ class TreeController < ProjectResourceController
)
if update_status
- redirect_to project_tree_path(@project, @id), :notice => "File has been successfully changed"
+ redirect_to project_tree_path(@project, @id), notice: "Your changes have been successfully commited"
else
- flash[:notice] = "You can't save file because it has been changed"
+ flash[:notice] = "Your changes could not be commited, because the file has been changed"
render :edit
end
end
+
+ private
+
+ def edit_requirements
+ unless @tree.is_blob? && @tree.text?
+ redirect_to project_tree_path(@project, @id), notice: "You can only edit text files"
+ end
+ end
end