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
fd1c4f5f
Commit
fd1c4f5f
authored
Feb 15, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more refactoring
parent
bee837d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+15
-17
No files found.
app/helpers/blob_helper.rb
View file @
fd1c4f5f
...
...
@@ -27,7 +27,7 @@ module BlobHelper
elsif
!
current_user
||
user_can_modify_blob
(
blob
,
project
,
ref
)
edit_link_tag
(
edit_text
,
edit_blob_path
(
project
,
ref
,
path
,
options
),
common_classes
)
elsif
user_can_fork_project
(
project
)
edit_
blob_fork
(
common_classes
,
edit_blob_path
(
project
,
ref
,
path
,
options
),
project
)
edit_
fork_button_tag
(
common_classes
,
project
,
edit_text
,
edit_blob_fork_params
(
path
)
)
end
end
...
...
@@ -60,7 +60,7 @@ module BlobHelper
elsif
user_can_modify_blob
(
blob
,
project
,
ref
)
edit_link_tag
(
ide_edit_text
,
ide_edit_path
(
project
,
ref
,
path
,
options
),
common_classes
)
elsif
user_can_fork_project
(
project
)
edit_
blob_fork
(
common_classes
,
edit_blob_path
(
project
,
ref
,
path
,
options
),
project
)
edit_
fork_button_tag
(
common_classes
,
project
,
ide_edit_text
,
edit_blob_fork_params
(
path
)
)
end
end
...
...
@@ -84,7 +84,7 @@ module BlobHelper
elsif
can_modify_blob?
(
blob
,
project
,
ref
)
button_tag
label
,
class:
"
#{
common_classes
}
"
,
'data-target'
=>
"#modal-
#{
modal_type
}
-blob"
,
'data-toggle'
=>
'modal'
elsif
can?
(
current_user
,
:fork_project
,
project
)
edit_
modify_file_fork
(
action
,
common_classes
,
label
,
project
)
edit_
fork_button_tag
(
common_classes
,
project
,
label
,
edit_modify_file_fork_params
(
action
)
)
end
end
...
...
@@ -319,30 +319,28 @@ module BlobHelper
blob
if
blob
&
.
readable_text?
end
def
edit_blob_fork
(
common_classes
,
path
,
project
)
continue_params
=
{
def
edit_blob_fork
_params
(
path
)
{
to:
path
,
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
edit_text
,
class:
"
#{
common_classes
}
js-edit-blob-link-fork-toggler"
,
data:
{
action:
'edit'
,
fork_path:
fork_path
}
end
def
edit_modify_file_fork
(
action
,
common_classes
,
label
,
project
)
continue_params
=
{
to:
request
.
fullpath
,
notice:
edit_in_new_fork_notice
+
" Try to
#{
action
}
this file again."
,
def
edit_modify_file_fork
_params
(
action
)
{
to:
request
.
full
_
path
,
notice:
edit_in_new_fork_notice
_action
(
action
)
,
notice_now:
edit_in_new_fork_notice_now
}
fork_path
=
project_forks_path
(
project
,
namespace_key:
current_user
.
namespace
.
id
,
continue:
continue_params
)
end
def
edit_fork_button_tag
(
common_classes
,
project
,
label
,
params
)
fork_path
=
project_forks_path
(
project
,
namespace_key:
current_user
.
namespace
.
id
,
continue:
params
)
button_tag
label
,
button_tag
edit_text
,
class:
"
#{
common_classes
}
js-edit-blob-link-fork-toggler"
,
data:
{
action:
action
,
fork_path:
fork_path
}
data:
{
action:
'edit'
,
fork_path:
fork_path
}
end
def
edit_button_tag
(
button_text
,
common_classes
)
...
...
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