Ignore:
Timestamp:
07/23/12 13:07:24 (13 years ago)
Author:
hendrikvanantwerpen
Message:

Seperated question browser in TabbedQuestionBrowser? widget.
Made configuring Selector actions more flexible (both for top actions and item actions).
Fixed lowercase/uppercase problem in SurveyListView?.
Fixed whitespace and toolyip in LineWithActionsWidget?.
Added question browser to questions page. Removed the old dialog that was there and redirect to questionEditor page.

Location:
Dev/branches/rest-dojo-ui/client/rft/ui
Files:
2 edited

Legend:

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

    • Property svn:ignore set to
      .QuestionEditorPreviewItem.js.swp
  • Dev/branches/rest-dojo-ui/client/rft/ui/Selector.js

    r364 r370  
    3030        return declare('rft.ui.Selector',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
    3131            templateString: templateString,
    32             title: "",
    3332            baseClass: 'rftSelector',
    3433            modifiers: 'blue',
     34
     35            title: "",
     36            selectedActions: null,
     37            itemActions: null,
     38            // main selector action: Object
     39            //    title:
     40            //    description:
     41            //    icon:
     42
    3543            _folded: true,
    3644            _titleLine: null,
     
    4250                domClass.add(this.selectedColorNode, "pending");
    4351
     52                this._createTitleLine();
     53                this._createSelectorLine();
     54
     55                fx.wipeOut({
     56                    node: this.optionsNode
     57                }).play();
     58            },
     59            _createTitleLine: function() {
     60                var actions = {};
     61                var action = null;
     62                if ( this.selectedActions !== null ) {
     63                    for (var actionName in this.selectedActions) {
     64                        action = this.selectedActions[actionName];
     65                        actions[actionName] = {
     66                            callback: action.callback &&
     67                                    lang.hitch(this,this._onSelectedAction,
     68                                            action.callback),
     69                            properties: {
     70                                 blockButton: true,
     71                                 modifiers: this.modifiers,
     72                                 label: action.title || actionName,
     73                                 icon: action.icon,
     74                                 tooltip: action.description
     75                             }
     76
     77                        };
     78                    }
     79                }
     80
    4481                this._titleLine = new LineWithActionsWidget({
    4582                    title: this.title,
    4683                    modifiers: this.modifiers,
    47                     actions: {
    48                         "Include in survey" : {
    49                             callback: lang.hitch(this, this._onInclude),
    50                             properties: {
    51                                 blockButton: true,
    52                                 modifiers: this.modifiers,
    53                                 icon: "Accept",
    54                                 label: "Include"
    55                             }
    56                         }
    57                     }
     84                    actions: actions
    5885                },this.titleNode);
    5986                this._titleLine.startup();
    60 
     87            },
     88            _createSelectorLine: function() {
    6189                this._selectorLine = new LineWithActionsWidget({
    6290                    title: 'None',
     
    76104                this._selectorLine.startup();
    77105                this._selectorLine.on('click',lang.hitch(this, this.onToggle));
    78 
    79                 fx.wipeOut({
    80                     node: this.optionsNode
    81                 }).play();
    82106            },
    83107            _onSelect: function(item, widget) {
     
    97121                this.onSelect(item);
    98122            },
    99             _onInclude: function() {
    100                 if (this._selectedItem) {
    101                     this.onInclude(this._selectedItem);
     123            _onSelectedAction: function(callback) {
     124                if (this._selectedItem && callback) {
     125                    callback(this._selectedItem);
    102126                }
    103127            },
     
    126150                return false;
    127151            },
     152
    128153            addItem: function(item) {
    129                 var w = new LineWithActionsWidget({
    130                     title: item.title,
    131                     actions: {
    132                         "Info" : {
    133                             callback: function() {
    134                                 item.description && alert(item.description);
    135                             },
     154                var actions = {};
     155                var action;
     156                if (this.itemActions) {
     157                    for (var actionName in this.itemActions) {
     158                        action = this.itemActions[actionName];
     159                        actions[actionName] = {
     160                            callback: function(){action.callback && action.callback(item);},
    136161                            properties: {
    137162                                blockButton: false,
    138163                                showLabel: false,
    139                                 icon: "Inspect"
     164                                icon: action.icon,
     165                                tooltip: action.description
    140166                            }
    141167                        }
    142168                    }
     169                }
     170                var w = new LineWithActionsWidget({
     171                    title: item.title,
     172                    actions: actions
    143173                }).placeAt(this.optionsNode);
    144174                w.startup();
    145175                w.on("click", lang.hitch(this, this._onSelect, item, w));
    146176            },
    147             onSelect: function(item) {},
    148             onInclude: function(item) {}
     177
     178            onSelect: function(item) {}
    149179        });
    150180});
Note: See TracChangeset for help on using the changeset viewer.