How to use the ember-metal/get function in ember-metal

To help you get started, we’ve selected a few ember-metal 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 hummingbird-me / hummingbird-client / app / components / media / media-relationships.js View on Github external
mediaRelationships.forEach((relationship) => {
      const role = get(relationship, 'role');
      results[role] = results[role] || [];
      results[role].addObject(get(relationship, 'destination'));
    });
    // sort the results by key
github Fabriquartz / ember-railio-grid / addon / utils / data-manager.js View on Github external
get() {
      return get(this, '_sortingHandler') || SortingHandler.create();
    }
  }),
github Ticketfly / ember-ticketfly-accordion / addon / components / tf-accordion.js View on Github external
setFocusOnPanel(panel, index) {
    set(this, 'focusedIndex', index);
    get(this, 'panels').setEach('isFocused', false);
    set(panel, 'isFocused', true);
    get(panel, 'tab.element').focus();
  },
github Ticketfly / ember-ticketfly-accordion / addon / components / tf-accordion-panel-body.js View on Github external
get() {
      return get(this, 'isHidden') ? 'true' : 'false';
    }
  }).readOnly(),
github hummingbird-me / hummingbird-client / app / mixins / pagination.js View on Github external
getNextData: task(function* () {
    const nextLink = get(this, 'nextLink');
    if (nextLink === undefined) {
      return;
    }
    let model = get(this, 'model');
    model = get(model, 'firstObject') || model;
    let { modelName } = model.constructor;
    modelName = get(this, 'modelName') || modelName;
    const options = Object.assign(this._parseLink(nextLink), get(this, 'options'));
    const records = yield get(this, 'store').query(modelName, options);
    const links = get(records, 'links');
    invokeAction(this, 'update', records, links);
    return records;
  }).drop(),
github hummingbird-me / hummingbird-client / app / services / lazy.js View on Github external
Object.keys(condition.filter).forEach((filter) => {
        const val = condition.filter[filter];

        if (storeFilter[filter] === undefined) storeFilter[filter] = [val];
        else storeFilter[filter].addObject(val);
      });
    });

    Object.keys(storeFilter).forEach((key) => {
      if (storeFilter[key].length === 1) storeFilter[key] = storeFilter[key][0];
      else multikey = key;
    });

    const filterkey = (collection.isRelationship) ? `${multikey}.id` : multikey;

    return get(this, 'store').query(collection.resource, {
      filter: storeFilter,
      include: collection.objects.objectAt(0).include
    }).then((payload) => {
      collection.promises.forEach(([resolve, reject], i) => {
        const filter = collection.objects[i].filter;
        resolve(payload.filter(condition => filter[multikey] === get(condition, filterkey)));
      });
    });
  },
github hummingbird-me / hummingbird-client / app / components / trending / highest-rated.js View on Github external
getDataTask: task(function* (type) {
    return yield get(this, 'queryCache').query(type, {
      filter: { year: get(this, 'lastYear') },
      sort: '-average_rating',
      page: { limit: 10 }
    });
  }).restartable()
});
github hummingbird-me / hummingbird-client / app / components / media / media-follow.js View on Github external
toggleFollow: task(function* () {
    if (get(this, 'session.isAuthenticated') === false) {
      return get(this, 'session.signUpModal')();
    }

    if (get(this, 'isFollowing')) {
      yield get(this, 'relationship').destroyRecord().then(() => {
        set(this, 'relationship', undefined);
        get(this, 'queryCache').invalidateQuery('media-follow', this._getRequestOptions());
      }).catch(err => get(this, 'notify').error(errorMessages(err)));
    } else {
      yield get(this, 'store').createRecord('media-follow', {
        user: get(this, 'session.account'),
        media: get(this, 'media')
      }).save().then((record) => {
        set(this, 'relationship', record);
        get(this, 'metrics').trackEvent({
          category: 'follow',
          action: 'create',
          label: 'media',
          value: get(this, 'media.id')
        });
      }).catch(err => get(this, 'notify').error(errorMessages(err)));
github hummingbird-me / hummingbird-client / app / components / epic-tooltip.js View on Github external
targetEntered() {
    if (get(this, 'isDestroyed')) { return; }
    if (get(this, 'singleInstance') === true) {
      get(this, 'epicTooltip').all().forEach(component => component.targetLeave());
    }
    get(this, 'tether').enable();
    get(this, 'tether').position();
    this.$().show();
  },
github hummingbird-me / hummingbird-client / app / components / media-review.js View on Github external
i18nTitle: getter(function() {
    const review = get(this, 'i18n').t('reviews.review');
    const reviewLink = createLink(`/reviews/${get(this, 'review.id')}`, review);
    const userLink = createLink(`/users/${get(this, 'review.user.name')}`, get(this, 'review.user.name'));
    let type = modelType([get(this, 'media') || get(this, 'review.media')]);
    if (!get(this, 'review.progress')) type = 'unprogressed';
    return get(this, 'i18n').t(`reviews.title.${type}`, {
      link: reviewLink,
      user: userLink,
      progress: get(this, 'review.progress')
    });
  }),