Commit a967f122 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

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

Check if a file is editied "on" a branch or a commit.
parents ee0e9830 cc505f55
......@@ -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
.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?
......
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