Ignore:
Timestamp:
08/26/12 22:39:02 (13 years ago)
Author:
hendrikvanantwerpen
Message:

Created widgets for several input types.
Work on multiplechoice widget, see if we can make OrderedList? work with
form items? Maybe make the item the widget iso a data item.

File:
1 edited

Legend:

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

    r391 r402  
    2525            _categories : null,
    2626
    27             _contentItems: [{
    28                     label: "Header",
    29                     content: {
    30                         type: "Header"
    31                     },
    32                     icon: "Header"
    33                 },{
    34                     label: "Text",
    35                     content: {
    36                         type: "Text"
    37                     },
    38                     icon: "TextBox"
    39                 },{
    40                     label: "Image",
    41                     content: {
    42                         type: "Image"
    43                     },
    44                     icon: "Image"
    45                 },{
    46                     label: "External media",
    47                     content: {
    48                         type: "ExternalMedia"
    49                     },
    50                     icon: "External"
    51                 },{
    52                     label: "Divider",
    53                     content: {
    54                         type: "Divider"
    55                     },
    56                     icon: "Divider"
    57                 }],
    58             _inputsItems: [{
    59                     label: "Free text",
    60                     content: {
    61                         type: "FreeTextInput"
    62                     },
    63                     icon: "Text"
    64                 },{
    65                     label: "Integer",
    66                     content: {
    67                         type: "IntegerInput"
    68                     },
    69                     icon: "Integer"
    70                 },{
    71                     label: "Scale",
    72                     content: {
    73                         type: "ScaleInput"
    74                     },
    75                     icon: "Scale"
    76                 },{
    77                     label: "Cards",
    78                     content: {
    79                         type: "CardsInput"
    80                     },
    81                     icon: "Cards"
    82                 },{
    83                     label: "Multiple Choice",
    84                     content: {
    85                         type: "MultipleChoiceInput"
    86                     },
    87                     icon: "MultipleChoice"
    88                 }],
     27            _contentItems: [
     28                { type: "Header" },
     29                { type: "Text" },
     30                { type: "Image" },
     31                { type: "ExternalMedia" },
     32                { type: "Divider" }
     33            ],
     34            _inputsItems: [
     35                { type: "StringInput" },
     36                { type: "TextInput" },
     37                { type: "IntegerInput" },
     38                { type: "ScaleInput" },
     39                { type: "MultipleChoiceInput" }
     40            ],
     41            _labelMap: {
     42                "Header": "Header",
     43                "Text": "Text",
     44                "Image": "Image",
     45                "ExternalMedia": "External media",
     46                "Divider": "Divider",
     47                "StringInput": "Text line",
     48                "TextInput": "Free text",
     49                "IntegerInput": "Integer number",
     50                "ScaleInput": "Scale",
     51                "MultipleChoiceInput": "Multiple choice"
     52            },
     53            _iconMap: {
     54                "Header": "Header",
     55                "Text": "TextBox",
     56                "Image": "Image",
     57                "ExternalMedia": "External",
     58                "Divider": "Divider",
     59                "StringInput": "Text",
     60                "TextInput": "Text",
     61                "IntegerInput": "Integer",
     62                "ScaleInput": "Scale",
     63                "MultipleChoiceInput": "MultipleChoice"
     64            },
    8965
    9066            postCreate: function(){
    9167                this.inherited(arguments);
     68                var creator = lang.hitch(this,"_creator");
    9269                this.contentSource = new Source(this.ToolkitContentSourceNode, {
    9370                    accept: [],
     
    9572                    selfAccept: false,
    9673                    singular: true,
    97                     creator: this._creator
     74                    creator: creator
    9875                });
    9976                this.inputsSource = new Source(this.ToolkitInputsSourceNode, {
     
    10279                    selfAccept: false,
    10380                    singular: true,
    104                     creator: this._creator
     81                    creator: creator
    10582                });
    10683                this.contentSource.insertNodes(false, this._contentItems);
     
    127104                if (hint == "avatar") {
    128105                    node = domConstruct.create('span',{
    129                         innerHTML: item.label
     106                        innerHTML: this._labelMap[item.type] || item.type
    130107                    });
    131108                } else {
    132109                    var w = new Button({
    133110                        baseClass: "rftLargeButton",
    134                         iconClass: "rftIcon rftIcon"+item.icon,
    135                         label: item.label,
     111                        iconClass: "rftIcon rftIcon"+(this._iconMap[item.type]||"Unknown"),
     112                        label: this._labelMap[item.type] || item.type,
    136113                        showLabel: true,
    137114                        'class': "newline"
     
    139116                    node = w.domNode;
    140117                }
    141                 return {node: node, data: item.content, type: ["questionContent"]};
     118                return {node: node, data: item, type: ["questionContent"]};
    142119            },
    143120            _setupListView: function() {
Note: See TracChangeset for help on using the changeset viewer.