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
ab3c8302
Commit
ab3c8302
authored
Aug 29, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes the diff changes buttons from toggling when scrolling
Closes #36698
parent
c274da06
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
1 deletion
+18
-1
app/assets/javascripts/lib/utils/sticky.js
app/assets/javascripts/lib/utils/sticky.js
+1
-1
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+1
-0
changelogs/unreleased/changes-bar-sticky-fix.yml
changelogs/unreleased/changes-bar-sticky-fix.yml
+5
-0
spec/javascripts/merge_request_tabs_spec.js
spec/javascripts/merge_request_tabs_spec.js
+11
-0
No files found.
app/assets/javascripts/lib/utils/sticky.js
View file @
ab3c8302
export
const
isSticky
=
(
el
,
scrollY
,
stickyTop
)
=>
{
export
const
isSticky
=
(
el
,
scrollY
,
stickyTop
)
=>
{
const
top
=
el
.
offsetTop
-
scrollY
;
const
top
=
Math
.
floor
(
el
.
offsetTop
-
scrollY
)
;
if
(
top
<=
stickyTop
)
{
if
(
top
<=
stickyTop
)
{
el
.
classList
.
add
(
'
is-stuck
'
);
el
.
classList
.
add
(
'
is-stuck
'
);
...
...
app/assets/javascripts/merge_request_tabs.js
View file @
ab3c8302
...
@@ -253,6 +253,7 @@ import bp from './breakpoints';
...
@@ -253,6 +253,7 @@ import bp from './breakpoints';
loadDiff
(
source
)
{
loadDiff
(
source
)
{
if
(
this
.
diffsLoaded
)
{
if
(
this
.
diffsLoaded
)
{
document
.
dispatchEvent
(
new
CustomEvent
(
'
scroll
'
));
return
;
return
;
}
}
...
...
changelogs/unreleased/changes-bar-sticky-fix.yml
0 → 100644
View file @
ab3c8302
---
title
:
Fixed diff changes bar buttons from showing/hiding whilst scrolling
merge_request
:
author
:
type
:
fixed
spec/javascripts/merge_request_tabs_spec.js
View file @
ab3c8302
...
@@ -295,6 +295,17 @@ import 'vendor/jquery.scrollTo';
...
@@ -295,6 +295,17 @@ import 'vendor/jquery.scrollTo';
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
});
});
it
(
'
triggers scroll event when diff already loaded
'
,
function
()
{
spyOn
(
document
,
'
dispatchEvent
'
);
this
.
class
.
diffsLoaded
=
true
;
this
.
class
.
loadDiff
(
'
/foo/bar/merge_requests/1/diffs
'
);
expect
(
document
.
dispatchEvent
,
).
toHaveBeenCalledWith
(
new
CustomEvent
(
'
scroll
'
));
});
describe
(
'
with inline diff
'
,
()
=>
{
describe
(
'
with inline diff
'
,
()
=>
{
let
noteId
;
let
noteId
;
let
noteLineNumId
;
let
noteLineNumId
;
...
...
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