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
cae8bd37
Commit
cae8bd37
authored
Apr 13, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes the ID for the performance bar to correctly sticky the stat bar to the top
parent
4758db5a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
28 deletions
+21
-28
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+21
-28
No files found.
app/assets/javascripts/merge_request_tabs.js
View file @
cae8bd37
...
@@ -7,11 +7,7 @@ import flash from './flash';
...
@@ -7,11 +7,7 @@ import flash from './flash';
import
BlobForkSuggestion
from
'
./blob/blob_fork_suggestion
'
;
import
BlobForkSuggestion
from
'
./blob/blob_fork_suggestion
'
;
import
initChangesDropdown
from
'
./init_changes_dropdown
'
;
import
initChangesDropdown
from
'
./init_changes_dropdown
'
;
import
bp
from
'
./breakpoints
'
;
import
bp
from
'
./breakpoints
'
;
import
{
import
{
parseUrlPathname
,
handleLocationHash
,
isMetaClick
}
from
'
./lib/utils/common_utils
'
;
parseUrlPathname
,
handleLocationHash
,
isMetaClick
,
}
from
'
./lib/utils/common_utils
'
;
import
{
getLocationHash
}
from
'
./lib/utils/url_utility
'
;
import
{
getLocationHash
}
from
'
./lib/utils/url_utility
'
;
import
initDiscussionTab
from
'
./image_diff/init_discussion_tab
'
;
import
initDiscussionTab
from
'
./image_diff/init_discussion_tab
'
;
import
Diff
from
'
./diff
'
;
import
Diff
from
'
./diff
'
;
...
@@ -69,11 +65,10 @@ import Notes from './notes';
...
@@ -69,11 +65,10 @@ import Notes from './notes';
let
location
=
window
.
location
;
let
location
=
window
.
location
;
export
default
class
MergeRequestTabs
{
export
default
class
MergeRequestTabs
{
constructor
({
action
,
setUrl
,
stubLocation
}
=
{})
{
constructor
({
action
,
setUrl
,
stubLocation
}
=
{})
{
const
mergeRequestTabs
=
document
.
querySelector
(
'
.js-tabs-affix
'
);
const
mergeRequestTabs
=
document
.
querySelector
(
'
.js-tabs-affix
'
);
const
navbar
=
document
.
querySelector
(
'
.navbar-gitlab
'
);
const
navbar
=
document
.
querySelector
(
'
.navbar-gitlab
'
);
const
peek
=
document
.
getElementById
(
'
peek
'
);
const
peek
=
document
.
getElementById
(
'
js-
peek
'
);
const
paddingTop
=
16
;
const
paddingTop
=
16
;
this
.
diffsLoaded
=
false
;
this
.
diffsLoaded
=
false
;
...
@@ -109,8 +104,7 @@ export default class MergeRequestTabs {
...
@@ -109,8 +104,7 @@ export default class MergeRequestTabs {
.
on
(
'
shown.bs.tab
'
,
'
.merge-request-tabs a[data-toggle="tab"]
'
,
this
.
tabShown
)
.
on
(
'
shown.bs.tab
'
,
'
.merge-request-tabs a[data-toggle="tab"]
'
,
this
.
tabShown
)
.
on
(
'
click
'
,
'
.js-show-tab
'
,
this
.
showTab
);
.
on
(
'
click
'
,
'
.js-show-tab
'
,
this
.
showTab
);
$
(
'
.merge-request-tabs a[data-toggle="tab"]
'
)
$
(
'
.merge-request-tabs a[data-toggle="tab"]
'
).
on
(
'
click
'
,
this
.
clickTab
);
.
on
(
'
click
'
,
this
.
clickTab
);
}
}
// Used in tests
// Used in tests
...
@@ -119,8 +113,7 @@ export default class MergeRequestTabs {
...
@@ -119,8 +113,7 @@ export default class MergeRequestTabs {
.
off
(
'
shown.bs.tab
'
,
'
.merge-request-tabs a[data-toggle="tab"]
'
,
this
.
tabShown
)
.
off
(
'
shown.bs.tab
'
,
'
.merge-request-tabs a[data-toggle="tab"]
'
,
this
.
tabShown
)
.
off
(
'
click
'
,
'
.js-show-tab
'
,
this
.
showTab
);
.
off
(
'
click
'
,
'
.js-show-tab
'
,
this
.
showTab
);
$
(
'
.merge-request-tabs a[data-toggle="tab"]
'
)
$
(
'
.merge-request-tabs a[data-toggle="tab"]
'
).
off
(
'
click
'
,
this
.
clickTab
);
.
off
(
'
click
'
,
this
.
clickTab
);
}
}
destroyPipelinesView
()
{
destroyPipelinesView
()
{
...
@@ -183,10 +176,7 @@ export default class MergeRequestTabs {
...
@@ -183,10 +176,7 @@ export default class MergeRequestTabs {
scrollToElement
(
container
)
{
scrollToElement
(
container
)
{
if
(
location
.
hash
)
{
if
(
location
.
hash
)
{
const
offset
=
0
-
(
const
offset
=
0
-
(
$
(
'
.navbar-gitlab
'
).
outerHeight
()
+
$
(
'
.js-tabs-affix
'
).
outerHeight
());
$
(
'
.navbar-gitlab
'
).
outerHeight
()
+
$
(
'
.js-tabs-affix
'
).
outerHeight
()
);
const
$el
=
$
(
`
${
container
}
${
location
.
hash
}
:not(.match)`
);
const
$el
=
$
(
`
${
container
}
${
location
.
hash
}
:not(.match)`
);
if
(
$el
.
length
)
{
if
(
$el
.
length
)
{
$
.
scrollTo
(
$el
[
0
],
{
offset
});
$
.
scrollTo
(
$el
[
0
],
{
offset
});
...
@@ -240,9 +230,13 @@ export default class MergeRequestTabs {
...
@@ -240,9 +230,13 @@ export default class MergeRequestTabs {
// Turbolinks' history.
// Turbolinks' history.
//
//
// See https://github.com/rails/turbolinks/issues/363
// See https://github.com/rails/turbolinks/issues/363
window
.
history
.
replaceState
({
window
.
history
.
replaceState
(
{
url
:
newState
,
url
:
newState
,
},
document
.
title
,
newState
);
},
document
.
title
,
newState
,
);
return
newState
;
return
newState
;
}
}
...
@@ -258,7 +252,8 @@ export default class MergeRequestTabs {
...
@@ -258,7 +252,8 @@ export default class MergeRequestTabs {
this
.
toggleLoading
(
true
);
this
.
toggleLoading
(
true
);
axios
.
get
(
`
${
source
}
.json`
)
axios
.
get
(
`
${
source
}
.json`
)
.
then
(({
data
})
=>
{
.
then
(({
data
})
=>
{
document
.
querySelector
(
'
div#commits
'
).
innerHTML
=
data
.
html
;
document
.
querySelector
(
'
div#commits
'
).
innerHTML
=
data
.
html
;
localTimeAgo
(
$
(
'
.js-timeago
'
,
'
div#commits
'
));
localTimeAgo
(
$
(
'
.js-timeago
'
,
'
div#commits
'
));
...
@@ -303,7 +298,8 @@ export default class MergeRequestTabs {
...
@@ -303,7 +298,8 @@ export default class MergeRequestTabs {
this
.
toggleLoading
(
true
);
this
.
toggleLoading
(
true
);
axios
.
get
(
`
${
urlPathname
}
.json
${
location
.
search
}
`
)
axios
.
get
(
`
${
urlPathname
}
.json
${
location
.
search
}
`
)
.
then
(({
data
})
=>
{
.
then
(({
data
})
=>
{
const
$container
=
$
(
'
#diffs
'
);
const
$container
=
$
(
'
#diffs
'
);
$container
.
html
(
data
.
html
);
$container
.
html
(
data
.
html
);
...
@@ -332,8 +328,7 @@ export default class MergeRequestTabs {
...
@@ -332,8 +328,7 @@ export default class MergeRequestTabs {
cancelButtons
:
$
(
el
).
find
(
'
.js-cancel-fork-suggestion-button
'
),
cancelButtons
:
$
(
el
).
find
(
'
.js-cancel-fork-suggestion-button
'
),
suggestionSections
:
$
(
el
).
find
(
'
.js-file-fork-suggestion-section
'
),
suggestionSections
:
$
(
el
).
find
(
'
.js-file-fork-suggestion-section
'
),
actionTextPieces
:
$
(
el
).
find
(
'
.js-file-fork-suggestion-section-action
'
),
actionTextPieces
:
$
(
el
).
find
(
'
.js-file-fork-suggestion-section-action
'
),
})
}).
init
();
.
init
();
});
});
// Scroll any linked note into view
// Scroll any linked note into view
...
@@ -388,8 +383,7 @@ export default class MergeRequestTabs {
...
@@ -388,8 +383,7 @@ export default class MergeRequestTabs {
resetViewContainer
()
{
resetViewContainer
()
{
if
(
this
.
fixedLayoutPref
!==
null
)
{
if
(
this
.
fixedLayoutPref
!==
null
)
{
$
(
'
.content-wrapper .container-fluid
'
)
$
(
'
.content-wrapper .container-fluid
'
).
toggleClass
(
'
container-limited
'
,
this
.
fixedLayoutPref
);
.
toggleClass
(
'
container-limited
'
,
this
.
fixedLayoutPref
);
}
}
}
}
...
@@ -438,12 +432,11 @@ export default class MergeRequestTabs {
...
@@ -438,12 +432,11 @@ export default class MergeRequestTabs {
const
$diffTabs
=
$
(
'
#diff-notes-app
'
);
const
$diffTabs
=
$
(
'
#diff-notes-app
'
);
$tabs
.
off
(
'
affix.bs.affix affix-top.bs.affix
'
)
$tabs
.
off
(
'
affix.bs.affix affix-top.bs.affix
'
)
.
affix
({
.
affix
({
offset
:
{
offset
:
{
top
:
()
=>
(
top
:
()
=>
$diffTabs
.
offset
().
top
-
$tabs
.
height
()
-
$fixedNav
.
height
(),
$diffTabs
.
offset
().
top
-
$tabs
.
height
()
-
$fixedNav
.
height
()
),
},
},
})
})
.
on
(
'
affix.bs.affix
'
,
()
=>
$diffTabs
.
css
({
marginTop
:
$tabs
.
height
()
}))
.
on
(
'
affix.bs.affix
'
,
()
=>
$diffTabs
.
css
({
marginTop
:
$tabs
.
height
()
}))
...
...
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