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
Jérome Perrin
gitlab-ce
Commits
437d4c76
Commit
437d4c76
authored
Nov 17, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duplication in diff_helper.rb
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
5f239093
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
app/helpers/diff_helper.rb
app/helpers/diff_helper.rb
+16
-16
No files found.
app/helpers/diff_helper.rb
View file @
437d4c76
...
@@ -132,25 +132,11 @@ module DiffHelper
...
@@ -132,25 +132,11 @@ module DiffHelper
end
end
def
inline_diff_btn
def
inline_diff_btn
params_copy
=
params
.
dup
diff_btn
(
'Inline'
,
'inline'
,
params
[
:view
]
!=
'parallel'
)
params_copy
[
:view
]
=
'inline'
# Always use HTML to handle case where JSON diff rendered this button
params_copy
.
delete
(
:format
)
link_to
url_for
(
params_copy
),
id:
"inline-diff-btn"
,
class:
(
params
[
:view
]
!=
'parallel'
?
'btn active'
:
'btn'
)
do
'Inline'
end
end
end
def
parallel_diff_btn
def
parallel_diff_btn
params_copy
=
params
.
dup
diff_btn
(
'Side-by-side'
,
'parallel'
,
params
[
:view
]
==
'parallel'
)
params_copy
[
:view
]
=
'parallel'
# Always use HTML to handle case where JSON diff rendered this button
params_copy
.
delete
(
:format
)
link_to
url_for
(
params_copy
),
id:
"parallel-diff-btn"
,
class:
(
params
[
:view
]
==
'parallel'
?
'btn active'
:
'btn'
)
do
'Side-by-side'
end
end
end
def
submodule_link
(
blob
,
ref
,
repository
=
@repository
)
def
submodule_link
(
blob
,
ref
,
repository
=
@repository
)
...
@@ -187,4 +173,18 @@ module DiffHelper
...
@@ -187,4 +173,18 @@ module DiffHelper
def
editable_diff?
(
diff
)
def
editable_diff?
(
diff
)
!
diff
.
deleted_file
&&
@merge_request
&&
@merge_request
.
source_project
!
diff
.
deleted_file
&&
@merge_request
&&
@merge_request
.
source_project
end
end
private
def
diff_btn
(
title
,
name
,
selected
)
params_copy
=
params
.
dup
params_copy
[
:view
]
=
name
# Always use HTML to handle case where JSON diff rendered this button
params_copy
.
delete
(
:format
)
link_to
url_for
(
params_copy
),
id:
"
#{
name
}
-diff-btn"
,
class:
(
selected
?
'btn active'
:
'btn'
)
do
title
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