Ignore:
Timestamp:
03/13/14 00:44:08 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Added open item options to singe and multiple choice.
  • Question view widgets are forms again, because we needed the control.
  • Multiple and singel choice share their widgets.
  • QuestionEditorPreview? now has items that were already there close, but opens newly dropped items.
  • PreviewItems? will save modified value even when we change to view before the widget loses its focus (which causes a change event).
File:
1 edited

Legend:

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

    r510 r511  
    1919   
    2020    return declare([_ComplexValueWidget],{
    21         baseClass: 'qedMultipleChoiceWidget',
     21        baseClass: 'qedMultipleChoiceConfigWidget',
    2222        templateString: template,
     23        allowMultiple: false,
    2324        buildRendering: function() {
    2425            this.inherited(arguments);
     
    3637                id: id,
    3738                value: item,
     39                _valueOrSubcode: this.allowMultiple ? 'subcode' : 'value',
     40                _valueOrSubcodeName: this.allowMultiple ? 'Subcode' : 'Value',
    3841                onDestroy: lang.hitch(this,function(evt){
    3942                    this.itemsWidget.removeItem(id,true);
     
    5457            if ( evt ) { event.stop(evt); }
    5558            return false;
     59        },
     60        _setDisabledAttr: function() {
     61            this.inherited(arguments);
     62            this._handleOpenItemChange();
     63        },
     64        _setReadOnlyAttr: function() {
     65            this.inherited(arguments);
     66            this._handleOpenItemChange();
     67        },
     68        _getValueAttr: function() {
     69            var value = this.inherited(arguments);
     70            if ( value.lastItemIsOpen[0] ) {
     71                value.lastItemIsOpen = {
     72                    subcode: value.openItemSubcode
     73                };
     74            } else {
     75                delete value.lastItemIsOpen;
     76            }
     77            delete value.openItemSubcode;
     78            return value;
     79        },
     80        _setValueAttr: function(value) {
     81            if ( value.lastItemIsOpen ) {
     82                value.openItemSubcode = value.lastItemIsOpen.subcode;
     83                value.lastItemIsOpen = ["on"];
     84            }
     85            this.inherited(arguments);
     86        },
     87        _handleOpenItemChange: function() {
     88            var enabled = !(this.readOnly || this.disabled) && 
     89                          this.openItemCheckBox.get('value')[0];
     90            this.openItemSubcodeTextBox.set('disabled',!enabled);
     91            this.openItemSubcodeTextBox.set('readOnly',!enabled);
    5692        }
    5793    });
Note: See TracChangeset for help on using the changeset viewer.