Ignore:
Timestamp:
03/05/14 22:44:48 (11 years ago)
Author:
hendrikvanantwerpen
Message:

Completed migration to API, without CouchDB proxy.

Move to API is now completed. The full API is password protected, a very
limited API is exposed for respondents, which works with secrets that
are passed in URLs.

Serverside the HTTPResult class was introduced, which is similar to
Promises, but specifically for HTTP. It carries a status code and
response and makes it easier to extract parts of async handling in
separate functions.

Fixed a bug in our schema (it seems optional attributes don't exist but
a required list does). Verification of our schema by grunt-tv4 didn't
work yet. Our schema is organized the wrong way (this is fixable),
but the json-schema schema has problems with simple types and $refs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/pages/survey.js

    r443 r487  
    22    "../app/Page",
    33    "../app/Router",
    4     "../model/classes/Survey",
     4    "../model/classes/surveys",
    55    "../model/widgets/QuestionListView",
    66    "../model/widgets/TabbedQuestionBrowser",
    7     "../store",
    87    "dojo/_base/array",
    98    "dojo/_base/declare",
     
    1312    "require",
    1413    "dojo/text!./templates/survey.html"
    15 ], function(Page, Router, Survey, QuestionListView, TabbedQuestionBrowser, store, array, declare, event, lang, when, require, template) {
     14], function(Page, Router, surveys, QuestionListView, TabbedQuestionBrowser, array, declare, event, lang, when, require, template) {
    1615    return declare([Page],{
    1716        contextRequire: require,
     
    6362        _loadSurvey: function() {
    6463            if ( this.surveyId === "new" ) {
    65                 this.survey = Survey.create();
     64                this.survey = surveys.create();
    6665                this.refresh();
    6766            } else {
    68                 when(store.get(this.surveyId))
     67                when(surveys.load(this.surveyId))
    6968                .then(lang.hitch(this,function(survey){
    7069                    this.survey = survey;
    7170                    this.questionList.set('value',
    72                                           Survey.Questions.get(this.survey));
     71                                          this.survey.questions);
    7372                    this.refresh();
    7473                }));
     
    7978        },
    8079        refresh: function() {
    81             this.titleNode.innerHTML = Survey.DisplayTitle.get(this.survey) || "(set title in properties)";
     80            this.titleNode.innerHTML = this.survey.title || "(set title in properties)";
    8281            this.propertiesDialog.set('value',this.survey);
    8382        },
     
    10099        _onSave: function(evt) {
    101100            this.survey.questions = this.questionList.get('value');
    102             store.put(this.survey)
     101            surveys.save(this.survey)
    103102            .then(function() {
    104103                Router.go('/surveys');
     
    111110        },
    112111        _onShowPreview: function() {
    113             Router.go('/previewSurvey/'+store.getIdentity(this.survey),{
     112            Router.go('/previewSurvey/'+this.survey._id,{
    114113                preview: true
    115114            });
Note: See TracChangeset for help on using the changeset viewer.