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
iv
gitlab-ce
Commits
5ba79f49
Commit
5ba79f49
authored
Apr 12, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Syntax and code improvements
parent
7f263ca1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
14 deletions
+17
-14
app/helpers/diff_helper.rb
app/helpers/diff_helper.rb
+13
-11
spec/features/merge_requests/toggle_whitespace_changes.rb
spec/features/merge_requests/toggle_whitespace_changes.rb
+4
-3
No files found.
app/helpers/diff_helper.rb
View file @
5ba79f49
...
...
@@ -129,6 +129,18 @@ module DiffHelper
end
end
def
commit_diff_whitespace_link
(
project
,
commit
)
url
=
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
.
id
,
params_with_whitespace
)
toggle_whitespace_link
(
url
)
end
def
diff_merge_request_whitespace_link
(
project
,
merge_request
)
url
=
diffs_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
,
params_with_whitespace
)
toggle_whitespace_link
(
url
)
end
private
def
hide_whitespace?
params
[
:w
]
==
'1'
end
...
...
@@ -138,16 +150,6 @@ module DiffHelper
end
def
toggle_whitespace_link
(
url
)
link_to
"
#{
hide_whitespace?
?
'Show'
:
'Hide'
}
whitespace changes"
,
url
,
class:
"btn btn-default"
end
def
commit_diff_whitespace_link
(
project
,
commit
)
url
=
namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
.
id
,
params_with_whitespace
)
toggle_whitespace_link
(
url
)
end
def
diff_merge_request_whitespace_link
(
project
,
merge_request
)
url
=
diffs_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
,
params_with_whitespace
)
toggle_whitespace_link
(
url
)
link_to
"
#{
hide_whitespace?
?
'Show'
:
'Hide'
}
whitespace changes"
,
url
,
class:
'btn btn-default'
end
end
spec/features/merge_requests/toggle_whitespace_changes.rb
View file @
5ba79f49
...
...
@@ -9,13 +9,14 @@ feature 'Toggle Whitespace Changes', js: true, feature: true do
end
it
'has a button to toggle whitespace changes'
do
expect
(
page
).
to
have_content
"Hide whitespace changes"
expect
(
page
).
to
have_content
'Hide whitespace changes'
end
describe
'clicking "Hide whitespace changes" button'
do
it
'toggles the "Hide whitespace changes" button'
do
click_link
"Hide whitespace changes"
expect
(
page
).
to
have_content
"Show whitespace changes"
click_link
'Hide whitespace changes'
expect
(
page
).
to
have_content
'Show whitespace changes'
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