Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Component from 'ember-component';
import get from 'ember-metal/get';
import set from 'ember-metal/set';
import service from 'ember-service/inject';
import computed, { alias } from 'ember-computed';
import { isPresent } from 'ember-utils';
import { task } from 'ember-concurrency';
import { translationMacro as t } from 'ember-intl';
export default Component.extend({
classNames: ['review-modal'],
intl: service(),
metrics: service(),
store: service(),
rating: alias('review.libraryEntry.rating'),
errorMessage: t('errors.request'),
isValid: computed('rating', 'review.content', function() {
return (get(this, 'rating') > 0) && isPresent(get(this, 'review.content'));
}).readOnly(),
init() {
this._super(...arguments);
// make sure the required data is loaded into the mode
get(this, 'loadReview').perform().then(() => {
get(this, 'loadRelationships').perform();
}).catch(() => {});
},
willDestroyElement() {
this._super(...arguments);
get(this, 'review').rollbackAttributes();
beforeEach() {
const intl = this.subject();
intl.setLocale('en');
this.object = Ember.Object
.extend({
intl: intl,
numberClicks: 9,
tMacroProperty1: t('no.interpolations'),
tMacroProperty2: t('with.interpolations', { clicks: 'numberClicks' })
})
.create();
}
});
beforeEach() {
const intl = this.subject();
intl.setLocale('en');
this.object = Ember.Object
.extend({
intl: intl,
numberClicks: 9,
tMacroProperty1: t('no.interpolations'),
tMacroProperty2: t('with.interpolations', { clicks: 'numberClicks' })
})
.create();
}
});