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
Léo-Paul Géneau
gitlab-ce
Commits
cb31b369
Commit
cb31b369
authored
Feb 07, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a bit more refactoring
parent
699607f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
25 deletions
+3
-25
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+3
-25
No files found.
app/helpers/blob_helper.rb
View file @
cb31b369
...
@@ -41,11 +41,7 @@ module BlobHelper
...
@@ -41,11 +41,7 @@ module BlobHelper
def
ide_blob_link
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
def
ide_blob_link
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
return
unless
show_new_ide?
return
unless
show_new_ide?
return
unless
readable_blob?
(
options
,
path
,
project
,
ref
)
blob
=
options
.
delete
(
:blob
)
blob
||=
project
.
repository
.
blob_at
(
ref
,
path
)
rescue
nil
return
unless
blob
&&
blob
.
readable_text?
common_classes
=
"btn js-edit-ide
#{
options
[
:extra_class
]
}
"
common_classes
=
"btn js-edit-ide
#{
options
[
:extra_class
]
}
"
...
@@ -55,16 +51,7 @@ module BlobHelper
...
@@ -55,16 +51,7 @@ module BlobHelper
elsif
current_user
&&
can_modify_blob?
(
blob
,
project
,
ref
)
elsif
current_user
&&
can_modify_blob?
(
blob
,
project
,
ref
)
link_to
ide_edit_text
,
ide_edit_path
(
project
,
ref
,
path
,
options
),
class:
"
#{
common_classes
}
btn-sm"
link_to
ide_edit_text
,
ide_edit_path
(
project
,
ref
,
path
,
options
),
class:
"
#{
common_classes
}
btn-sm"
elsif
current_user
&&
can?
(
current_user
,
:fork_project
,
project
)
elsif
current_user
&&
can?
(
current_user
,
:fork_project
,
project
)
continue_params
=
{
edit_blob_fork
(
common_classes
,
options
,
path
,
project
,
ref
)
to:
ide_edit_path
(
project
,
ref
,
path
,
options
),
notice:
edit_in_new_fork_notice
,
notice_now:
edit_in_new_fork_notice_now
}
fork_path
=
project_forks_path
(
project
,
namespace_key:
current_user
.
namespace
.
id
,
continue:
continue_params
)
button_tag
ide_edit_text
,
class:
common_classes
,
data:
{
fork_path:
fork_path
}
end
end
end
end
...
@@ -84,16 +71,7 @@ module BlobHelper
...
@@ -84,16 +71,7 @@ module BlobHelper
elsif
can_modify_blob?
(
blob
,
project
,
ref
)
elsif
can_modify_blob?
(
blob
,
project
,
ref
)
button_tag
label
,
class:
"
#{
common_classes
}
"
,
'data-target'
=>
"#modal-
#{
modal_type
}
-blob"
,
'data-toggle'
=>
'modal'
button_tag
label
,
class:
"
#{
common_classes
}
"
,
'data-target'
=>
"#modal-
#{
modal_type
}
-blob"
,
'data-toggle'
=>
'modal'
elsif
can?
(
current_user
,
:fork_project
,
project
)
elsif
can?
(
current_user
,
:fork_project
,
project
)
continue_params
=
{
edit_blob_fork
(
common_classes
,
options
,
path
,
project
,
ref
)
to:
request
.
fullpath
,
notice:
edit_in_new_fork_notice
+
" Try to
#{
action
}
this file again."
,
notice_now:
edit_in_new_fork_notice_now
}
fork_path
=
project_forks_path
(
project
,
namespace_key:
current_user
.
namespace
.
id
,
continue:
continue_params
)
button_tag
label
,
class:
"
#{
common_classes
}
js-edit-blob-link-fork-toggler"
,
data:
{
action:
action
,
fork_path:
fork_path
}
end
end
end
end
...
...
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