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();
export function initialize(registry, app = {}) {
registerHelper('format-date', FormatDate, registry);
registerHelper('format-time', FormatTime, registry);
registerHelper('format-relative', FormatRelative, registry);
registerHelper('format-number', FormatNumber, registry);
registerHelper('format-html-message', FormatHtmlMessage, registry);
registerHelper('format-message', FormatMessage, registry);
registerHelper('t', FormatMessage, registry);
registerHelper('l', LiteralHelper, registry);
if (app.instanceInitializer) {
return;
}
// for backwards compatability < 1.12
instanceInitializer({
container: registry
});
}
export function initialize(registry, app = {}) {
registerHelper('format-date', FormatDate, registry);
registerHelper('format-time', FormatTime, registry);
registerHelper('format-relative', FormatRelative, registry);
registerHelper('format-number', FormatNumber, registry);
registerHelper('format-html-message', FormatHtmlMessage, registry);
registerHelper('format-message', FormatMessage, registry);
registerHelper('t', FormatMessage, registry);
registerHelper('l', LiteralHelper, registry);
if (app.instanceInitializer) {
return;
}
// for backwards compatability < 1.12
instanceInitializer({
container: registry
});
}
export function initialize(registry, app = {}) {
registerHelper('format-date', FormatDate, registry);
registerHelper('format-time', FormatTime, registry);
registerHelper('format-relative', FormatRelative, registry);
registerHelper('format-number', FormatNumber, registry);
registerHelper('format-html-message', FormatHtmlMessage, registry);
registerHelper('format-message', FormatMessage, registry);
registerHelper('t', FormatMessage, registry);
registerHelper('l', LiteralHelper, registry);
if (app.instanceInitializer) {
return;
}
// for backwards compatability < 1.12
instanceInitializer({
container: registry
});
}
export function initialize(registry, app = {}) {
registerHelper('format-date', FormatDate, registry);
registerHelper('format-time', FormatTime, registry);
registerHelper('format-relative', FormatRelative, registry);
registerHelper('format-number', FormatNumber, registry);
registerHelper('format-html-message', FormatHtmlMessage, registry);
registerHelper('format-message', FormatMessage, registry);
registerHelper('t', FormatMessage, registry);
registerHelper('l', LiteralHelper, registry);
if (app.instanceInitializer) {
return;
}
// for backwards compatability < 1.12
instanceInitializer({
container: registry
});
}
export function initialize(registry, app = {}) {
registerHelper('format-date', FormatDate, registry);
registerHelper('format-time', FormatTime, registry);
registerHelper('format-relative', FormatRelative, registry);
registerHelper('format-number', FormatNumber, registry);
registerHelper('format-html-message', FormatHtmlMessage, registry);
registerHelper('format-message', FormatMessage, registry);
registerHelper('t', FormatMessage, registry);
registerHelper('l', LiteralHelper, registry);
if (app.instanceInitializer) {
return;
}
// for backwards compatability < 1.12
instanceInitializer({
container: registry
});
}
export function initialize(registry, app = {}) {
registerHelper('format-date', FormatDate, registry);
registerHelper('format-time', FormatTime, registry);
registerHelper('format-relative', FormatRelative, registry);
registerHelper('format-number', FormatNumber, registry);
registerHelper('format-html-message', FormatHtmlMessage, registry);
registerHelper('format-message', FormatMessage, registry);
registerHelper('t', FormatMessage, registry);
registerHelper('l', LiteralHelper, registry);
if (app.instanceInitializer) {
return;
}
// for backwards compatability < 1.12
instanceInitializer({
container: registry
});
}
export function initialize(registry, app = {}) {
registerHelper('format-date', FormatDate, registry);
registerHelper('format-time', FormatTime, registry);
registerHelper('format-relative', FormatRelative, registry);
registerHelper('format-number', FormatNumber, registry);
registerHelper('format-html-message', FormatHtmlMessage, registry);
registerHelper('format-message', FormatMessage, registry);
registerHelper('t', FormatMessage, registry);
registerHelper('l', LiteralHelper, registry);
if (app.instanceInitializer) {
return;
}
// for backwards compatability < 1.12
instanceInitializer({
container: registry
});
export function initialize(registry, app = {}) {
registerHelper('format-date', FormatDate, registry);
registerHelper('format-time', FormatTime, registry);
registerHelper('format-relative', FormatRelative, registry);
registerHelper('format-number', FormatNumber, registry);
registerHelper('format-html-message', FormatHtmlMessage, registry);
registerHelper('format-message', FormatMessage, registry);
registerHelper('t', FormatMessage, registry);
registerHelper('l', LiteralHelper, registry);
if (app.instanceInitializer) {
return;
}
// for backwards compatability < 1.12
instanceInitializer({
container: registry
});
}
export default (decoratorWithParams(function intl(
target: Target,
key: keyof Target,
desc: PropertyDescriptor & { initializer: () => GetterFn },
dependentKeys: string[] = []
) {
const value: GetterFn = desc.value;
const initializer: () => GetterFn = desc.initializer;
delete desc.value;
delete desc.initializer;
const cp = intlMacro(...dependentKeys, function(
intl: IntlService, // eslint-disable-line no-shadow
propertyKey: string
) {
const fn: GetterFn = value || initializer.call(this);
assert(
`@intl: You need to decorate a function, but you decorated '${fn}'.`,
typeof fn === 'function'
);
return fn.call(this, intl, propertyKey);
});
// @ts-ignore
return cp(target, key, desc);
}) as unknown) as ((
...args: Parameters