How to use ember-runtime - 10 common examples

To help you get started, we’ve selected a few ember-runtime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emberjs / ember.js / packages / ember-views / lib / mixins / view_child_views_support.js View on Github external
init() {
    this._super(...arguments);

    // setup child views. be sure to clone the child views array first
    // 2.0TODO: Remove Ember.A() here
    this.childViews = emberA(this.childViews.slice());
    this.ownerView = this.ownerView || this;
  },
github emberjs / ember.js / packages / ember-htmlbars / lib / streams / class_name_binding.js View on Github external
if (className && !!val) {
      return className;
    } else if (falsyClassName && !val) {
      return falsyClassName;
    } else {
      return null;
    }

  // If value is a Boolean and true, return the dasherized property
  // name.
  } else if (val === true) {
    // Normalize property path to be suitable for use
    // as a class name. For exaple, content.foo.barBaz
    // becomes bar-baz.
    let parts = path.split('.');
    return dasherize(parts[parts.length - 1]);

  // If the value is not false, undefined, or null, return the current
  // value of the property.
  } else if (val !== false && val != null) {
    return val;

  // Nothing to display. Return null so that the old class is removed
  // but no new class is added.
  } else {
    return null;
  }
}
github emberjs / ember.js / packages / ember-htmlbars / lib / helpers / -normalize-class.js View on Github external
if (!!value) {
      return activeClass;
    } else {
      return inactiveClass;
    }

  // If value is a Boolean and true, return the dasherized property
  // name.
  } else if (value === true) {
    // Only apply to last segment in the path.
    if (propName && isPath(propName)) {
      let segments = propName.split('.');
      propName = segments[segments.length - 1];
    }

    return dasherize(propName);

  // If the value is not false, undefined, or null, return the current
  // value of the property.
  } else if (value !== false && value != null) {
    return value;

  // Nothing to display. Return null so that the old class is removed
  // but no new class is added.
  } else {
    return null;
  }
}
github emberjs / ember.js / packages / ember-handlebars / lib / ext.js View on Github external
' http://emberjs.com/guides/deprecations#toc_global-lookup-of-views', !globalViewClass);
      if (globalViewClass) {
        viewClass = globalViewClass;
      }
    }
  } else {
    viewClass = path;
  }

  // Sometimes a view's value is yet another path
  if ('string' === typeof viewClass && data && data.view) {
    viewClass = handlebarsGetView(data.view, viewClass, container, data);
  }

  Ember.assert(
    fmt(path+" must be a subclass of Ember.View, not %@", [viewClass]),
    View.detect(viewClass)
  );

  return viewClass;
}
github emberjs / ember.js / packages / ember-handlebars / lib / helpers / collection.js View on Github external
var itemHash = {};
  var match;

  // Extract item view class if provided else default to the standard class
  var collectionPrototype = collectionClass.proto();
  var itemViewClass;

  if (hash.itemView) {
    itemViewClass = handlebarsGetView(this, hash.itemView, container, options.data);
  } else if (hash.itemViewClass) {
    itemViewClass = handlebarsGetView(collectionPrototype, hash.itemViewClass, container, options.data);
  } else {
    itemViewClass = handlebarsGetView(collectionPrototype, collectionPrototype.itemViewClass, container, options.data);
  }

  Ember.assert(fmt("%@ #collection: Could not find itemViewClass %@", [data.view, itemViewClass]), !!itemViewClass);

  delete hash.itemViewClass;
  delete hash.itemView;

  // Go through options passed to the {{collection}} helper and extract options
  // that configure item views instead of the collection itself.
  for (var prop in hash) {
    if (hash.hasOwnProperty(prop)) {
      match = prop.match(/^item(.)(.*)$/);

      if (match && prop !== 'itemController') {
        // Convert itemShouldFoo -> shouldFoo
        itemHash[match[1].toLowerCase() + match[2]] = hash[prop];
        // Delete from hash as this will end up getting passed to the
        // {{view}} helper method.
        delete hash[prop];
github emberjs / ember.js / packages / ember-handlebars / lib / helpers / collection.js View on Github external
'that you created a view manually, instead of through the ' +
                 'container. Instead, use container.lookup("view:viewName"), ' +
                 'which will properly instantiate your view.',
                 controller && controller.container);
    container = controller.container;
    itemViewClass = container.lookupFactory('view:' + hash.itemView);
    Ember.assert('You specified the itemView ' + hash.itemView + ", but it was " +
                 "not found at " + container.describe("view:" + hash.itemView) +
                 " (and it was not registered in the container)", !!itemViewClass);
  } else if (hash.itemViewClass) {
    itemViewClass = handlebarsGet(collectionPrototype, hash.itemViewClass, options);
  } else {
    itemViewClass = collectionPrototype.itemViewClass;
  }

  Ember.assert(fmt("%@ #collection: Could not find itemViewClass %@", [data.view, itemViewClass]), !!itemViewClass);

  delete hash.itemViewClass;
  delete hash.itemView;

  // Go through options passed to the {{collection}} helper and extract options
  // that configure item views instead of the collection itself.
  for (var prop in hash) {
    if (hash.hasOwnProperty(prop)) {
      match = prop.match(/^item(.)(.*)$/);

      if (match && prop !== 'itemController') {
        // Convert itemShouldFoo -> shouldFoo
        itemHash[match[1].toLowerCase() + match[2]] = hash[prop];
        // Delete from hash as this will end up getting passed to the
        // {{view}} helper method.
        delete hash[prop];
github emberjs / ember.js / packages / ember-runtime / lib / mixins / -proxy.js View on Github external
setUnknownProperty(key, value) {
    var m = meta(this);
    if (m.proto === this) {
      // if marked as prototype then just defineProperty
      // rather than delegate
      defineProperty(this, key, null, value);
      return value;
    }

    var content = get(this, 'content');
    Ember.assert(fmt("Cannot delegate set('%@', %@) to the 'content' property of" +
                     " object proxy %@: its 'content' is undefined.", [key, value, this]), content);

    Ember.deprecate(
      fmt('You attempted to set `%@` from `%@`, but object proxying is deprecated. ' +
          'Please use `model.%@` instead.', [key, this, key]),
      !this.isController,
      { url: 'http://emberjs.com/guides/deprecations/#toc_objectcontroller' }
    );
    return set(content, key, value);
  }
github emberjs / ember.js / packages / ember-views / lib / index.js View on Github external
*/

// BEGIN EXPORTS
Ember.$ = jQuery;

Ember.ViewTargetActionSupport = ViewTargetActionSupport;

var ViewUtils = Ember.ViewUtils = {};
ViewUtils.isSimpleClick = isSimpleClick;
ViewUtils.getViewClientRects = getViewClientRects;
ViewUtils.getViewBoundingClientRect = getViewBoundingClientRect;

if (Ember.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
  Ember.CoreView = DeprecatedCoreView;
  Ember.View = DeprecatedView;
  Ember.View.states = states;
  Ember.View.cloneStates = cloneStates;
  Ember.View._Renderer = Renderer;
  Ember.ContainerView = DeprecatedContainerView;
  Ember.CollectionView = CollectionView;
}

Ember._Renderer = Renderer;

Ember.Checkbox = Checkbox;
Ember.TextField = TextField;
Ember.TextArea = TextArea;

if (Ember.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
  Ember.Select = Select;
}
github emberjs / ember.js / packages / ember-views / lib / main.js View on Github external
@method $
  @for Ember
*/

// BEGIN EXPORTS
Ember.$ = jQuery;

Ember.ViewTargetActionSupport = ViewTargetActionSupport;
Ember.RenderBuffer = RenderBuffer;

var ViewUtils = Ember.ViewUtils = {};
ViewUtils.setInnerHTML = setInnerHTML;
ViewUtils.isSimpleClick = isSimpleClick;

Ember.CoreView = CoreView;
Ember.View = View;
Ember.View.states = states;
Ember.View.cloneStates = cloneStates;

Ember._ViewCollection = ViewCollection;
Ember.ContainerView = ContainerView;
Ember.CollectionView = CollectionView;
Ember.Component = Component;
Ember.EventDispatcher = EventDispatcher;
// END EXPORTS

export default Ember;
github emberjs / ember.js / packages / ember-views / lib / index.js View on Github external
// BEGIN EXPORTS
Ember.$ = jQuery;

Ember.ViewTargetActionSupport = ViewTargetActionSupport;

var ViewUtils = Ember.ViewUtils = {};
ViewUtils.isSimpleClick = isSimpleClick;
ViewUtils.getViewClientRects = getViewClientRects;
ViewUtils.getViewBoundingClientRect = getViewBoundingClientRect;

if (Ember.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
  Ember.CoreView = DeprecatedCoreView;
  Ember.View = DeprecatedView;
  Ember.View.states = states;
  Ember.View.cloneStates = cloneStates;
  Ember.View._Renderer = Renderer;
  Ember.ContainerView = DeprecatedContainerView;
  Ember.CollectionView = CollectionView;
}

Ember._Renderer = Renderer;

Ember.Checkbox = Checkbox;
Ember.TextField = TextField;
Ember.TextArea = TextArea;

if (Ember.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
  Ember.Select = Select;
}

Ember.SelectOption = SelectOption;