Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a967f122
Commit
a967f122
authored
Oct 30, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
app/controllers/projects/edit_tree_controller.rb
app/controllers/projects/edit_tree_controller.rb
+4
-0
app/views/projects/blob/_actions.html.haml
app/views/projects/blob/_actions.html.haml
+4
-1
No files found.
app/controllers/projects/edit_tree_controller.rb
View file @
a967f122
...
...
@@ -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
app/views/projects/blob/_actions.html.haml
View file @
a967f122
.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?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment