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:
commit
a967f1229b
2 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue