Ignore:
Timestamp:
07/09/12 19:24:56 (13 years ago)
Author:
tjcschipper
Message:
  • Made change to _Page.js to destroy the page's child widgets on page leave. This was causing widgets with identical names (such as "btnSave") to make regsitry throw a duplicate widget error.
  • survey.js/html now sorts loaded questions into categories and topics and creates or adds them to the proper TabPane/Selectors?. TODO: Allow for spaces in category titles.
  • Added "addQuestion()" method to Selector.js, to internalize question visualization logic.
  • Included surveyAdvanced page in run.js
  • Changes index to use proper button format, still need to figure out a way to bind content.goTo to the onclick field (since there is no index.js script being run!)
  • Various css tweaks.
File:
1 edited

Legend:

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

    r350 r354  
    2626            title: "The professional as a participant",
    2727            baseClass: 'rftSelector',
    28             modifiers: 'blue',    // Extra CSS classes
     28            modifiers: 'blue',
    2929            postCreate: function() {
    3030                domClass.add(this.domNode, this.modifiers);
    3131                domClass.add(this.selectedColorNode, "pending");
    32                 var infoFunction = function() {
    33                     alert("Show info here");
    34                 }
     32               
    3533                new LineWithActionsWidget({
    3634                    title: this.title,
     
    4846                    }
    4947                },this.titleNode);
    50                 var selectorLine = new LineWithActionsWidget({
     48               
     49                this.selectorLine = new LineWithActionsWidget({
    5150                    title: 'None',
    5251                    modifiers: this.modifiers,
    5352                    actions: {
    5453                        "ToggleDropdown" : {
    55                             callback: lang.hitch(this,function(){
    56                                 var node = this.optionsNode;
    57                                 var show = fx.wipeIn({
    58                                     node: node
    59                                 });
    60                                 var hide = fx.wipeOut({
    61                                     node: node
    62                                 });
    63                                 hide.play();
    64                                 var folded = true;
    65                                 return function(e) {
    66                                     if ( folded ) {
    67                                         // Bit of an ugly solution, really. Limit workload by limiting search to child elements of selecorLine.buttonsNode
    68                                         var downArrowIcon = dojo.query(".rftBlockButton .rftIconHalfArrowDown", selectorLine.buttonsNode)[0];  // Query the down arrow rftIcon span
    69                                         if (downArrowIcon){
    70                                             domClass.replace(downArrowIcon, "rftIconHalfArrowUp", "rftIconHalfArrowDown");
    71                                         }
    72                                         show.play();
    73                                         folded = false;
    74                                     } else {
    75                                         // Bit of an ugly solution, really. Limit workload by limiting search to child elements of selecorLine.buttonsNode
    76                                         var upArrowIcon = dojo.query(".rftBlockButton .rftIconHalfArrowUp", selectorLine.buttonsNode)[0];  // Query the up arrow rftIcon span
    77                                         if (upArrowIcon){
    78                                             domClass.replace(upArrowIcon, "rftIconHalfArrowDown", "rftIconHalfArrowUp");
    79                                         }
    80                                         hide.play();
    81                                         folded = true;
    82                            
    83                                     }
    84                                     e.preventDefault();
    85                                     e.stopPropagation();
    86                                 };
    87                             })(),
     54                            callback: lang.hitch(this, this._toggleDropdown()),
    8855                            properties: {
    8956                                blockButton: true,
     
    9562                    }
    9663                },this.selectedItemNode);
     64            },
     65            _toggleDropdown: function(selectorLine) {
     66                var node = this.optionsNode;
     67                var show = fx.wipeIn({
     68                    node: node
     69                });
     70                var hide = fx.wipeOut({
     71                    node: node
     72                });
     73                hide.play();
     74                var folded = true;
     75                return function(e) {
     76                    if ( folded ) {
     77                        var downArrowIcon = dojo.query(".rftBlockButton .rftIconHalfArrowDown", this.selectorLine.buttonsNode)[0];
     78                        if (downArrowIcon){
     79                            domClass.replace(downArrowIcon, "rftIconHalfArrowUp", "rftIconHalfArrowDown");
     80                        }
     81                        show.play();
     82                        folded = false;
     83                    } else {
     84                        var upArrowIcon = dojo.query(".rftBlockButton .rftIconHalfArrowUp", this.selectorLine.buttonsNode)[0];
     85                        if (upArrowIcon){
     86                            domClass.replace(upArrowIcon, "rftIconHalfArrowDown", "rftIconHalfArrowUp");
     87                        }
     88                        hide.play();
     89                        folded = true;
     90
     91                    }
     92                    e.preventDefault();
     93                    e.stopPropagation();
     94                };
     95            },
     96            addQuestion: function(question) {
    9797                new LineWithActionsWidget({
    98                     title: 'Are there direct colleagues among the other participants?',
     98                    title: question.title,
     99                    question: question,
    99100                    actions: {
    100101                        "InfoHover" : {
    101                             callback: infoFunction,
     102                            callback: this.infoFunction,
    102103                            properties: {
    103104                                blockButton: false,
     
    108109                    }
    109110                }).placeAt(this.optionsNode);
     111            },
     112            infoFunction: function(){
     113                alert("Some info here!");text
    110114            }
    111115        });
    112     });
     116});
Note: See TracChangeset for help on using the changeset viewer.