Ignore:
Timestamp:
12/04/12 16:29:49 (12 years ago)
Author:
hendrikvanantwerpen
Message:

Support data validation and increase dendency separation.

Added json-schema validation before documents are saved. Acts both as
a safe-guard and as a reference of the data model.

Added directory for server related material. For now it contains scripts
to configure CouchDB and check validity of documents against the schema.

Started separating out parts that depend on the data model from parts
that do not.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/client/rft/pages/question.js

    r410 r415  
    2121            if ( this._started ) { return; }
    2222            this.inherited(arguments);
    23             if (this.questionId) {
     23            if ( !this.questionId ) {
     24                throw new Error("Error: no reference to object set!");
     25            }
     26            this._setupEditor();
     27            if (this.questionId === "new") {
     28                this.question = { type: 'Question' };
     29                this._refresh();
     30            } else {
    2431                Deferred.when(store.get(this.questionId))
    2532                .then(lang.hitch(this, function(obj) {
     
    2734                    this._refresh();
    2835                }));
    29             } else {
    30                 throw new Error("Error: no reference to object set!");
    3136            }
    32             this._setupEditor();
    3337        },
    3438        onLeave: function() {
     
    3640        },
    3741        _refresh: function () {
     42            this.titleNode.innerHTML = this.question.title || "";
    3843            this._toolkit.set('value',this.question);
    3944            this._preview.appendItems(this.question.content || []);
     
    4651                Router.go('/questions');
    4752            },function(err){
    48                 Content.notify(err.reason,'error');
     53                Content.notify(err,'error');
    4954            });
    5055            evt && event.stop( evt );
Note: See TracChangeset for help on using the changeset viewer.