summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/application.js.coffee
diff options
context:
space:
mode:
authorJacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>2016-02-03 20:35:26 -0500
committerJacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>2016-02-03 20:35:26 -0500
commite0efdc4bf759ed8129d12aed16e68fb7392eddc7 (patch)
tree991853a7d5acea6cf555c26cc6146c7011ed42d8 /app/assets/javascripts/application.js.coffee
parentf660d8d0444fc3c953df93f66c42f9895bfe9ade (diff)
downloadgitlab-ce-e0efdc4bf759ed8129d12aed16e68fb7392eddc7.tar.gz
Make size changes based on screen resize.
Diffstat (limited to 'app/assets/javascripts/application.js.coffee')
-rw-r--r--app/assets/javascripts/application.js.coffee36
1 files changed, 36 insertions, 0 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index be3b326075d..1abc4794f21 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -212,6 +212,13 @@ $ ->
$this = $(this)
$this.attr 'value', $this.val()
+ $(document).on 'breakpoint:change', (e, breakpoint) ->
+ if breakpoint is 'sm' or breakpoint is 'xs'
+ $gutterIcon = $('.gutter-toggle').find('i')
+ if $gutterIcon.hasClass('fa-angle-double-right')
+ $gutterIcon.closest('a').trigger('click')
+
+
$(document).on 'click', 'aside .gutter-toggle', (e) ->
e.preventDefault()
$this = $(this)
@@ -240,4 +247,33 @@ $ ->
$('.right-sidebar')
.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()
+
+ $(window).on "resize", (e) ->
+ oldBootstrapBreakpoint = bootstrapBreakpoint
+ checkBootstrapBreakpoints()
+ if bootstrapBreakpoint != oldBootstrapBreakpoint
+ $(document).trigger('breakpoint:change',[bootstrapBreakpoint])
+
+ setBootstrapBreakpoints()
new Aside()