diff options
author | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-02-03 20:35:26 -0500 |
---|---|---|
committer | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-02-03 20:35:26 -0500 |
commit | e0efdc4bf759ed8129d12aed16e68fb7392eddc7 (patch) | |
tree | 991853a7d5acea6cf555c26cc6146c7011ed42d8 | |
parent | f660d8d0444fc3c953df93f66c42f9895bfe9ade (diff) | |
download | gitlab-ce-e0efdc4bf759ed8129d12aed16e68fb7392eddc7.tar.gz |
Make size changes based on screen resize.
-rw-r--r-- | app/assets/javascripts/application.js.coffee | 36 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/issuable.scss | 1 |
2 files changed, 37 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() diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss index 6f71ad1f50b..3bfbd9e17b7 100644 --- a/app/assets/stylesheets/pages/issuable.scss +++ b/app/assets/stylesheets/pages/issuable.scss @@ -184,6 +184,7 @@ &.right-sidebar-collapsed { width: $sidebar_collapsed_width; padding-top: 0; + overflow-x: hidden; hr { margin: 0; |