diff options
author | Valeriy Sizov <vsv2711@gmail.com> | 2012-10-16 04:03:38 -0700 |
---|---|---|
committer | Valeriy Sizov <vsv2711@gmail.com> | 2012-10-16 04:03:38 -0700 |
commit | 2a750bf2ca649fb7aac6ae352a6eb1c4d7820c9f (patch) | |
tree | 2ac00ef792152685090f3d72e8ca66c58414fdf5 | |
parent | 76e1ca64301d52fb25b0a0e8cb9d513ba7d33c46 (diff) | |
parent | 8e8d82d49ac80b230e89f034f7aac00ddd555d1e (diff) | |
download | gitlab-ce-2a750bf2ca649fb7aac6ae352a6eb1c4d7820c9f.tar.gz |
Merge pull request #1704 from riyad/small-file-edit-fixes
Small fixes for editing files
-rw-r--r-- | app/controllers/tree_controller.rb | 13 |
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 |