couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowalski <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Secondary indexes: huge branch
Date Mon, 25 Aug 2014 21:14:27 GMT
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/33#discussion_r16681465
  
    --- Diff: app/addons/fauxton/resizeColumns.js ---
    @@ -28,60 +28,67 @@ function(FauxtonAPI) {
       };
     
       Resize.prototype = {
    -    getPrimaryNavWidth: function(){
    -      var primaryNavWidth  = $('body').hasClass('closeMenu') ? 64 : 220;
    -      return primaryNavWidth;
    -    },
    -    getPanelWidth: function(){
    -      var sidebarWidth = $('#sidebar-content').length > 0 ? $('#sidebar-content').outerWidth()
: 0,
    -          borders = parseInt($('#dashboard').css('border-left-width'), 10) +
    -                    parseInt($('#dashboard-content').css('border-left-width'), 10) +
    -                    parseInt($('#dashboard-content').css('border-right-width'), 10);
     
    -      return (this.getPrimaryNavWidth() + sidebarWidth + borders);
    -    },
         initialize: function(){
    -     // $(window).off('resize');
    -      var that = this;
           //add throttler :)
    +      var that = this;
           this.lazyLayout = _.debounce(that.onResizeHandler, 300).bind(this);
           FauxtonAPI.utils.addWindowResize(this.lazyLayout,"animation");
           FauxtonAPI.utils.initWindowResize();
           this.onResizeHandler();
         },
    -    updateOptions:function(options){
    -      this.options = {};
    -      this.options = options;
    -    },
    -    turnOff:function(){
    -      FauxtonAPI.utils.removeWindowResize("animation");
    +
    +    onResizeHandler: function (){
    +      var fullWidth = this.getFullWidth(),
    +          halfWidth = this.getHalfWidth(),
    +          sidebarWidth = this.getSidebarContentWidth(),
    +          left = $('.window-resizeable-half').length > 0? halfWidth : sidebarWidth;
    +
    +      $('.window-resizeable').innerWidth(sidebarWidth);
    +      $('.window-resizeable-half').innerWidth(halfWidth);
    +      $('.window-resizeable-full').innerWidth(fullWidth);
    +
    +      //set left
    +      this.setLeftPosition(left);
    +      //if there is a callback, run that
    +      this.options.callback && this.options.callback();
    +      this.trigger('resize');
         },
    +
         cleanupCallback: function(){
           this.callback = null;
         },
    -    onResizeHandler: function (){
    -      //if there is an override, do that instead
    -      if (this.options.onResizeHandler){
    -        this.options.onResizeHandler();
    -      } else {
    -        var combinedWidth = window.innerWidth - this.getPanelWidth(),
    -        smallWidthConstraint = ($('#sidebar-content').length > 0)? 470:800,
    -        panelWidth;
    -
    -        if (combinedWidth > smallWidthConstraint) {
    -          panelWidth = window.innerWidth - this.getPanelWidth();
    -        } else if (combinedWidth < smallWidthConstraint){
    -          panelWidth = smallWidthConstraint;
    -        }
    -
    -        $('.window-resizeable').innerWidth(panelWidth);
    -
    -      }
    -      //if there is a callback, run that
    -      if(this.options.callback) {
    -        this.options.callback();
    -      }
    -      this.trigger('resize');
    +
    +    getPrimaryNavWidth: function(){
    +      var primaryNavWidth  = $('body').hasClass('closeMenu') ? 64 : $('#primary-navbar').outerWidth();
    +      //$('body').hasClass('closeMenu') ? 64 : 220;
    +      return primaryNavWidth;
    +    },
    +
    +    getWindowWidth: function(){
    +      return window.innerWidth;
    +    },
    +
    +    getFullWidth: function(){
    +      return this.getWindowWidth() - this.getPrimaryNavWidth();
    +    },
    +
    +    getSidebarWidth: function(){
    +      return $('#breadcrumbs').length > 0 ? $('#breadcrumbs').outerWidth() : 0;
    +    },
    +
    +    getSidebarContentWidth: function(){
    +      return this.getFullWidth() - this.getSidebarWidth() -5;
    +    },
    +
    +    getHalfWidth: function(){
    +      var fullWidth = this.getFullWidth();
    +      return fullWidth/2;
    +    },
    +
    +    setLeftPosition: function(panelWidth){
    +      var primary = this.getPrimaryNavWidth();
    +      $('.set-left-position').css('left',panelWidth+primary+4);
         }
    --- End diff --
    
    :yellow_heart: 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message