Ignore:
Timestamp:
07/24/12 16:39:41 (13 years ago)
Author:
jkraaijeveld
Message:

Can now edit basic question properties and store them.

File:
1 edited

Legend:

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

    r372 r374  
    11define(['dojo/_base/declare',
    22    'dojo/_base/lang',
     3    'dojo/_base/event',
    34    'dojo/_base/Deferred',
    45    'rft/ui/LineWithActionsWidget',
     
    1415    'rft/ui/QuestionEditorToolkit',
    1516    'dijit/form/FilteringSelect'],
    16     function(declare, lang, Deferred, LineWithActionsWidget, store, _Page, api, content, registry, on, behavior, query){
     17    function(declare, lang, event, Deferred, LineWithActionsWidget, store, _Page, api, content, registry, on, behavior, query){
    1718        return declare('rft.pages.question', [_Page], {
    1819            question: null,
     
    3738            },
    3839            _refresh: function () {
    39                 this._toolkit.propertiesForm.set('value', this.question);
     40                this._toolkit.loadQuestion(this.question);
     41            },
     42            _onSave: function() {
     43                lang.mixin(this.question, this._toolkit.propertiesForm.get('value'));
     44                this.question.categories = this._toolkit._categories;
     45                store.put(this.question)
     46                .then(function() {
     47                    content.goTo('questions');
     48                });
     49                return false;
     50            },
     51            _onDiscard: function() {
     52                this._toolkit.propertiesForm.reset();
     53                content.goTo('questions');
     54                return false;
    4055            },
    4156            _setupButtons: function() {
     
    4358                    "#btnSave": {
    4459                        onclick: lang.hitch(this, function(){
    45                             this._saveSurvey();
     60                            this._onSave();
    4661                        })
    4762                    },
    4863                    "#btnDiscard": {
    4964                        onclick: lang.hitch(this, function(){
    50                             this._restartEditor();
     65                            this._onDiscard();
    5166                        })
    5267                    }
Note: See TracChangeset for help on using the changeset viewer.