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/question.js

    r443 r487  
    33    "../app/Page",
    44    "../app/Router",
    5     "../model/classes/Question",
     5    "../model/classes/questions",
    66    "../model/widgets/QuestionEditorPreview",
    77    "../model/widgets/QuestionEditorToolkit",
    8     "../store",
    98    "../widgets/_ComplexValueMixin",
    109    "dojo/_base/declare",
     
    1312    "dojo/when",
    1413    "dojo/text!./templates/question.html"
    15 ], function(Content, Page, Router, Question, QuestionEditorPreview, QuestionEditorToolkit, store, _ComplexValueMixin, declare, event, lang, when, template) {
     14], function(Content, Page, Router, questions, QuestionEditorPreview, QuestionEditorToolkit, _ComplexValueMixin, declare, event, lang, when, template) {
    1615    return declare([Page,_ComplexValueMixin], {
    1716        templateString: template,
     
    4342            }
    4443            if (this.questionId === "new") {
    45                 this.set('value', Question.create());
     44                this.set('value', questions.create());
    4645            } else {
    47                 when(store.get(this.questionId))
     46                when(questions.load(this.questionId))
    4847                .then(lang.hitch(this, function(value) {
    4948                    this.set('value', value);
     
    5453            this.value = value;
    5554            this.inherited(arguments);
    56             this.titleNode.innerHTML = Question.DisplayTitle.get(value);
     55            this.titleNode.innerHTML = value.title || "";
    5756        },
    5857        _getValueAttr: function() {
     
    6362        _onSave: function(evt) {
    6463            if ( this.validate() ) {
    65                 var value = this.get('value');
    66                 store.put(value)
     64                questions.save(this.get('value'))
    6765                .then(function() {
    6866                    Router.go('/questions');
Note: See TracChangeset for help on using the changeset viewer.