Sha256: b6c7dbf133fc105b3808d31f207ab748599ab57a2c485da6745c81423fdb5831

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 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 */

require('views/view');

/** 
  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 ;
} ;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sproutit-sproutcore-1.0.0.20090408130025 frameworks/sproutcore/frameworks/designer/ext/view.js
sproutit-sproutcore-1.0.0.20090416161445 frameworks/sproutcore/frameworks/designer/ext/view.js