- Timestamp:
- 04/29/13 19:35:10 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/client/qed/model/widgets/QuestionEditorToolkit.js
r428 r441 25 25 _topicSelect: null, 26 26 _topicStore: null, 27 _categories : null,28 27 29 28 _contentItems: [ … … 37 36 { type: "StringInput" }, 38 37 { type: "TextInput" }, 39 { type: " IntegerInput" },38 { type: "NumberInput" }, 40 39 { type: "ScaleInput" }, 41 40 { type: "MultipleChoiceInput" } … … 49 48 "StringInput": "Text line", 50 49 "TextInput": "Free text", 51 " IntegerInput": "Integer number",50 "NumberInput": "Number", 52 51 "ScaleInput": "Scale", 53 52 "MultipleChoiceInput": "Multiple choice" … … 61 60 "StringInput": "Text", 62 61 "TextInput": "Text", 63 " IntegerInput": "Integer",62 "NumberInput": "Number", 64 63 "ScaleInput": "Scale", 65 64 "MultipleChoiceInput": "MultipleChoice" … … 87 86 }, 88 87 _setValueAttr: function(question) { 89 this.propertiesForm.set('value', question);90 this._categories = question.categories || [];91 88 this._setupListView(); 92 89 this._setupCategories(); 93 90 this._setupTopic(question.topic); 91 this.propertiesForm.set('value', question); 92 this._list.set('value', question.categories); 94 93 }, 95 94 _getValueAttr: function() { 96 95 var value = this.propertiesForm.get('value'); 97 value.categories = this._ categories;96 value.categories = this._list.get('value'); 98 97 return value; 99 98 }, … … 125 124 }, 126 125 _setupListView: function() { 127 this._list = new CategoryListView( { 128 removeCallback: lang.hitch(this, this._removeCategory) 126 this._list = new CategoryListView({ 129 127 }).placeAt(this.listNode); 130 128 this._list.startup(); 131 for (var category in this._categories) {132 this._list.appendItem(this._categories[category]);133 }134 129 }, 135 130 _setupCategories: function() { … … 144 139 searchAttr: "id" 145 140 }, this.categoriesBoxNode); 146 this._supportingWidgets.push(this._categorySelect);147 148 141 }, 149 142 _setupTopic: function(topic) { … … 159 152 value: topic 160 153 }, this.topicBoxNode); 161 this._supportingWidgets.push(this._topicSelect);162 154 }, 163 155 _addCategory: function(item) { 164 this._categories.push(item);165 156 this._list.appendItem(item); 166 },167 _removeCategory: function(item) {168 this._categories.splice(this._categories.indexOf(item), 1);169 157 } 170 158
Note: See TracChangeset
for help on using the changeset viewer.