Update Ember to 3.1
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import Component from 'ember-component';
|
||||
import computed, { and } from 'ember-computed';
|
||||
import injectService from 'ember-service/inject';
|
||||
import isPresent from 'kredits-web/utils/cps/is-present';
|
||||
import Component from '@ember/component';
|
||||
import { computed } from '@ember/object';
|
||||
import { and, notEmpty } from '@ember/object/computed';
|
||||
import { inject as injectService } from '@ember/service';
|
||||
|
||||
export default Component.extend({
|
||||
kredits: injectService(),
|
||||
@@ -22,28 +22,28 @@ export default Component.extend({
|
||||
|
||||
contributors: [],
|
||||
|
||||
isValidRecipient: isPresent('contributorId'),
|
||||
isValidRecipient: notEmpty('contributorId'),
|
||||
isValidAmount: computed('amount', function() {
|
||||
return parseInt(this.get('amount'), 10) > 0;
|
||||
return parseInt(this.amount, 10) > 0;
|
||||
}),
|
||||
isValidDescription: isPresent('description'),
|
||||
isValidUrl: isPresent('url'),
|
||||
isValidDescription: notEmpty('description'),
|
||||
isValidUrl: notEmpty('url'),
|
||||
isValid: and('isValidRecipient',
|
||||
'isValidAmount',
|
||||
'isValidDescription'),
|
||||
|
||||
reset: function() {
|
||||
this.setProperties(this.get('attributes'));
|
||||
this.setProperties(this.attributes);
|
||||
},
|
||||
|
||||
actions: {
|
||||
submit() {
|
||||
if (!this.get('isValid')) {
|
||||
if (!this.isValid) {
|
||||
alert('Invalid data. Please review and try again.');
|
||||
return;
|
||||
}
|
||||
|
||||
let attributes = Object.keys(this.get('attributes'));
|
||||
let attributes = Object.keys(this.attributes);
|
||||
let proposal = this.getProperties(attributes);
|
||||
let saved = this.save(proposal);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user