Changeset 382


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.
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  
    5454        "_id": "q4",
    5555        "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",
    6156        "type": "Question"
    6257    },
     
    7469            },
    7570            "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); } } }",
    7772                "reduce": "function(keys,values) { return sum(values); }"
    7873            },
  • 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");
     1define([
     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) {
    38
    4         dojo.require("dojox.data.QueryReadStore");
    5 
    6         dojo.declare("rft.elastic.ElasticReadStore", dojox.data.QueryReadStore, {
     9        return declare("rft.elastic.ElasticReadStore", QueryReadStore, {
    710            fetch:function(request){
    811                var attr = Object.keys(request.query)[0];
     
    1215                var q = request.query[attr];
    1316
    14                 request.serverQuery = dojo.toJson({
     17                request.serverQuery = json.toJson({
    1518                                                                query:
    1619                                                                {
     
    2730                _fetchItems: function(request, fetchHandler, errorHandler){
    2831                        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            });
    3237                        request.abort = function(){
    3338                                xhrHandler.cancel();
    3439                        };
    35                         xhrHandler.addCallback(dojo.hitch(this, function(data){
     40                        xhrHandler.addCallback(lang.hitch(this, function(data){
    3641                                this._xhrFetchHandler(data, request, fetchHandler, errorHandler);
    3742                        }));
  • 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, {
     1define([
     2    'dojo/_base/declare',
     3    'dijit/form/FilteringSelect'
     4    ], function(declare, FilteringSelect) {
     5        return declare("rft.elastic.ElasticSearchFilteringSelect", FilteringSelect, {
    76             // custom min input character count to trigger search
    87         minKeyCount: 3,
  • Dev/branches/rest-dojo-ui/client/rft/pages/survey.html

    r379 r382  
    4646              data-rft-attach-point="propertiesForm">
    4747            <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/>
    4951        </form>
    5052           
  • Dev/branches/rest-dojo-ui/client/rft/run.js

    r381 r382  
    11require([
    22    // 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',
    510    'dojo/domReady!',
    611   
    7     // general widgets
    8     'dojo/data/ObjectStore',
    9     'dojo/store/JsonRest',
     12    // dijit & rft widgets used declaratively in templates and pages
    1013    'dijit/Dialog',
     14    'dijit/DropDownMenu',
    1115    'dijit/InlineEditBox',
    1216    'dijit/MenuBar',
    1317    'dijit/MenuBarItem',
    1418    'dijit/PopupMenuBarItem',
    15     'dijit/DropDownMenu',
    1619    'dijit/TitlePane',
     20    'dijit/layout/AccordionContainer',
    1721    'dijit/layout/BorderContainer',
    1822    'dijit/layout/ContentPane',
    1923    'dijit/layout/TabContainer',
    20     'dijit/layout/AccordionContainer',
     24    'dijit/form/Button',
     25    'dijit/form/ComboBox',
    2126    'dijit/form/DateTextBox',
    2227    'dijit/form/Form',
     28    'dijit/form/NumberSpinner',
     29    'dijit/form/Select',
     30    'dijit/form/SimpleTextarea',
     31    'dijit/form/Textarea',
    2332    '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',
    3033    'dojox/grid/DataGrid',
    3134    'dojox/widget/TitleGroup',
    32     'dojox/data/QueryReadStore',
    33     'rft/elastic/ElasticReadStore',
     35    'rft/ui/AccountListView',
     36    'rft/ui/LineWithActionsWidget',
    3437    'rft/ui/List',
    35     'rft/ui/OrderedList',
    36     'rft/ui/AccountListView',
    3738    'rft/ui/MainMenu',
    3839    'rft/ui/MenuBarLink',
    3940    'rft/ui/MenuLink',
    4041    'rft/ui/Notifications',
    41     'rft/ui/LineWithActionsWidget',
    4242    'rft/ui/ObjectBox',
     43    'rft/ui/OrderedList',
    4344    'rft/ui/QuestionWidget',
    4445    'rft/ui/Selector',
    4546    'rft/ui/TitleGroup',
    46     'rft/ui/InnerWidgetFactory',
     47
    4748    // pages -> load dynamically?
    4849    'rft/pages/index',
     
    5455    'rft/pages/survey'
    5556    ],
    56     function(win,parser,LoginDialog,dom,connect,auth,content) {
     57    function(connect,win,dom,parser,auth,content,LoginDialog) {
    5758        parser.parse();
    5859
  • 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.