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
73c4c995
Commit
73c4c995
authored
Feb 23, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inline methods
parent
b8028c6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
25 deletions
+9
-25
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+7
-23
app/views/projects/tree/_tree_header.html.haml
app/views/projects/tree/_tree_header.html.haml
+2
-2
No files found.
app/helpers/blob_helper.rb
View file @
73c4c995
...
...
@@ -23,32 +23,16 @@ module BlobHelper
edit_button_tag
(
blob
,
common_classes
,
edit_text
,
_
(
'Edit'
)
,
edit_blob_path
(
project
,
ref
,
path
,
options
),
project
,
ref
)
end
def
user_can_fork_project?
(
project
)
current_user
&&
can?
(
current_user
,
:fork_project
,
project
)
end
def
display_modify_blob?
(
blob
,
project
,
ref
)
!
current_user
||
(
current_user
&&
can_modify_blob?
(
blob
,
project
,
ref
))
end
def
ide_edit_path
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
"
#{
ide_path
}
/project
#{
edit_blob_path
(
project
,
ref
,
path
,
options
)
}
"
end
def
edit_text
_
(
'Edit'
)
end
def
ide_edit_text
_
(
'Web IDE'
)
end
def
ide_edit_button
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
return
unless
show_new_ide?
return
unless
blob
=
readable_blob
(
options
,
path
,
project
,
ref
)
...
...
@@ -57,13 +41,13 @@ module BlobHelper
edit_button_tag
(
blob
,
common_classes
,
ide_edit_text
,
ide_edit_path
(
project
,
ref
,
path
,
options
)
,
_
(
'Web IDE'
)
,
"
#{
ide_path
}
/project
#{
edit_blob_path
(
project
,
ref
,
path
,
options
)
}
"
,
project
,
ref
)
end
def
modify_file_
element
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
label
:,
action
:,
btn_class
:,
modal_type
:)
def
modify_file_
button
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
label
:,
action
:,
btn_class
:,
modal_type
:)
return
unless
current_user
blob
=
project
.
repository
.
blob_at
(
ref
,
path
)
rescue
nil
...
...
@@ -84,7 +68,7 @@ module BlobHelper
end
def
replace_blob_link
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
)
modify_file_
element
(
modify_file_
button
(
project
,
ref
,
path
,
...
...
@@ -96,7 +80,7 @@ module BlobHelper
end
def
delete_blob_link
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
)
modify_file_
element
(
modify_file_
button
(
project
,
ref
,
path
,
...
...
@@ -353,7 +337,7 @@ module BlobHelper
# Web IDE (Beta) requires the user to have this feature enabled
elsif
display_modify_blob?
(
blob
,
project
,
ref
)
edit_link_tag
(
text
,
edit_path
,
common_classes
)
elsif
user_can_fork_project?
(
project
)
elsif
current_user
&&
can?
(
current_user
,
:fork_project
,
project
)
edit_fork_button_tag
(
common_classes
,
project
,
text
,
edit_blob_fork_params
(
edit_path
))
end
end
...
...
app/views/projects/tree/_tree_header.html.haml
View file @
73c4c995
...
...
@@ -74,8 +74,8 @@
.tree-controls
-
if
show_new_ide?
=
succeed
" "
do
=
link_to
ide_edit_path
(
@project
,
@id
)
,
class:
'btn btn-default'
do
=
ide_edit_text
=
link_to
"
#{
ide_path
}
/project
#{
edit_blob_path
(
@project
,
@id
,
@path
,
{
}
)}"
,
class:
'btn btn-default'
do
=
_
(
'Web IDE'
)
=
link_to
s_
(
'Commits|History'
),
project_commits_path
(
@project
,
@id
),
class:
'btn'
...
...
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