Merge pull request #5484 from jojosch/edit-file-on-commit-disable

Check if a file is editied "on" a branch or a commit.
This commit is contained in:
Dmitriy Zaporozhets 2013-10-30 07:54:06 -07:00
commit a967f1229b
2 changed files with 8 additions and 1 deletions

View File

@ -45,5 +45,9 @@ class Projects::EditTreeController < Projects::ApplicationController
end
return access_denied! unless allowed
unless @repository.branch_names.include?(@ref)
redirect_to project_blob_path(@project, @id), notice: "You can only edit this file if you are on top of a branch"
end
end
end

View File

@ -1,7 +1,10 @@
.btn-group.tree-btn-group
-# only show edit link for text files
- if @blob.text?
= link_to "edit", project_edit_tree_path(@project, @id), class: "btn btn-small", disabled: !allowed_tree_edit?
- if allowed_tree_edit?
= link_to "edit", project_edit_tree_path(@project, @id), class: "btn btn-small"
- else
%span.btn.btn-small.disabled Edit
= link_to "raw", project_raw_path(@project, @id), class: "btn btn-small", target: "_blank"
-# only show normal/blame view links for text files
- if @blob.text?