Ignore:
Timestamp:
07/27/12 14:52:36 (13 years ago)
Author:
hendrikvanantwerpen
Message:
  • Added description to survey properties form.
  • Added crude loading indicator to TabbedQuestionWidget?.
  • Organized run.js: dependencies in alpha order and only declaratively used widgets, removed other dependencies, they should be in the modules where they are used.
  • ElasticReadStore? and ElasticSearchFilteringSelect? was a mix of old dojo.declare/dojo.require and new AMD style. Changed it completely to AMD style (benefits builds later as well).
  • Changed questions view so questions without topics/categories show up as well in the view.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/client/rft/ui/TabbedQuestionBrowser.js

    r370 r382  
    22    'dojo/_base/declare',
    33    'dojo/_base/lang',
     4    'dojo/_base/window',
    45    'dijit/layout/ContentPane',
    56    'dijit/layout/TabContainer',
     7    'dojox/widget/Standby',
    68    'rft/store',
    79    'rft/ui/Selector',
    810    'dojo/domReady!'
    911    ],
    10     function(declare,lang,ContentPane,TabContainer,store,Selector){
     12    function(declare,lang,win,ContentPane,TabContainer,Standby,store,Selector){
    1113        return declare('rft.ui.TabbedQuestionBrowser',[TabContainer],{
    1214            tabPosition: 'left-h',
     
    1618
    1719            _dataMap: null,
     20            _busyCount: 0,
    1821            constructor: function(){
    1922                this._dataMap = {};
    2023            },
    2124            startup: function() {
     25                this._busyWidget = new Standby({
     26                    target: this.domNode,
     27                    duration: 200
     28                }).placeAt(win.body());
     29                this._busyWidget.startup();
    2230                this.watch("selectedChildWidget",lang.hitch(this,function(name,oldTab,newTab){
    2331                    this._fillCategoryTab(newTab.__category);
     
    4452                var categoryMap = this._dataMap[category];
    4553                if (!categoryMap._filled) {
     54                    this._busy();
    4655                    categoryMap._filled = true;
    4756                    store.query('_design/default/_view/questions', {reduce:true,group:true,group_level:2,startkey:[category],endkey:[category,{}]})
    4857                    .forPairs(lang.hitch(this,function(value,key){
    4958                        this._createTopicSelector(key[1],category,value);
     59                    })).then(lang.hitch(this,function(){
     60                        this._done();
    5061                    }));
    5162                }
     
    7384                var topicMap = categoryMap[topic];
    7485                if (!topicMap._filled) {
     86                    topicMap._filled = true;
     87                    this._busy();
    7588                    store.query('_design/default/_view/questions', {reduce:false,include_docs:true,key:[category,topic]})
    7689                    .forEach(lang.hitch(this,function(value){
    7790                        topicMap._widget.addItem(value);
     91                    })).then(lang.hitch(this,function(){
     92                        this._done();
    7893                    }));
     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.');
    79110                }
    80111            },
Note: See TracChangeset for help on using the changeset viewer.