Changeset 375
- Timestamp:
- 07/25/12 10:56:00 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui/client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/config/docs.json
r362 r375 76 76 "map": "function(doc){ if ( doc.type === 'Question' ) { for (var i = 0; i < doc.categories.length; i++) { emit([doc.categories[i],doc.topic],1); } } }", 77 77 "reduce": "function(keys,values) { return sum(values); }" 78 }, 79 "topics": { 80 "map": "function(doc){ if ( doc.type === 'Question' ) { emit(doc.topic, 1); } }", 81 "reduce": "function(keys, values) { return null; }" 78 82 } 79 83 } -
Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorToolkit.js
r374 r375 20 20 _categorySelect: null, 21 21 _categoryStore: null, 22 _topicSelect: null, 23 _topicStore: null, 22 24 _categories : null, 23 25 … … 56 58 this._categories = question.categories; 57 59 this._setupListView(); 58 this._setupAutoComplete(); 60 this._setupCategories(); 61 this._setupTopic(question.topic); 59 62 }, 60 63 onCategoryAdd: function() { … … 89 92 this._list.startup(); 90 93 }, 91 _setup AutoComplete: function() {94 _setupCategories: function() { 92 95 this._categoryStore = new dojo.store.Memory({data: [] }); 93 96 store.query("_design/default/_view/questions", {reduce:true, group:false, group_level:1}) 94 97 .forPairs(lang.hitch(this, function(value, key) { 95 this._categoryStore.put({ category: key[0] });98 this._categoryStore.put({ id: key[0] }); 96 99 })); 97 100 this._categorySelect = new ComboBox( { … … 99 102 name: "categories", 100 103 store: this._categoryStore, 101 searchAttr: " category"104 searchAttr: "id" 102 105 }, "categoriesBox"); 103 106 107 }, 108 _setupTopic: function(topic) { 104 109 this._topicStore = new dojo.store.Memory( {data: [] }); 105 store.query("_design/default/_view/ questions", {reduce:true, group:true, group_level:2})110 store.query("_design/default/_view/topics", {reduce:true, group:true}) 106 111 .forPairs(lang.hitch(this, function(value, key) { 107 this._topicStore.put({ topic: key[1]});112 this._topicStore.put({ id: key }); 108 113 })); 109 114 this._topicSelect = new ComboBox( { … … 111 116 name: "topic", 112 117 store: this._topicStore, 113 searchAttr: "topic" 118 searchAttr: "id", 119 value: topic 114 120 }, "topicBox"); 115 121 },
Note: See TracChangeset
for help on using the changeset viewer.