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
f0f6723f
Commit
f0f6723f
authored
Mar 11, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created bootstrap breakpoint class
This class checks the current bootstrap breakpoint
parent
ce9bbce7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
37 deletions
+41
-37
app/assets/javascripts/application.js.coffee
app/assets/javascripts/application.js.coffee
+4
-23
app/assets/javascripts/breakpoints.coffee
app/assets/javascripts/breakpoints.coffee
+24
-0
app/assets/javascripts/sidebar.js.coffee
app/assets/javascripts/sidebar.js.coffee
+5
-2
app/assets/stylesheets/framework/header.scss
app/assets/stylesheets/framework/header.scss
+7
-11
app/assets/stylesheets/framework/sidebar.scss
app/assets/stylesheets/framework/sidebar.scss
+1
-1
No files found.
app/assets/javascripts/application.js.coffee
View file @
f0f6723f
...
@@ -256,35 +256,15 @@ $ ->
...
@@ -256,35 +256,15 @@ $ ->
$
(
'.right-sidebar'
)
$
(
'.right-sidebar'
)
.
hasClass
(
'right-sidebar-collapsed'
),
{
path
:
'/'
})
.
hasClass
(
'right-sidebar-collapsed'
),
{
path
:
'/'
})
bootstrapBreakpoint
=
undefined
;
checkBootstrapBreakpoints
=
->
if
$
(
'.device-xs'
).
is
(
':visible'
)
bootstrapBreakpoint
=
"xs"
else
if
$
(
'.device-sm'
).
is
(
':visible'
)
bootstrapBreakpoint
=
"sm"
else
if
$
(
'.device-md'
).
is
(
':visible'
)
bootstrapBreakpoint
=
"md"
else
if
$
(
'.device-lg'
).
is
(
':visible'
)
bootstrapBreakpoint
=
"lg"
setBootstrapBreakpoints
=
->
if
$
(
'.device-xs'
).
length
return
$
(
"body"
)
.
append
(
'<div class="device-xs visible-xs"></div>'
+
'<div class="device-sm visible-sm"></div>'
+
'<div class="device-md visible-md"></div>'
+
'<div class="device-lg visible-lg"></div>'
)
checkBootstrapBreakpoints
()
fitSidebarForSize
=
->
fitSidebarForSize
=
->
oldBootstrapBreakpoint
=
bootstrapBreakpoint
oldBootstrapBreakpoint
=
bootstrapBreakpoint
checkBootstrapBreakpoints
()
checkBootstrapBreakpoints
()
bootstrapBreakpoint
=
breakpoints
.
getBreakpointSize
()
if
bootstrapBreakpoint
!=
oldBootstrapBreakpoint
if
bootstrapBreakpoint
!=
oldBootstrapBreakpoint
$
(
document
).
trigger
(
'breakpoint:change'
,
[
bootstrapBreakpoint
])
$
(
document
).
trigger
(
'breakpoint:change'
,
[
bootstrapBreakpoint
])
checkInitialSidebarSize
=
->
checkInitialSidebarSize
=
->
bootstrapBreakpoint
=
breakpoints
.
getBreakpointSize
()
if
bootstrapBreakpoint
is
"xs"
or
"sm"
if
bootstrapBreakpoint
is
"xs"
or
"sm"
$
(
document
).
trigger
(
'breakpoint:change'
,
[
bootstrapBreakpoint
])
$
(
document
).
trigger
(
'breakpoint:change'
,
[
bootstrapBreakpoint
])
...
@@ -293,6 +273,7 @@ $ ->
...
@@ -293,6 +273,7 @@ $ ->
.
on
"resize"
,
(
e
)
->
.
on
"resize"
,
(
e
)
->
fitSidebarForSize
()
fitSidebarForSize
()
setBootstrapBreakpoints
()
checkInitialSidebarSize
()
checkInitialSidebarSize
()
breakpoints
=
new
Breakpoints
()
bootstrapBreakpoint
=
breakpoints
.
getBreakpointSize
()
new
Aside
()
new
Aside
()
app/assets/javascripts/breakpoints.coffee
0 → 100644
View file @
f0f6723f
class
@
Breakpoints
BREAKPOINTS
=
[
"xs"
,
"sm"
,
"md"
,
"lg"
]
constructor
:
->
@
setup
()
setup
:
->
allDeviceSelector
=
BREAKPOINTS
.
map
(
breakpoint
)
->
".device-
#{
breakpoint
}
"
if
$
(
allDeviceSelector
.
join
(
","
)).
length
return
# Create all the elements
$
.
each
BREAKPOINTS
,
(
i
,
breakpoint
)
->
$
(
"body"
).
append
"<div class='device-
#{
breakpoint
}
visible-
#{
breakpoint
}
'></div>"
getBreakpointSize
:
->
allDeviceSelector
=
BREAKPOINTS
.
map
(
breakpoint
)
->
".device-
#{
breakpoint
}
"
$visibleDevice
=
$
(
allDeviceSelector
.
join
(
","
)).
filter
(
":visible"
)
return
$visibleDevice
.
attr
(
"class"
).
split
(
"visible-"
)[
1
]
app/assets/javascripts/sidebar.js.coffee
View file @
f0f6723f
mobileWidth
=
768
mobileWidth
=
991
collapsed
=
'page-sidebar-collapsed'
collapsed
=
'page-sidebar-collapsed'
expanded
=
'page-sidebar-expanded'
expanded
=
'page-sidebar-expanded'
...
@@ -21,6 +21,9 @@ $(document).on("click", '.toggle-nav-collapse', (e) ->
...
@@ -21,6 +21,9 @@ $(document).on("click", '.toggle-nav-collapse', (e) ->
)
)
$
->
$
->
if
$
(
window
).
width
()
<
mobileWidth
breakpoints
=
new
Breakpoints
()
size
=
breakpoints
.
getBreakpointSize
()
if
size
is
"xs"
or
size
is
"sm"
if
$
(
'.page-with-sidebar'
).
hasClass
(
expanded
)
if
$
(
'.page-with-sidebar'
).
hasClass
(
expanded
)
toggleSidebar
()
toggleSidebar
()
app/assets/stylesheets/framework/header.scss
View file @
f0f6723f
...
@@ -141,22 +141,18 @@ header {
...
@@ -141,22 +141,18 @@ header {
margin-left
:
$sidebar_collapsed_width
;
margin-left
:
$sidebar_collapsed_width
;
}
}
@media
(
max-width
:
$screen-sm-min
)
{
.header-collapsed
{
.header-collapsed
{
margin-left
:
$sidebar_collapsed_width
;
margin-left
:
$sidebar_collapsed_width
;
}
.header-expanded
{
@media
(
min-width
:
$screen-sm-max
)
{
margin-left
:
$sidebar_collapsed_width
;
@include
collapsed-header
;
}
}
}
}
@media
(
min-width
:
$screen-sm-min
)
{
.header-expanded
{
.header-collapsed
{
margin-left
:
$sidebar_collapsed_width
;
@include
collapsed-header
;
}
.header-expanded
{
@media
(
min-width
:
$screen-sm-max
)
{
margin-left
:
$sidebar_width
;
margin-left
:
$sidebar_width
;
}
}
}
}
...
...
app/assets/stylesheets/framework/sidebar.scss
View file @
f0f6723f
...
@@ -205,7 +205,7 @@
...
@@ -205,7 +205,7 @@
@mixin
expanded-sidebar
{
@mixin
expanded-sidebar
{
padding-left
:
$sidebar_collapsed_width
;
padding-left
:
$sidebar_collapsed_width
;
@media
(
min-width
:
$screen-sm-m
in
)
{
@media
(
min-width
:
$screen-sm-m
ax
)
{
padding-left
:
$sidebar_width
;
padding-left
:
$sidebar_width
;
}
}
...
...
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