Ignore:
Timestamp:
07/18/12 18:49:11 (13 years ago)
Author:
tjcschipper
Message:
  • AdaptiveForm? really isn't anything yet, but it's supposed to become a way to encapsulate forms that add/remove inputs based on other input's (selected) values.
  • Created a skeleton for the question editor. It's almost an exact copy of SurveyAdvanced?.
File:
1 moved

Legend:

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

    r363 r366  
    88    'rft/content',
    99    'dijit/registry',
    10     'dojo/on'],
    11     function(declare, lang, Deferred, LineWithActionsWidget, store, _Page, api, content, registry, on){
    12         return declare('rft.pages.surveyAdvanced', [_Page], {
     10    'dojo/on',
     11    'dojo/behavior',
     12    'dojo/query',
     13    'rft/ui/QuestionEditorPreview',
     14    'rft/ui/QuestionEditorToolkit',
     15    'dijit/form/FilteringSelect'],
     16    function(declare, lang, Deferred, LineWithActionsWidget, store, _Page, api, content, registry, on, behavior, query){
     17        return declare('rft.pages.question', [_Page], {
    1318            object: null,
     19            preview: null,
     20           
    1421            onVisit: function() {
    1522                if (this.pageArgs.uid) {
     
    2330
    2431                this._setupButtons();
     32                this._setupEditor();
    2533            },
    2634            onLeave: function() {
    2735                this.inherited(arguments);
    2836            },
    29             _confirmSave: function() {
    30                 return confirm("Do you want to save?");
     37            _setupButtons: function() {
     38                var behaviorMap = {
     39                    "#btnSave": {
     40                        onclick: lang.hitch(this, function(){
     41                            this._saveSurvey();
     42                        })
     43                    },
     44                    "#btnDiscard": {
     45                        onclick: lang.hitch(this, function(){
     46                            this._restartEditor();
     47                        })
     48                    }
     49                }
     50                behavior.add(behaviorMap);
     51                behavior.apply();
    3152            },
    32             _saveSurvey: function() {
    33             },
    34             _restartEditor: function() {
    35             },
    36             _backToEditor: function() {
    37                 if (this._confirmSave()) {
    38                     this._saveSurvey()
    39                     content.goTo('survey', {uid: this.object._id});
    40                 } else {
    41                     content.goTo('survey', {uid: this.object._id});
    42                 }
    43             },
    44             _setupButtons: function() {
    45                 registry.byId("btnSave").on("click", lang.hitch(this, function() {
    46                     this._saveSurvey();
    47                 }));
    48                 registry.byId("btnDiscard").on("click", lang.hitch(this, function() {
    49                     this._restartEditor();
    50                 }));
    51                 registry.byId("btnBack").on("click", lang.hitch(this, function() {
    52                     this._backToEditor();
    53                 }));
     53            _setupEditor: function() {
     54                this.toolkit = new rft.ui.QuestionEditorToolkit();
     55                this.toolkit.placeAt("QuestionEditorToolkit");
     56
     57                this.preview = new rft.ui.QuestionEditorPreview();
     58                this.preview.placeAt("QuestionEditorPreview");
    5459            }
    5560        });
Note: See TracChangeset for help on using the changeset viewer.