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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
c888e73b
Commit
c888e73b
authored
Feb 23, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor methods inline
parent
73c4c995
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+6
-6
app/views/projects/tree/_tree_header.html.haml
app/views/projects/tree/_tree_header.html.haml
+1
-1
spec/helpers/blob_helper_spec.rb
spec/helpers/blob_helper_spec.rb
+1
-1
No files found.
app/helpers/blob_helper.rb
View file @
c888e73b
...
@@ -16,6 +16,10 @@ module BlobHelper
...
@@ -16,6 +16,10 @@ module BlobHelper
options
[
:link_opts
])
options
[
:link_opts
])
end
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_blob_button
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
def
edit_blob_button
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
return
unless
blob
=
readable_blob
(
options
,
path
,
project
,
ref
)
return
unless
blob
=
readable_blob
(
options
,
path
,
project
,
ref
)
...
@@ -29,10 +33,6 @@ module BlobHelper
...
@@ -29,10 +33,6 @@ module BlobHelper
ref
)
ref
)
end
end
def
display_modify_blob?
(
blob
,
project
,
ref
)
!
current_user
||
(
current_user
&&
can_modify_blob?
(
blob
,
project
,
ref
))
end
def
ide_edit_button
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
def
ide_edit_button
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
return
unless
show_new_ide?
return
unless
show_new_ide?
return
unless
blob
=
readable_blob
(
options
,
path
,
project
,
ref
)
return
unless
blob
=
readable_blob
(
options
,
path
,
project
,
ref
)
...
@@ -42,7 +42,7 @@ module BlobHelper
...
@@ -42,7 +42,7 @@ module BlobHelper
edit_button_tag
(
blob
,
edit_button_tag
(
blob
,
common_classes
,
common_classes
,
_
(
'Web IDE'
),
_
(
'Web IDE'
),
"
#{
ide_path
}
/project
#{
edit_blob_path
(
project
,
ref
,
path
,
options
)
}
"
,
ide_edit_path
(
project
,
ref
,
path
,
options
)
,
project
,
project
,
ref
)
ref
)
end
end
...
@@ -335,7 +335,7 @@ module BlobHelper
...
@@ -335,7 +335,7 @@ module BlobHelper
edit_disabled_button_tag
(
text
,
common_classes
)
edit_disabled_button_tag
(
text
,
common_classes
)
# This condition only applies to users who are logged in
# This condition only applies to users who are logged in
# Web IDE (Beta) requires the user to have this feature enabled
# Web IDE (Beta) requires the user to have this feature enabled
elsif
display_modify_blob?
(
blob
,
project
,
ref
)
elsif
!
current_user
||
(
current_user
&&
can_modify_blob?
(
blob
,
project
,
ref
)
)
edit_link_tag
(
text
,
edit_path
,
common_classes
)
edit_link_tag
(
text
,
edit_path
,
common_classes
)
elsif
current_user
&&
can?
(
current_user
,
: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
))
edit_fork_button_tag
(
common_classes
,
project
,
text
,
edit_blob_fork_params
(
edit_path
))
...
...
app/views/projects/tree/_tree_header.html.haml
View file @
c888e73b
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
.tree-controls
.tree-controls
-
if
show_new_ide?
-
if
show_new_ide?
=
succeed
" "
do
=
succeed
" "
do
=
link_to
"
#{
ide_path
}
/project
#{
edit_blob_path
(
@project
,
@id
,
@path
,
{
}
)}"
,
class:
'btn btn-default'
do
=
link_to
ide_edit_path
(
@project
,
@id
)
,
class:
'btn btn-default'
do
=
_
(
'Web IDE'
)
=
_
(
'Web IDE'
)
=
link_to
s_
(
'Commits|History'
),
project_commits_path
(
@project
,
@id
),
class:
'btn'
=
link_to
s_
(
'Commits|History'
),
project_commits_path
(
@project
,
@id
),
class:
'btn'
...
...
spec/helpers/blob_helper_spec.rb
View file @
c888e73b
...
@@ -74,7 +74,7 @@ describe BlobHelper do
...
@@ -74,7 +74,7 @@ describe BlobHelper do
end
end
end
end
describe
"#edit_blob_
element
"
do
describe
"#edit_blob_
link
"
do
let
(
:namespace
)
{
create
(
:namespace
,
name:
'gitlab'
)}
let
(
:namespace
)
{
create
(
:namespace
,
name:
'gitlab'
)}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
namespace
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
namespace
)
}
...
...
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