Changeset 487 for Dev/trunk/src/client/qed-client/model/widgets
- Timestamp:
- 03/05/14 22:44:48 (11 years ago)
- Location:
- Dev/trunk/src/client/qed-client/model/widgets
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/model/widgets/QuestionEditorToolkit.js
r443 r487 1 1 define([ 2 "../../store", 2 "../classes/categories", 3 "../classes/topics", 3 4 "./CategoryListView", 4 5 "dijit/_Container", … … 15 16 "require", 16 17 "dojo/text!./templates/QuestionEditorToolkit.html" 17 ], function( store, CategoryListView, _Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, Button, ComboBox, declare, lang, Source, domConstruct, Memory, require, template) {18 ], function(categories, topics, CategoryListView, _Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, Button, ComboBox, declare, lang, Source, domConstruct, Memory, require, template) { 18 19 return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _Container], { 19 20 … … 107 108 this.inherited(arguments); 108 109 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] }); 110 categories.query().forEach(lang.hitch(this,function(cat){ 111 this._categoryStore.put({ id: cat }); 112 112 })); 113 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 }); 114 topics.query().forEach(lang.hitch(this,function(topic){ 115 this._categoryStore.put({ id: topic }); 117 116 })); 118 117 }, -
Dev/trunk/src/client/qed-client/model/widgets/SurveyRenderWidget.js
r461 r487 1 1 define([ 2 2 "../../widgets/_ComplexValueWidget", 3 "../classes/Survey",4 3 "./questions/Factory", 5 4 "dojo/_base/array", … … 7 6 "dojo/dom-construct", 8 7 "dojo/text!./templates/SurveyRenderWidget.html" 9 ], function(_ComplexValueWidget, Survey,QuestionWidgetFactory, array, declare, domConstruct, template) {8 ], function(_ComplexValueWidget, QuestionWidgetFactory, array, declare, domConstruct, template) { 10 9 return declare([_ComplexValueWidget],{ 11 10 templateString: template, … … 22 21 this.survey = survey; 23 22 var f = new QuestionWidgetFactory(); 24 array.forEach( Survey.Questions.get(this.survey),function(question,question_index){23 array.forEach(this.survey.questions,function(question,question_index){ 25 24 array.forEach(question.content || [], function(item,item_index){ 26 25 // The dot causes values to be grouped in an object! -
Dev/trunk/src/client/qed-client/model/widgets/SurveySummary.js
r457 r487 1 1 define([ 2 "../../store",3 "../classes/Survey",4 2 "dijit/_TemplatedMixin", 5 3 "dijit/_WidgetBase", … … 7 5 "dojo/dom-attr", 8 6 "dojo/text!./templates/SurveySummary.html" 9 ], function( store, Survey,_TemplatedMixin, _WidgetBase, declare, domAttr, template) {7 ], function(_TemplatedMixin, _WidgetBase, declare, domAttr, template) { 10 8 return declare([_WidgetBase,_TemplatedMixin],{ 11 9 templateString: template, … … 18 16 }, 19 17 _setValueAttr: function(survey) { 20 this.titleNode.innerHTML = Survey.DisplayTitle.get(survey); 21 var id = store.getIdentity(survey); 22 domAttr.set(this.titleNode, "href", id && ("#!/survey/"+id)); 18 this.titleNode.innerHTML = survey.title || ""; 19 domAttr.set(this.titleNode, "href", survey._id && ("#!/survey/"+survey._id)); 23 20 this.descriptionNode.innerHTML = survey.description; 24 this.questionsNode.innerHTML = (survey.questions || []).length;21 this.questionsNode.innerHTML = survey.questions.length; 25 22 } 26 23 }); -
Dev/trunk/src/client/qed-client/model/widgets/TabbedQuestionBrowser.js
r477 r487 1 1 define([ 2 'dojo/_base/declare', 3 'dojo/_base/lang', 4 'dojo/_base/window', 5 'dijit/layout/ContentPane', 6 'dijit/layout/TabContainer', 7 'dojox/widget/Standby', 8 '../../store', 9 '../../widgets/Selector' 10 ],function(declare,lang,win,ContentPane,TabContainer,Standby,store,Selector){ 2 "../../widgets/Selector", 3 "../classes/categories", 4 "../classes/questions", 5 "../classes/topics", 6 "dijit/layout/ContentPane", 7 "dijit/layout/TabContainer", 8 "dojo/_base/declare", 9 "dojo/_base/lang", 10 "dojo/_base/window", 11 "dojox/widget/Standby" 12 ], function(Selector, categories, questions, topics, ContentPane, TabContainer, declare, lang, win, Standby) { 11 13 return declare([TabContainer],{ 12 14 tabPosition: 'left-h', … … 38 40 this._fillCategoryTab(newTab.__category); 39 41 })); 40 store.query(this._query, {reduce:true,group:true,group_level:1})41 .for Pairs(lang.hitch(this,function(value,key){42 this._createCategoryTab( key[0],value);42 categories.query() 43 .forEach(lang.hitch(this,function(cat){ 44 this._createCategoryTab(cat.name,cat.count); 43 45 })); 44 46 }, … … 61 63 this._busy(); 62 64 categoryMap._filled = true; 63 store.query(this._query, {reduce:true,group:true,group_level:2,startkey:[category],endkey:[category,{}]})64 .for Pairs(lang.hitch(this,function(value,key){65 this._createTopicSelector( key[1],category,value);65 topics.query({category:category}) 66 .forEach(lang.hitch(this,function(topic){ 67 this._createTopicSelector(topic.name,category,topic.count); 66 68 })).then(lang.hitch(this,function(){ 67 69 this._done(); … … 101 103 topicMap._filled = true; 102 104 this._busy(); 103 store.query(this._query, { 104 reduce:false, 105 include_docs:true, 106 key:[category,topic] 107 }).forEach(lang.hitch(this,function(value){ 105 questions.query({category:category,topic:topic}) 106 .forEach(lang.hitch(this,function(value){ 108 107 topicMap._widget.addItem(value); 109 108 })).then(lang.hitch(this,function(){
Note: See TracChangeset
for help on using the changeset viewer.