Sha256: 80836815a09e0bbca5127e48849fd2835f6bbe86d4e64d4d29254464c10c5cb3

Contents?: true

Size: 1.89 KB

Versions: 12

Compression:

Stored size: 1.89 KB

Contents

// ========================================================================
// SproutCore
// copyright 2006-2008 Sprout Systems, Inc.
// ========================================================================

require('foundation/path_module') ;

/**
  @class SC.Page
  
  The Page object is used to store a set of views that can be lazily 
  configured on page load.  Page assumes that all of its properties are
  basically outlets and will try to configure them as such.

  @extends SC.Object
*/
SC.Page = SC.Object.extend(
  /** @scope SC.Page.prototype */
  {
  
  get: function(key) {
    var value = this[key] ;
    if (value && (value instanceof Function) && (value.isOutlet)) {
      var ret = this.outlet(key) ;
      if (SC.window && !ret.parentNode) {
        SC.window._insertBefore(ret, null, false) ;
        SC.window._rebuildChildNodes();
      }
      ret.awake() ;
      return ret ;
    } else return arguments.callee.base.apply(this,arguments) ;
  },
  
  // in addition to activating bindings, calling awake on the page object
  // will cause any outlet properties to be loaded.
  awake: function() {
    arguments.callee.base.call(this) ;
    for(var key in this) {
      if (this.hasOwnProperty(key) && this[key] && this[key].isOutlet) {
        this.get(key) ; // convert to outlet.
      } 
    }
  },
  
  init: function() {
    arguments.callee.base.apply(this,arguments) ;
    var el = this.rootElement = $('resources') ;
    SC.callOnLoad(function() {
      if (el && el.parentNode) el.parentNode.removeChild(el) ;
    }) ;
  },
  
  // returns the property, but only if it is already configured.
  getIfConfigured: function(key) {
    var value = this[key] ;
    if (value && (value instanceof Function) && (value.isOutlet)) {
      return null ;
    } else return value ;
  },
  
  _insertBefore: function() {},
  _rebuildChildNodes: function() {}
  
}) ;

Object.extend(SC.Page.prototype, SC.PathModule) ;

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sproutcore-0.9.11 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.12 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.10 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.13 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.2 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.3 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.4 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.5 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.6 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.8 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.9 frameworks/sproutcore/foundation/page.js
sproutcore-0.9.7 frameworks/sproutcore/foundation/page.js