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
26a80149
Commit
26a80149
authored
Dec 13, 2016
by
Mike Greiling
Committed by
Alfredo Sumaran
Dec 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
factor out common code to satisfy rake flay
parent
35adeee5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
18 deletions
+16
-18
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+16
-18
No files found.
app/helpers/commits_helper.rb
View file @
26a80149
...
...
@@ -136,15 +136,7 @@ module CommitsHelper
if
can_collaborate_with_project?
link_to
'Revert'
,
'#modal-revert-commit'
,
'data-toggle'
=>
'modal'
,
'data-container'
=>
'body'
,
title:
(
tooltip
if
has_tooltip
),
class:
"
#{
btn_class
}
#{
'has-tooltip'
if
has_tooltip
}
"
elsif
can?
(
current_user
,
:fork_project
,
@project
)
continue_params
=
{
to:
continue_to_path
,
notice:
edit_in_new_fork_notice
+
' Try to revert this commit again.'
,
notice_now:
edit_in_new_fork_notice_now
}
fork_path
=
namespace_project_forks_path
(
@project
.
namespace
,
@project
,
namespace_key:
current_user
.
namespace
.
id
,
continue:
continue_params
)
fork_path
=
fork_path_url
(
continue_to_path
,
message:
'Try to revert this commit again.'
)
link_to
'Revert'
,
fork_path
,
class:
btn_class
,
method: :post
,
'data-toggle'
=>
'tooltip'
,
'data-container'
=>
'body'
,
title:
(
tooltip
if
has_tooltip
)
end
end
...
...
@@ -158,15 +150,7 @@ module CommitsHelper
if
can_collaborate_with_project?
link_to
'Cherry-pick'
,
'#modal-cherry-pick-commit'
,
'data-toggle'
=>
'modal'
,
'data-container'
=>
'body'
,
title:
(
tooltip
if
has_tooltip
),
class:
"
#{
btn_class
}
#{
'has-tooltip'
if
has_tooltip
}
"
elsif
can?
(
current_user
,
:fork_project
,
@project
)
continue_params
=
{
to:
continue_to_path
,
notice:
edit_in_new_fork_notice
+
' Try to cherry-pick this commit again.'
,
notice_now:
edit_in_new_fork_notice_now
}
fork_path
=
namespace_project_forks_path
(
@project
.
namespace
,
@project
,
namespace_key:
current_user
.
namespace
.
id
,
continue:
continue_params
)
fork_path
=
fork_path_url
(
continue_to_path
,
message:
'Try to cherry-pick this commit again.'
)
link_to
'Cherry-pick'
,
fork_path
,
class:
btn_class
,
method: :post
,
'data-toggle'
=>
'tooltip'
,
'data-container'
=>
'body'
,
title:
(
tooltip
if
has_tooltip
)
end
end
...
...
@@ -208,6 +192,20 @@ module CommitsHelper
end
end
def
fork_path_url
(
continue_to_path
,
message:
nil
)
notice
=
edit_in_new_fork_notice
notice
<<
"
#{
message
}
"
unless
message
.
nil?
continue_params
=
{
to:
continue_to_path
,
notice:
notice
,
notice_now:
edit_in_new_fork_notice_now
}
fork_path
=
namespace_project_forks_path
(
@project
.
namespace
,
@project
,
namespace_key:
current_user
.
namespace
.
id
,
continue:
continue_params
)
end
def
view_file_btn
(
commit_sha
,
diff_new_path
,
project
)
link_to
(
namespace_project_blob_path
(
project
.
namespace
,
project
,
...
...
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