How to use the ember-runtime/system/string.fmt function in ember-runtime

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-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-handlebars / lib / helpers / bind_attr.js View on Github external
lazyValue.subscribe(view._wrapAsScheduled(function applyAttributeBindings() {
      var result = lazyValue.value();

      Ember.assert(fmt("Attributes must be numbers, strings or booleans, not %@", [result]),
                   result === null || result === undefined || typeof result === 'number' ||
                     typeof result === 'string' || typeof result === 'boolean');

      var elem = view.$("[data-bindattr-" + dataId + "='" + dataId + "']");

      Ember.assert("An attribute binding was triggered when the element was not in the DOM", elem && elem.length !== 0);

      View.applyAttributeBindings(elem, attr, result);
    }));
github emberjs / ember.js / packages / ember-views / lib / views / each.js View on Github external
_assertArrayLike: function(content) {
    Ember.assert(fmt("The value that #each loops over must be an Array. You " +
                     "passed %@, but it should have been an ArrayController",
                     [content.constructor]),
                     !ControllerMixin.detect(content) ||
                       (content && content.isGenerated) ||
                       content instanceof ArrayController);
    Ember.assert(fmt("The value that #each loops over must be an Array. You passed %@",
                     [(ControllerMixin.detect(content) &&
                       content.get('model') !== undefined) ?
                       fmt("'%@' (wrapped in %@)", [content.get('model'), content]) : content]),
                     EmberArray.detect(content));
  },
github emberjs / ember.js / packages / ember-views / lib / views / states / destroying.js View on Github external
appendChild: function() {
    throw new EmberError(fmt(destroyingError, ['appendChild']));
  },
  rerender: function() {
github emberjs / ember.js / packages / ember-htmlbars / lib / helpers / bind-attr.js View on Github external
}

  var attrKeys = keys(hash);

  var attr, path, lazyValue, attrView;
  for (var i=0, l=attrKeys.length;i
github emberjs / ember.js / packages / ember-views / lib / views / each.js View on Github external
_assertArrayLike: function(content) {
    Ember.assert(fmt("The value that #each loops over must be an Array. You " +
                     "passed %@, but it should have been an ArrayController",
                     [content.constructor]),
                     !ControllerMixin.detect(content) ||
                       (content && content.isGenerated) ||
                       content instanceof ArrayController);
    Ember.assert(fmt("The value that #each loops over must be an Array. You passed %@",
                     [(ControllerMixin.detect(content) &&
                       content.get('model') !== undefined) ?
                       fmt("'%@' (wrapped in %@)", [content.get('model'), content]) : content]),
                     EmberArray.detect(content));
  },
github emberjs / ember.js / packages / ember-routing-views / lib / views / link.js View on Github external
loadedParams: computed('resolvedParams', function computeLinkViewRouteArgs() {
    var router = get(this, 'router');
    if (!router) { return; }

    var resolvedParams = get(this, 'resolvedParams');
    var namedRoute = resolvedParams.targetRouteName;

    if (!namedRoute) { return; }

    Ember.assert(fmt("The attempt to link-to route '%@' failed. " +
                     "The router did not find '%@' in its possible routes: '%@'",
                     [namedRoute, namedRoute, keys(router.router.recognizer.names).join("', '")]),
                     router.hasRoute(namedRoute));

    if (!paramsAreLoaded(resolvedParams.models)) { return; }

    return resolvedParams;
  }),