Sha256: 00061aaf6b523e2f7118af98cd9e974774403af36aa85139b04d6e753bf5c84d

Contents?: true

Size: 1.78 KB

Versions: 18

Compression:

Stored size: 1.78 KB

Contents

// ========================================================================
// SproutCore -- JavaScript Application Framework
// Copyright ©2006-2008, Sprout Systems, Inc. and contributors.
// Portions copyright ©2008 Apple Inc.  All rights reserved.
// ========================================================================

/*jslint evil:true */

/** 
  Extend SC.View with emitDesign() which will encode the view and all of its
  subviews then computes an empty element to attach to the design.
*/
SC.View.prototype.emitDesign = function() {
  
  // get design...
  var ret = SC.DesignCoder.encode(this);
  
  return ret ;
};

/**
  Extend SC.View to emit the localization for the current configuration of the
  view and all of its subviews.
*/
SC.View.prototype.emitLocalization = function(design) {
  var ret = SC.LocalizationCoder.encode(this);
  
  // prepare rootElement HTML.  Get the design, apply loc and generate the
  // emptyElement HTML...
  if (!design) design = this.emitDesign();
  var views = eval(design).loc(eval(ret)).create() ;
  var emptyElement = views.computeEmptyElement().replace(/\'/g,"\'");
  views.destroy();
  
  // now insert as extra param at end...
  ret = ret.replace(/\)$/, ", '%@')".fmt(emptyElement)) ;
  return ret ;
} ;

/** 
  Patch SC.View to respond to encodeDesign().  This will proxy to the paired
  designer, if there is one.  If there is no paired designer, returns NO.
*/
SC.View.prototype.encodeDesign = function(coder) {
  return this.designer ? this.designer.encodeDesign(coder) : NO ;
};

/** 
  Patch SC.View to respond to encodeDesign().  This will proxy to the paired
  designer, if there is one.  If there is no paired designer, returns NO.
*/
SC.View.prototype.encodeLoc = function(coder) {
  return this.designer ? this.designer.encodeLoc(coder) : NO ;
};

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
sproutcore-1.4.4-java lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.4 lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.3.1 lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.3-java lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.3 lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.2-java lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.2 lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.1-java lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.1 lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.0-java lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.0 lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.0.rc.5 lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.0.rc.4 lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.0.rc.3 lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.0.rc.2 lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.4.0.rc lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.0.1049.pre.2 lib/frameworks/sproutcore/frameworks/designer/ext/view.js
sproutcore-1.0.1049.pre.1 frameworks/sproutcore/frameworks/designer/ext/view.js