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
30ea58da
Commit
30ea58da
authored
Dec 19, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed layout_nav to ES module
parent
888ed309
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
42 deletions
+33
-42
app/assets/javascripts/layout_nav.js
app/assets/javascripts/layout_nav.js
+31
-39
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+2
-3
No files found.
app/assets/javascripts/layout_nav.js
View file @
30ea58da
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, no-unused-vars, one-var, one-var-declaration-per-line, vars-on-top, max-len */
import
_
from
'
underscore
'
;
import
Cookies
from
'
js-cookie
'
;
import
ContextualSidebar
from
'
./contextual_sidebar
'
;
import
ContextualSidebar
from
'
./contextual_sidebar
'
;
import
initFlyOutNav
from
'
./fly_out_nav
'
;
import
initFlyOutNav
from
'
./fly_out_nav
'
;
(
function
()
{
function
hideEndFade
(
$scrollingTabs
)
{
var
hideEndFade
;
$scrollingTabs
.
each
(
function
scrollTabsLoop
()
{
const
$this
=
$
(
this
);
hideEndFade
=
function
(
$scrollingTabs
)
{
$this
.
siblings
(
'
.fade-right
'
).
toggleClass
(
'
scrolling
'
,
$this
.
width
()
<
$this
.
prop
(
'
scrollWidth
'
));
return
$scrollingTabs
.
each
(
function
()
{
var
$this
;
$this
=
$
(
this
);
return
$this
.
siblings
(
'
.fade-right
'
).
toggleClass
(
'
scrolling
'
,
$this
.
width
()
<
$this
.
prop
(
'
scrollWidth
'
));
});
});
};
}
export
default
function
initLayoutNav
()
{
const
contextualSidebar
=
new
ContextualSidebar
();
contextualSidebar
.
bindEvents
();
initFlyOutNav
();
$
(
document
).
on
(
'
init.scrolling-tabs
'
,
()
=>
{
$
(
document
).
on
(
'
init.scrolling-tabs
'
,
()
=>
{
const
$scrollingTabs
=
$
(
'
.scrolling-tabs
'
).
not
(
'
.is-initialized
'
);
const
$scrollingTabs
=
$
(
'
.scrolling-tabs
'
).
not
(
'
.is-initialized
'
);
$scrollingTabs
.
addClass
(
'
is-initialized
'
);
$scrollingTabs
.
addClass
(
'
is-initialized
'
);
$
(
window
).
on
(
'
resize.nav
'
,
()
=>
{
hideEndFade
(
$scrollingTabs
);
hideEndFade
(
$scrollingTabs
);
$
(
window
).
off
(
'
resize.nav
'
).
on
(
'
resize.nav
'
,
function
()
{
}).
trigger
(
'
resize.nav
'
);
return
hideEndFade
(
$scrollingTabs
);
});
$scrollingTabs
.
on
(
'
scroll
'
,
function
tabsScrollEvent
()
{
$scrollingTabs
.
off
(
'
scroll
'
).
on
(
'
scroll
'
,
function
(
event
)
{
const
$this
=
$
(
this
);
var
$this
,
currentPosition
,
maxPosition
;
const
currentPosition
=
$this
.
scrollLeft
();
$this
=
$
(
this
);
const
maxPosition
=
$this
.
prop
(
'
scrollWidth
'
)
-
$this
.
outerWidth
();
currentPosition
=
$this
.
scrollLeft
();
maxPosition
=
$this
.
prop
(
'
scrollWidth
'
)
-
$this
.
outerWidth
();
$this
.
siblings
(
'
.fade-left
'
).
toggleClass
(
'
scrolling
'
,
currentPosition
>
0
);
$this
.
siblings
(
'
.fade-left
'
).
toggleClass
(
'
scrolling
'
,
currentPosition
>
0
);
return
$this
.
siblings
(
'
.fade-right
'
).
toggleClass
(
'
scrolling
'
,
currentPosition
<
maxPosition
-
1
);
$this
.
siblings
(
'
.fade-right
'
).
toggleClass
(
'
scrolling
'
,
currentPosition
<
maxPosition
-
1
);
});
});
$scrollingTabs
.
each
(
function
()
{
$scrollingTabs
.
each
(
function
scrollTabsEachLoop
()
{
var
$this
=
$
(
this
);
const
$this
=
$
(
this
);
var
scrollingTabWidth
=
$this
.
width
();
const
scrollingTabWidth
=
$this
.
width
();
var
$active
=
$this
.
find
(
'
.active
'
);
const
$active
=
$this
.
find
(
'
.active
'
);
var
activeWidth
=
$active
.
width
();
const
activeWidth
=
$active
.
width
();
if
(
$active
.
length
)
{
if
(
$active
.
length
)
{
var
offset
=
$active
.
offset
().
left
+
activeWidth
;
const
offset
=
$active
.
offset
().
left
+
activeWidth
;
if
(
offset
>
scrollingTabWidth
-
30
)
{
if
(
offset
>
scrollingTabWidth
-
30
)
{
var
scrollLeft
=
scrollingTabWidth
/
2
;
const
scrollLeft
=
(
offset
-
(
scrollingTabWidth
/
2
))
-
(
activeWidth
/
2
)
;
scrollLeft
=
(
offset
-
scrollLeft
)
-
(
activeWidth
/
2
);
$this
.
scrollLeft
(
scrollLeft
);
$this
.
scrollLeft
(
scrollLeft
);
}
}
}
}
});
});
});
}).
trigger
(
'
init.scrolling-tabs
'
);
}
$
(()
=>
{
const
contextualSidebar
=
new
ContextualSidebar
();
contextualSidebar
.
bindEvents
();
initFlyOutNav
();
});
}).
call
(
window
);
app/assets/javascripts/main.js
View file @
30ea58da
...
@@ -41,7 +41,7 @@ import Flash, { removeFlashClickListener } from './flash';
...
@@ -41,7 +41,7 @@ import Flash, { removeFlashClickListener } from './flash';
import
'
./gl_dropdown
'
;
import
'
./gl_dropdown
'
;
import
initTodoToggle
from
'
./header
'
;
import
initTodoToggle
from
'
./header
'
;
import
initImporterStatus
from
'
./importer_status
'
;
import
initImporterStatus
from
'
./importer_status
'
;
import
'
./layout_nav
'
;
import
initLayoutNav
from
'
./layout_nav
'
;
import
LazyLoader
from
'
./lazy_loader
'
;
import
LazyLoader
from
'
./lazy_loader
'
;
import
'
./line_highlighter
'
;
import
'
./line_highlighter
'
;
import
initLogoAnimation
from
'
./logo
'
;
import
initLogoAnimation
from
'
./logo
'
;
...
@@ -89,6 +89,7 @@ $(function () {
...
@@ -89,6 +89,7 @@ $(function () {
var
fitSidebarForSize
;
var
fitSidebarForSize
;
initBreadcrumbs
();
initBreadcrumbs
();
initLayoutNav
();
initImporterStatus
();
initImporterStatus
();
initTodoToggle
();
initTodoToggle
();
initLogoAnimation
();
initLogoAnimation
();
...
@@ -261,8 +262,6 @@ $(function () {
...
@@ -261,8 +262,6 @@ $(function () {
renderTimeago
();
renderTimeago
();
$
(
document
).
trigger
(
'
init.scrolling-tabs
'
);
$
(
'
form.filter-form
'
).
on
(
'
submit
'
,
function
(
event
)
{
$
(
'
form.filter-form
'
).
on
(
'
submit
'
,
function
(
event
)
{
const
link
=
document
.
createElement
(
'
a
'
);
const
link
=
document
.
createElement
(
'
a
'
);
link
.
href
=
this
.
action
;
link
.
href
=
this
.
action
;
...
...
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