lib/js/ComponentView.js
function(persist) {
      var t = this,
          viewElem = t.$('.nm-cv'),
          thisZIndex = (viewElem.css('zIndex') === 'auto' ? 0 : +viewElem.css('zIndex')),
          components = UI.pageView.model.get('components'),
          maxZIndex = 0;

      // Get the maximum z-index (disregarding this)
      components.forEach(function(component) {
        var id = component.get('id'),
            elem = $('#' + id + ' .nm-cv'),
            zIndex = elem.css('zIndex') === 'auto' ? 0 : +elem.css('zIndex');

        if (id === t.model.get('id')) {return;}
        if (zIndex > maxZIndex) {
          maxZIndex = zIndex;
        }
      });

      // Set this z-index to the max + 1 (unless already there)
      if (maxZIndex >= thisZIndex) {
        thisZIndex = maxZIndex + 1;
        if (persist) {
          // Change the model CSS.
          var css = _.clone(t.model.get('css')),
              parsedCss = $.parseStyleString(css['.nm-cv'] || '');

          parsedCss['z-index'] = thisZIndex;
          css['.nm-cv'] = $.makeStyleString(parsedCss);
          t.model.set({css: css});
        } else {
          t.$('.nm-cv').css({zIndex: thisZIndex});
        }
      }

      // Return this zIndex
      return thisZIndex;
    }
function(persist) {
      var t = this,
          viewElem = t.$('.nm-cv'),
          thisZIndex = (viewElem.css('zIndex') === 'auto' ? 0 : +viewElem.css('zIndex')),
          components = UI.pageView.model.get('components'),
          maxZIndex = 0;

      // Get the maximum z-index (disregarding this)
      components.forEach(function(component) {
        var id = component.get('id'),
            elem = $('#' + id + ' .nm-cv'),
            zIndex = elem.css('zIndex') === 'auto' ? 0 : +elem.css('zIndex');

        if (id === t.model.get('id')) {return;}
        if (zIndex > maxZIndex) {
          maxZIndex = zIndex;
        }
      });

      // Set this z-index to the max + 1 (unless already there)
      if (maxZIndex >= thisZIndex) {
        thisZIndex = maxZIndex + 1;
        if (persist) {
          // Change the model CSS.
          var css = _.clone(t.model.get('css')),
              parsedCss = $.parseStyleString(css['.nm-cv'] || '');

          parsedCss['z-index'] = thisZIndex;
          css['.nm-cv'] = $.makeStyleString(parsedCss);
          t.model.set({css: css});
        } else {
          t.$('.nm-cv').css({zIndex: thisZIndex});
        }
      }

      // Return this zIndex
      return thisZIndex;
    }
function ( persist ) { var t = this , viewElem = t . $ ( '.nm-cv' ) , thisZIndex = ( viewElem . css ( 'zIndex' ) === 'auto' ? 0 : + viewElem . css ( 'zIndex' ) ) , components = UI . pageView . model . get ( 'components' ) , maxZIndex = 0 ; // Get the maximum z-index (disregarding this) components . forEach ( function ( component ) { var id = component . get ( 'id' ) , elem = $ ( '#' + id + ' .nm-cv' ) , zIndex = elem . css ( 'zIndex' ) === 'auto' ? 0 : + elem . css ( 'zIndex' ) ; if ( id === t . model . get ( 'id' ) ) { return ; } if ( zIndex > maxZIndex ) { maxZIndex = zIndex ; } } ) ; // Set this z-index to the max + 1 (unless already there) if ( maxZIndex >= thisZIndex ) { thisZIndex = maxZIndex + 1 ; if ( persist ) { // Change the model CSS. var css = _ . clone ( t . model . get ( 'css' ) ) , parsedCss = $ . parseStyleString ( css [ '.nm-cv' ] || '' ) ; parsedCss [ 'z-index' ] = thisZIndex ; css [ '.nm-cv' ] = $ . makeStyleString ( parsedCss ) ; t . model . set ( { css : css } ) ; } else { t . $ ( '.nm-cv' ) . css ( { zIndex : thisZIndex } ) ; } } // Return this zIndex return thisZIndex ; }
Raise this component to the top of the stack If persist is true, persist any new zIndex into the CSS of the data model Returns the component zIndex
Raise this component to the top of the stack If persist is true persist any new zIndex into the CSS of the data model Returns the component zIndex