source: Dev/trunk/src/client/qed-client/model/classes/surveys.js

Last change on this file was 492, checked in by hendrikvanantwerpen, 11 years ago
  • Enable/disable buttons on content change.
  • One place to do date formatting, because it was going wrong again.
  • Serialize questions in survey properly.
  • _ComplexValueMixin consumes submit events, but does trigger outer forms if present.
  • Trigger dialog show/hide for login only after previous effect is finished.
  • Check that documents are actually valid, not just that validator returned a result.
  • Validate email and timestamp formats.
  • Prepared for live runs.
File size: 1.3 KB
RevLine 
[487]1define([
2    "./_Class",
[492]3    "./questions",
4    "dojo/_base/array",
[487]5    "dojo/_base/declare",
[492]6    "dojo/_base/lang"
7], function(_Class, questions, array, declare, lang) {
[487]8
9    var Surveys = declare([_Class],{
10        _collection: 'surveys',
11        _type: 'Survey',
12        create: function() {
13            var obj = {
14                type: this._type,
15                questions: [],
16                title: ""
17            };
18            return obj;
[443]19        },
[487]20        _deserialize: function(obj) {
[492]21            obj.questions = array.map(obj.questions,
22                                      lang.hitch(questions,'_doDeserialize'));
[487]23            if (obj.publicationDate) {
[492]24                obj.publicationDate = this._parseDate(obj.publicationDate);
[443]25            }
26        },
[487]27        _serialize: function(obj) {
[492]28            obj.questions = array.map(obj.questions,
29                                      lang.hitch(questions,'_doSerialize'));
[487]30            if (obj.publicationDate) {
[492]31                obj.publicationDate = this._formatDate(obj.publicationDate);
[443]32            }
[490]33        },
34        getPreviewPath: function(idOrObj) {
35            return '/previewSurvey/'+(typeof idOrObj === "string"?
36                                      idOrObj :
37                                      this.getId(idOrObj));
[443]38        }
[487]39    });
40
41    return new Surveys();
42
43});
Note: See TracBrowser for help on using the repository browser.