Changeset 442 for Dev/trunk/client/qed/model/widgets
- Timestamp:
- 05/02/13 13:13:13 (12 years ago)
- Location:
- Dev/trunk/client/qed/model/widgets
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/client/qed/model/widgets/QuestionEditorPreviewItem.js
r441 r442 55 55 return !this._editing || this.innerWidget.validate(); 56 56 }, 57 focus: function() { 58 if ( this._editing ) { 59 this.innerWidget.focus(); 60 } 61 }, 57 62 showView: function() { 58 63 if ( this._editing ) { … … 74 79 this.showEdit(); 75 80 } 76 evt && event.stop(evt);81 if ( evt ) { event.stop(evt); } 77 82 return false; 78 83 }, … … 141 146 } 142 147 } 143 evt && event.stop(evt);148 if ( evt ) { event.stop(evt); } 144 149 return false; 145 150 } -
Dev/trunk/client/qed/model/widgets/QuestionEditorToolkit.js
r441 r442 20 20 21 21 templateString: template, 22 _ list: null,22 _categoryList: null, 23 23 _categorySelect: null, 24 24 _categoryStore: null, … … 65 65 }, 66 66 67 postCreate: function(){67 buildRendering: function() { 68 68 this.inherited(arguments); 69 70 this._categoryList = new CategoryListView({ 71 name: "categories" 72 }).placeAt(this.categoryListNode); 73 74 this._categoryStore = new Memory({data: [] }); 75 this._categorySelect = new ComboBox( { 76 store: this._categoryStore, 77 searchAttr: "id" 78 }, this.categoryBoxNode); 79 80 this._topicStore = new Memory( {data: [] }); 81 this._topicSelect = new ComboBox({ 82 name: "topic", 83 store: this._topicStore, 84 searchAttr: "id" 85 }, this.topicBoxNode); 86 69 87 var creator = lang.hitch(this,"_creator"); 70 88 this.contentSource = new Source(this.ToolkitContentSourceNode, { … … 85 103 this.inputsSource.insertNodes(false, this._inputsItems); 86 104 }, 87 _setValueAttr: function(question) { 88 this._setupListView(); 89 this._setupCategories(); 90 this._setupTopic(question.topic); 91 this.propertiesForm.set('value', question); 92 this._list.set('value', question.categories); 105 startup: function() { 106 if ( this._started ) { return; } 107 this.inherited(arguments); 108 109 store.query("_design/questions/_view/all", {reduce:true, group:false, group_level:1}) 110 .forPairs(lang.hitch(this, function(value, key) { 111 this._categoryStore.put({ id: key[0] }); 112 })); 113 114 store.query("_design/questions/_view/all_topics", {reduce:true, group:true}) 115 .forPairs(lang.hitch(this, function(value, key) { 116 this._topicStore.put({ id: key }); 117 })); 93 118 }, 94 _getValueAttr: function() { 95 var value = this.propertiesForm.get('value'); 96 value.categories = this._list.get('value'); 97 return value; 98 }, 99 onCategoryAdd: function() { 100 this._addCategory(this._categorySelect.get('displayedValue')); 119 _onCategoryAdd: function() { 120 this._categoryList.appendItem(this._categorySelect.get('displayedValue')); 101 121 this._categorySelect.reset(); 102 122 }, … … 122 142 type: ["questionContent"] 123 143 }; 124 },125 _setupListView: function() {126 this._list = new CategoryListView({127 }).placeAt(this.listNode);128 this._list.startup();129 },130 _setupCategories: function() {131 this._categoryStore = new Memory({data: [] });132 store.query("_design/questions/_view/all", {reduce:true, group:false, group_level:1})133 .forPairs(lang.hitch(this, function(value, key) {134 this._categoryStore.put({ id: key[0] });135 }));136 this._categorySelect = new ComboBox( {137 name: "categories",138 store: this._categoryStore,139 searchAttr: "id"140 }, this.categoriesBoxNode);141 },142 _setupTopic: function(topic) {143 this._topicStore = new Memory( {data: [] });144 store.query("_design/questions/_view/all_topics", {reduce:true, group:true})145 .forPairs(lang.hitch(this, function(value, key) {146 this._topicStore.put({ id: key });147 }));148 this._topicSelect = new ComboBox( {149 name: "topic",150 store: this._topicStore,151 searchAttr: "id",152 value: topic153 }, this.topicBoxNode);154 },155 _addCategory: function(item) {156 this._list.appendItem(item);157 144 } 158 145 -
Dev/trunk/client/qed/model/widgets/templates/QuestionEditorToolkit.html
r431 r442 1 1 <div> 2 <div data-dojo-type=" dojox/widget/TitleGroup">2 <div data-dojo-type="qed/widgets/TitleGroup"> 3 3 <div data-dojo-type="dijit/TitlePane" class="orange" data-dojo-props="open:true" title="Properties" data-dojo-props="iconClass:'rftIcon rftIconProperties'"> 4 <div data-dojo-type="dijit/form/Form" data-dojo-attach-point="propertiesForm"> 5 <fieldset class="align"> 6 <label>Title:</label><input data-dojo-type="dijit/form/TextBox" name="title"/> 7 <label>Code:</label><input data-dojo-type="dijit/form/TextBox" name= "code"/> 8 <label>Categories:</label> 9 <div data-dojo-attach-point="listNode" class="rftLineListView"></div> 10 <div data-dojo-attach-point="categoriesBoxNode"></div> 11 <button class="inheritBgColor" data-dojo-type="dijit/form/Button" data-dojo-attach-event="onClick:onCategoryAdd" data-dojo-props="baseClass:'rftBlockButton', iconClass: 'rftIcon rftIconPlus'">Add</button><br/> 12 <label>Topic:</label> 13 <div data-dojo-attach-point="topicBoxNode"></div> 14 <label>Description:</label><textarea data-dojo-type="dijit/form/Textarea" name="description"></textarea> 15 </fieldset> 16 </div> 4 <fieldset class="align"> 5 <label>Title:</label><input data-dojo-type="dijit/form/ValidationTextBox" required="required" name="title"/> 6 <label>Code:</label><input data-dojo-type="dijit/form/ValidationTextBox" required="required" name="code"/> 7 <label>Categories:</label> 8 <div data-dojo-attach-point="categoryListNode" class="rftLineListView"></div> 9 <div data-dojo-attach-point="categoryBoxNode"></div> 10 <button class="inheritBgColor" data-dojo-type="dijit/form/Button" data-dojo-attach-event="onClick:_onCategoryAdd" data-dojo-props="baseClass:'rftBlockButton', iconClass: 'rftIcon rftIconPlus'">Add</button><br/> 11 <label>Topic:</label> 12 <div data-dojo-attach-point="topicBoxNode"></div> 13 <label>Description:</label><textarea data-dojo-type="dijit/form/Textarea" name="description"></textarea> 14 </fieldset> 17 15 </div> 18 16 19 17 <div data-dojo-type="dijit/TitlePane" title="Content" data-dojo-props="iconClass:'rftIcon rftIconPlus', open:false"> 20 <div data-dojo-attach-point="ToolkitContentSourceNode"> 21 22 </div> 18 <div data-dojo-attach-point="ToolkitContentSourceNode"></div> 23 19 </div> 24 20 25 21 <div data-dojo-type="dijit/TitlePane" title="Inputs" data-dojo-props="iconClass:'rftIcon rftIconInput', open:false"> 26 <div data-dojo-attach-point="ToolkitInputsSourceNode"> 27 28 </div> 22 <div data-dojo-attach-point="ToolkitInputsSourceNode"></div> 29 23 </div> 30 24 </div>
Note: See TracChangeset
for help on using the changeset viewer.