Ignore:
Timestamp:
03/12/14 15:16:54 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Factored out general object mapping and iteration.
  • Split widgets for multiplechoice and singlechoice.
  • Restored readOnly/disabled setting for QuestionEditorPreviewItem? on innerWidget (since view innerWidget is not a form anymore, we cannot just set it on that, we iterate over all form children now).
File:
1 edited

Legend:

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

    r472 r510  
    11define([
    2     'dojo/_base/declare',
    3     'dojo/_base/lang',
    4     'dijit/_WidgetBase',
    5     'dijit/_TemplatedMixin',
    6     'dijit/_WidgetsInTemplateMixin',
    7     './LineWithActionsWidget',
    8     'dojo/text!./templates/ObjectBox.html'
    9 ], function(declare, lang, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, LineWithActionsWidget, template){
     2    "../lib/object",
     3    "./LineWithActionsWidget",
     4    "dijit/_TemplatedMixin",
     5    "dijit/_WidgetBase",
     6    "dijit/_WidgetsInTemplateMixin",
     7    "dojo/_base/declare",
     8    "dojo/_base/lang",
     9    "dojo/text!./templates/ObjectBox.html"
     10], function(objectFuns, LineWithActionsWidget, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, declare, lang, template) {
    1011    return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
    1112        baseClass: "rftObjectBox",
     
    3940        },
    4041        _createLine3Actions: function() {
    41             var line3Actions = {};
    42             for (var action in this.actions) {
    43                 if ( this.actions.hasOwnProperty(action) ) {
    44                     line3Actions[action] = {
    45                         callback: lang.hitch(this, function(callback){
    46                             if ( this.value ) { callback(this.value); }
    47                         }, this.actions[action]),
    48                         properties: {
    49                             blockButton: true,
    50                             label: action,
    51                             icon: action.charAt(0).toUpperCase()+action.slice(1)
    52                         }
    53                     };
    54                 }
    55             }
    56             return line3Actions;
     42            return objectFuns.map(this.actions,function(value,name){
     43                return {
     44                    callback: lang.hitch(this, function(callback){
     45                        if ( this.value ) { callback(this.value); }
     46                    }, value),
     47                    properties: {
     48                        blockButton: true,
     49                        label: name,
     50                        icon: name.charAt(0).toUpperCase()+name.slice(1)
     51                    }
     52                };
     53            },this);
    5754        },
    5855        _showInfoBox: function() {},
Note: See TracChangeset for help on using the changeset viewer.