Changeset 503 for Dev


Ignore:
Timestamp:
03/11/14 01:00:40 (11 years ago)
Author:
hendrikvanantwerpen
Message:

Don't delete elements from certain lists if they are disabled
or readOnly. Didn't include this in ListWidget?.removeItem, since
programmatically things should keep working even when disabled, I would
say. So this needs to be done in the place of the event.

Location:
Dev/trunk/src/client/qed-client
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/model/widgets/QuestionEditorPreviewItem.js

    r500 r503  
    3333                        lang.hitch(this, 'onToggleFold')));
    3434            this.own(this.removeButton.on('click',
    35                         lang.hitch(this, 'onDestroy')));
     35                        lang.hitch(this, '_handleDestroy')));
    3636            this.own(this.editButton.on('click',
    3737                        lang.hitch(this, 'onToggleEdit')));
    3838            this.showEdit();
    3939        },
    40         onDestroy: function() {},
     40        _handleDestroy: function(evt) {
     41            if ( !( this.disabled || this.readOnly ) ) {
     42                this.emit('destroy');
     43            }
     44            if ( evt ) { event.stop(evt); }
     45            return false;
     46        },
    4147        _getValueAttr: function(value) {
    4248            if ( this._editing ) {
     
    102108                this.innerWidget = newWidget;
    103109                this.addChild(this.innerWidget);
     110                this.innerWidget.set('readOnly',this.readOnly);
     111                this.innerWidget.set('disabled',this.disabled);
    104112                this.titleNode.innerHTML = this.value.type+" [editing]";
    105113                domClass.replace(this.editButton.iconNode, "rftIconAccept", "rftIconEdit");
  • Dev/trunk/src/client/qed-client/model/widgets/QuestionListView.js

    r490 r503  
    2323                actions: {
    2424                    "Remove" : {
    25                         callback: lang.hitch(this, 'removeItem', id, true),
     25                        callback: lang.hitch(this, '_handleRemove', id),
    2626                        properties: {
    2727                            blockButton: false,
     
    4444            w.startup();
    4545            return w;
     46        },
     47        _handleRemove: function(id) {
     48            if ( !( this.readOnly || this.disabled ) ) {
     49                this.removeItem(id,true);
     50            }
    4651        }
    4752    });
  • Dev/trunk/src/client/qed-client/pages/question.js

    r502 r503  
    3030            if ( this.object.publicationDate ) {
    3131                this.QuestionEditorToolkit.set('readOnly',true);
    32                 this.QuestionEditorToolkit.set('disabled',true);
    3332                this.contentList.set('readOnly',true);
    34                 this.contentList.set('disabled',true);
    3533            }
    3634        },
  • Dev/trunk/src/client/qed-client/pages/response.js

    r492 r503  
    4343                             this.response._surveyRun.respondentCanDeleteOwnResponse);
    4444            this.cancelButton.set('disabled',canDelete||false);
    45             this.surveyWidget.set('disabled', false);
     45            this.surveyWidget.set('readOnly', false);
    4646        },
    4747        _disableSubmit: function() {
     
    4949            this.continueButton.set('disabled',true);
    5050            this.cancelButton.set('disabled',true);
    51             this.surveyWidget.set('disabled', true);
     51            this.surveyWidget.set('readOnly', true);
    5252        },
    5353        _showInfo: function(html) {
  • Dev/trunk/src/client/qed-client/pages/survey.js

    r502 r503  
    7070            if ( this.object.publicationDate ) {
    7171                this.propertiesForm.set('readOnly',true);
    72                 this.propertiesForm.set('disabled',true);
    7372                this.questionList.set('readOnly',true);
    74                 this.questionList.set('disabled',true);
    7573            }
    7674        },
Note: See TracChangeset for help on using the changeset viewer.