decide.nolog.cz/app/routes/create.js
jelhan b7b57ef051 store timezone only if there is atleast one option including time
isDateTime could be true even if there isn't any option with time
2016-02-22 23:55:59 +01:00

37 lines
844 B
JavaScript

import Ember from 'ember';
/* global moment */
export default Ember.Route.extend({
actions: {
transitionToPoll(poll) {
this.transitionTo('poll', poll, {
queryParams: {
encryptionKey: this.get('encryptionKey')
}
});
}
},
beforeModel() {
// set encryption key
this.get('encryption').generateKey();
},
encryption: Ember.inject.service(),
encryptionKey: Ember.computed.alias('encryption.key'),
model() {
// create empty poll
return this.store.createRecord('poll', {
answerType: 'YesNo',
creationDate: new Date(),
forceAnswer: true,
anonymousUser: false,
isDateTime: true,
pollType: 'FindADate',
timezone: null,
expirationDate: moment().add(3, 'month').toISOString(),
version: this.buildInfo.semver
});
}
});