Changeset 382
- Timestamp:
- 07/27/12 14:52:36 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui/client
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/config/docs.json
r375 r382 54 54 "_id": "q4", 55 55 "title": "Rate your experience at your current employer from 1 to 10.", 56 "categories": [57 "Respondent personals",58 "Professional background"59 ],60 "topic": "Work enjoyment",61 56 "type": "Question" 62 57 }, … … 74 69 }, 75 70 "questions": { 76 "map": "function(doc){ if ( doc.type === 'Question' ) { for (var i = 0; i < doc.categories.length; i++) { emit([doc.categories[i],doc.topic],1); } } }",71 "map": "function(doc){ if ( doc.type === 'Question' ) { if ( doc.categories && doc.categories.length > 0 ) { for (var i = 0; i < doc.categories.length; i++) { emit([doc.categories[i],doc.topic || '[No topic]'],1); } } else { emit(['[No category]','[No topic]'],1); } } }", 77 72 "reduce": "function(keys,values) { return sum(values); }" 78 73 }, -
Dev/branches/rest-dojo-ui/client/rft/elastic/ElasticReadStore.js
r368 r382 1 define(["dojo", "dojox", "dojo/json"], function(dojo, dojox, JSON) { 2 dojo.provide("rft.elastic.ElasticReadStore"); 1 define([ 2 'dojo/_base/declare', 3 "dojo/_base/json", 4 'dojo/_base/lang', 5 'dojo/_base/xhr', 6 'dojox/data/QueryReadStore' 7 ],function(declare, json, lang, xhr, QueryReadStore) { 3 8 4 dojo.require("dojox.data.QueryReadStore"); 5 6 dojo.declare("rft.elastic.ElasticReadStore", dojox.data.QueryReadStore, { 9 return declare("rft.elastic.ElasticReadStore", QueryReadStore, { 7 10 fetch:function(request){ 8 11 var attr = Object.keys(request.query)[0]; … … 12 15 var q = request.query[attr]; 13 16 14 request.serverQuery = dojo.toJson({17 request.serverQuery = json.toJson({ 15 18 query: 16 19 { … … 27 30 _fetchItems: function(request, fetchHandler, errorHandler){ 28 31 var serverQuery = request.serverQuery; 29 var xhrHandler = dojo.xhrPost( { url:this.url, 30 handleAs: "json", 31 postData: serverQuery }); 32 var xhrHandler = xhr.post({ 33 url: this.url, 34 handleAs: "json", 35 postData: serverQuery 36 }); 32 37 request.abort = function(){ 33 38 xhrHandler.cancel(); 34 39 }; 35 xhrHandler.addCallback( dojo.hitch(this, function(data){40 xhrHandler.addCallback(lang.hitch(this, function(data){ 36 41 this._xhrFetchHandler(data, request, fetchHandler, errorHandler); 37 42 })); -
Dev/branches/rest-dojo-ui/client/rft/elastic/ElasticSearchFilteringSelect.js
r367 r382 1 define(["dojo"], function(dojo) { 2 dojo.provide("rft.elastic.ElasticSearchFilteringSelect"); 3 4 dojo.require("dijit.form.FilteringSelect"); 5 6 dojo.declare("rft.elastic.ElasticSearchFilteringSelect", dijit.form.FilteringSelect, { 1 define([ 2 'dojo/_base/declare', 3 'dijit/form/FilteringSelect' 4 ], function(declare, FilteringSelect) { 5 return declare("rft.elastic.ElasticSearchFilteringSelect", FilteringSelect, { 7 6 // custom min input character count to trigger search 8 7 minKeyCount: 3, -
Dev/branches/rest-dojo-ui/client/rft/pages/survey.html
r379 r382 46 46 data-rft-attach-point="propertiesForm"> 47 47 <label for="title">Title</label> 48 <input data-dojo-type="dijit.form.TextBox" name="title"/> 48 <input data-dojo-type="dijit.form.TextBox" name="title"/><br/> 49 <label for="description">Description</label> 50 <input data-dojo-type="dijit.form.Textarea" name="description"/><br/> 49 51 </form> 50 52 -
Dev/branches/rest-dojo-ui/client/rft/run.js
r381 r382 1 1 require([ 2 2 // functions required for run 3 'dojo/_base/window','dojo/parser', 'rft/ui/LoginDialog', 4 'dojo/dom', 'dojo/_base/connect', 'rft/auth', 'rft/content', 3 'dojo/_base/connect', 4 'dojo/_base/window', 5 'dojo/dom', 6 'dojo/parser', 7 'rft/auth', 8 'rft/content', 9 'rft/ui/LoginDialog', 5 10 'dojo/domReady!', 6 11 7 // general widgets 8 'dojo/data/ObjectStore', 9 'dojo/store/JsonRest', 12 // dijit & rft widgets used declaratively in templates and pages 10 13 'dijit/Dialog', 14 'dijit/DropDownMenu', 11 15 'dijit/InlineEditBox', 12 16 'dijit/MenuBar', 13 17 'dijit/MenuBarItem', 14 18 'dijit/PopupMenuBarItem', 15 'dijit/DropDownMenu',16 19 'dijit/TitlePane', 20 'dijit/layout/AccordionContainer', 17 21 'dijit/layout/BorderContainer', 18 22 'dijit/layout/ContentPane', 19 23 'dijit/layout/TabContainer', 20 'dijit/layout/AccordionContainer', 24 'dijit/form/Button', 25 'dijit/form/ComboBox', 21 26 'dijit/form/DateTextBox', 22 27 'dijit/form/Form', 28 'dijit/form/NumberSpinner', 29 'dijit/form/Select', 30 'dijit/form/SimpleTextarea', 31 'dijit/form/Textarea', 23 32 'dijit/form/TextBox', 24 'dijit/form/Button',25 'dijit/form/Textarea',26 'dijit/form/SimpleTextarea',27 'dijit/form/ComboBox',28 'dijit/form/Select',29 'dijit/form/NumberSpinner',30 33 'dojox/grid/DataGrid', 31 34 'dojox/widget/TitleGroup', 32 ' dojox/data/QueryReadStore',33 'rft/ elastic/ElasticReadStore',35 'rft/ui/AccountListView', 36 'rft/ui/LineWithActionsWidget', 34 37 'rft/ui/List', 35 'rft/ui/OrderedList',36 'rft/ui/AccountListView',37 38 'rft/ui/MainMenu', 38 39 'rft/ui/MenuBarLink', 39 40 'rft/ui/MenuLink', 40 41 'rft/ui/Notifications', 41 'rft/ui/LineWithActionsWidget',42 42 'rft/ui/ObjectBox', 43 'rft/ui/OrderedList', 43 44 'rft/ui/QuestionWidget', 44 45 'rft/ui/Selector', 45 46 'rft/ui/TitleGroup', 46 'rft/ui/InnerWidgetFactory', 47 47 48 // pages -> load dynamically? 48 49 'rft/pages/index', … … 54 55 'rft/pages/survey' 55 56 ], 56 function( win,parser,LoginDialog,dom,connect,auth,content) {57 function(connect,win,dom,parser,auth,content,LoginDialog) { 57 58 parser.parse(); 58 59 -
Dev/branches/rest-dojo-ui/client/rft/ui/TabbedQuestionBrowser.js
r370 r382 2 2 'dojo/_base/declare', 3 3 'dojo/_base/lang', 4 'dojo/_base/window', 4 5 'dijit/layout/ContentPane', 5 6 'dijit/layout/TabContainer', 7 'dojox/widget/Standby', 6 8 'rft/store', 7 9 'rft/ui/Selector', 8 10 'dojo/domReady!' 9 11 ], 10 function(declare,lang, ContentPane,TabContainer,store,Selector){12 function(declare,lang,win,ContentPane,TabContainer,Standby,store,Selector){ 11 13 return declare('rft.ui.TabbedQuestionBrowser',[TabContainer],{ 12 14 tabPosition: 'left-h', … … 16 18 17 19 _dataMap: null, 20 _busyCount: 0, 18 21 constructor: function(){ 19 22 this._dataMap = {}; 20 23 }, 21 24 startup: function() { 25 this._busyWidget = new Standby({ 26 target: this.domNode, 27 duration: 200 28 }).placeAt(win.body()); 29 this._busyWidget.startup(); 22 30 this.watch("selectedChildWidget",lang.hitch(this,function(name,oldTab,newTab){ 23 31 this._fillCategoryTab(newTab.__category); … … 44 52 var categoryMap = this._dataMap[category]; 45 53 if (!categoryMap._filled) { 54 this._busy(); 46 55 categoryMap._filled = true; 47 56 store.query('_design/default/_view/questions', {reduce:true,group:true,group_level:2,startkey:[category],endkey:[category,{}]}) 48 57 .forPairs(lang.hitch(this,function(value,key){ 49 58 this._createTopicSelector(key[1],category,value); 59 })).then(lang.hitch(this,function(){ 60 this._done(); 50 61 })); 51 62 } … … 73 84 var topicMap = categoryMap[topic]; 74 85 if (!topicMap._filled) { 86 topicMap._filled = true; 87 this._busy(); 75 88 store.query('_design/default/_view/questions', {reduce:false,include_docs:true,key:[category,topic]}) 76 89 .forEach(lang.hitch(this,function(value){ 77 90 topicMap._widget.addItem(value); 91 })).then(lang.hitch(this,function(){ 92 this._done(); 78 93 })); 94 } 95 }, 96 _busy: function() { 97 if ( this._busyCount === 0 ) { 98 this._busyWidget.show(); 99 } 100 this._busyCount++; 101 }, 102 _done: function() { 103 if ( this._busyCount > 0 ) { 104 this._busyCount--; 105 if ( this._busyCount === 0 ) { 106 this._busyWidget.hide(); 107 } 108 } else { 109 console.warn('Busycount <= 0 when _done is called.'); 79 110 } 80 111 },
Note: See TracChangeset
for help on using the changeset viewer.