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

Last change on this file since 490 was 490, checked in by hendrikvanantwerpen, 11 years ago
  • Mark content as dirty to prevent moving away from unsaved data.
  • Better change propagation from lists and our own widgets.
  • Generate notifications for errors and show correct message.
  • Moved all path/url generation to the class stores, not everywhere we use it.
  • Give user always a choice between Save and Save & Close.
  • Better refresh behaviour on form changes and saves.
  • Don't generate duplicate code error when existing object is the one you're storing.
File size: 1.0 KB
Line 
1define([
2    "./_Class",
3    "dojo/_base/declare",
4    "dojo/date/stamp",
5    "dojo/store/JsonRest"
6], function(_Class, declare, stamp, JsonRest) {
7
8    var Surveys = declare([_Class],{
9        _collection: 'surveys',
10        _type: 'Survey',
11        create: function() {
12            var obj = {
13                type: this._type,
14                questions: [],
15                title: ""
16            };
17            return obj;
18        },
19        _deserialize: function(obj) {
20            if (obj.publicationDate) {
21                obj.publicationDate = stamp.fromISOString(obj.publicationDate);
22            }
23        },
24        _serialize: function(obj) {
25            if (obj.publicationDate) {
26                obj.publicationDate = stamp.toISOString(obj.publicationDate);
27            }
28        },
29        getPreviewPath: function(idOrObj) {
30            return '/previewSurvey/'+(typeof idOrObj === "string"?
31                                      idOrObj :
32                                      this.getId(idOrObj));
33        }
34    });
35
36    return new Surveys();
37
38});
Note: See TracBrowser for help on using the repository browser.