2014-10-30 21:44:22 +01:00
|
|
|
import DS from "ember-data";
|
|
|
|
import Ember from "ember";
|
|
|
|
|
2014-07-06 17:37:54 +02:00
|
|
|
export default DS.Model.extend({
|
2015-07-07 11:52:46 +02:00
|
|
|
// relationship
|
|
|
|
users : DS.hasMany('user'),
|
|
|
|
|
|
|
|
// properties
|
|
|
|
encryptedTitle : DS.attr('string'),
|
|
|
|
title : Ember.computed.encrypted('encryptedTitle', 'string'),
|
|
|
|
|
|
|
|
encryptedDescription : DS.attr('string'),
|
|
|
|
description: Ember.computed.encrypted('encryptedDescription', 'string'),
|
|
|
|
|
|
|
|
encryptedPollType : DS.attr('string'),
|
|
|
|
pollType : Ember.computed.encrypted('encryptedPollType', 'string'),
|
|
|
|
|
|
|
|
encryptedAnswerType: DS.attr('string'),
|
|
|
|
answerType : Ember.computed.encrypted('encryptedAnswerType', 'string'),
|
|
|
|
|
|
|
|
encryptedAnswers : DS.attr('string'),
|
|
|
|
answers : Ember.computed.encrypted('encryptedAnswers', 'array'),
|
|
|
|
|
|
|
|
encryptedOptions : DS.attr('string'),
|
|
|
|
options : Ember.computed.encrypted('encryptedOptions', 'array'),
|
|
|
|
|
|
|
|
encryptedCreationDate : DS.attr('string'),
|
|
|
|
creationDate : Ember.computed.encrypted('encryptedCreationDate', 'date'),
|
|
|
|
|
|
|
|
encryptedForceAnswer : DS.attr('string'),
|
|
|
|
forceAnswer : Ember.computed.encrypted('encryptedForceAnswer', 'boolean'),
|
|
|
|
|
|
|
|
encryptedAnonymousUser : DS.attr('string'),
|
|
|
|
anonymousUser : Ember.computed.encrypted('encryptedAnonymousUser', 'boolean'),
|
|
|
|
|
|
|
|
encryptedIsDateTime : DS.attr('string'),
|
|
|
|
isDateTime : Ember.computed.encrypted('encryptedIsDateTime', 'boolean'),
|
|
|
|
|
2015-07-15 16:20:24 +02:00
|
|
|
encryptedTimezone : DS.attr('string'),
|
|
|
|
timezone : Ember.computed.encrypted('encryptedTimezone', 'string'),
|
2015-06-20 19:04:19 +02:00
|
|
|
|
2015-08-18 21:53:52 +02:00
|
|
|
encryptedExpirationDate : DS.attr('string'),
|
|
|
|
expirationDate : Ember.computed.encrypted('encryptedExpirationDate', 'string'),
|
|
|
|
|
|
|
|
// store expiration date unencrypted on create
|
|
|
|
serverExpirationDate : DS.attr('string'),
|
2015-07-26 19:41:59 +02:00
|
|
|
|
2015-07-07 11:52:46 +02:00
|
|
|
version : DS.attr('string'),
|
|
|
|
|
|
|
|
// computed properties
|
|
|
|
isFindADate: function() {
|
|
|
|
return this.get('pollType') === 'FindADate';
|
|
|
|
}.property('pollType'),
|
|
|
|
|
|
|
|
isFreeText: function() {
|
|
|
|
return this.get('answerType') === 'FreeText';
|
|
|
|
}.property('answerType'),
|
|
|
|
|
|
|
|
isMakeAPoll: function() {
|
|
|
|
return this.get('pollType') === 'MakeAPoll';
|
|
|
|
}.property('pollType')
|
2015-06-20 19:04:19 +02:00
|
|
|
});
|