Sha256: 5e9628328e6fce20721e8496e90c08f973e7b4abfed234a3ff55c5e96655f554

Contents?: true

Size: 1.23 KB

Versions: 17

Compression:

Stored size: 1.23 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2008-2011 Apple Inc. All rights reserved.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================
/**
  Handles propagation of a property inEditMode to all child views.
*/
SC.FormsEditMode = {
  
  /**
    Walks like a duck.
  */
  hasEditMode: YES,
  
  /**
    Whether we are in edit mode.
  */
  isEditing: NO,
  
  /**
    Handles changes to edit state. Alerts children.
  */
  editModeDidChange: function(){
    this._propagateEditMode();    
  }.observes("isEditing"),
  
  /**
    Ensures that edit mode is passed to all children.
  */
  _scfem_childViewsDidChange: function() {
    this._propagateEditMode();
  }.observes("childViews"),
  
  /**
    Propagates edit mode.
  */
  _propagateEditMode: function() {
    var isEditing = this.get("isEditing");
    var cv = this.get("childViews"), idx, len = cv.length, v;
    for (idx = 0; idx < len; idx++) {
      v = cv[idx];
      if (SC.typeOf(v) === SC.T_STRING || v.isClass) return;
      if (v.get("hasEditMode")) v.set("isEditing", isEditing);
    }
  }
  
};

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sproutcore-1.6.0.rc.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.6.0.rc.2 lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.6.0.rc.2-java lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.6.0.rc.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.6.0.rc.1 lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.6.0.rc.1-java lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.6.0.beta.3-x86-mingw32 lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.6.0.beta.3-java lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.6.0.beta.3 lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.6.0.beta.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.6.0.beta.2-java lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.6.0.beta.2 lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.6.0.beta.1 lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js
sproutcore-1.5.0-java lib/frameworks/sproutcore/frameworks/forms/mixins/edit_mode.js
sproutcore-1.5.0 lib/frameworks/sproutcore/frameworks/forms/mixins/edit_mode.js
sproutcore-1.5.0.rc.2 lib/frameworks/sproutcore/frameworks/forms/mixins/edit_mode.js
sproutcore-1.5.0.rc.1 lib/frameworks/sproutcore/frameworks/forms/mixins/edit_mode.js