Ignore:
Timestamp:
08/06/12 18:41:53 (13 years ago)
Author:
hendrikvanantwerpen
Message:
  • Removed some id's from elements in templates, these give problems when a widget or page is loaded more then once (use data-*-attach-point to access the nodes).
  • Removed some unnecessary attach-* attributes from templates.
  • Fixed some event handling.
File:
1 edited

Legend:

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

    r389 r390  
    22    'dojo/_base/declare',
    33    'dojo/_base/Deferred',
     4    'dojo/_base/event',
    45    'dojo/_base/lang',
    5     'dojo/behavior',
    66    'rft/store',
    77    'rft/content',
     
    99    'rft/ui/QuestionEditorPreview',
    1010    'rft/ui/QuestionEditorToolkit'
    11     ],function(declare, Deferred, lang, behavior, store, content, _Page, QuestionEditorPreview, QuestionEditorToolkit){
     11    ],function(declare, Deferred, event, lang, store, content, _Page, QuestionEditorPreview, QuestionEditorToolkit){
    1212        return declare('rft.pages.question', [_Page], {
    1313            question: null,
     
    2626                }
    2727                this._setupEditor();
    28                 this._setupButtons();
    2928            },
    3029            onLeave: function() {
     
    3534                this._preview.appendItems(this.question.content || []);
    3635            },
    37             _onSave: function() {
     36            _onSave: function(evt) {
    3837                lang.mixin(this.question, this._toolkit.get('value'));
    3938                this.question.content = this._preview.getItems();
     
    4241                    content.goTo('questions');
    4342                });
    44                 return true;
     43                evt && event.stop( evt );
     44                return false;
    4545            },
    4646            _onDiscard: function() {
     
    4848                return true;
    4949            },
    50             _setupButtons: function() {
    51                 var behaviorMap = {
    52                     "#btnSave": {
    53                         onclick: lang.hitch(this, function(){
    54                             this._onSave();
    55                         })
    56                     },
    57                     "#btnDiscard": {
    58                         onclick: lang.hitch(this, function(){
    59                             this._onDiscard();
    60                         })
    61                     }
    62                 }
    63                 behavior.add(behaviorMap);
    64                 behavior.apply();
    65             },
    6650            _setupEditor: function() {
    6751                this._toolkit = new QuestionEditorToolkit({
    6852                },this.QuestionEditorToolkitNode);
     53                this._toolkit.on('submit',lang.hitch(this,"_onSave"));
    6954                this._toolkit.startup();
    7055
Note: See TracChangeset for help on using the changeset viewer.