source: Dev/branches/rest-dojo-ui/client/rft/ui/SelectorThijs.js @ 335

Last change on this file since 335 was 335, checked in by tjcschipper, 13 years ago
  • Removed rft/ui/*Button classes, since they are not actually needed. All buttons use standard dijit.form.Button again.

(baseClass: 'rft*Button', color: 'lowercase *, iconClass: 'rftIcon rftIcon*')

  • Changed CSS color classes to be shorter and more organized. No more highlightRed, now just red.
  • Moved extra .css files from client/dojotoolkit/dijit/themes/gamelab folder to client/rft/css folder, so they are actually included. Same for icons. Gamelab theme now contains only original Claro theme with renamed base class. Part of an effort to make the gamelab style work with standard inclusions of Dojo toolkit. (Override instead of change!)
  • Changed rft/ui/LineWithActionsWidgetThijs.js to use the new Button format.
  • Changed rft/ui/LineWithActionsWidgetThijs.js and rft/ui/SelectorThijs.js to use a new way to add Actions to the LineWithActions?. Instead of {"action": function(){}}, you now pass {"action": {callback: function(){}, properties: {props}}}.

The properties object is used as a mixin during creation of the Buttons, so you can directly set properties on the resulting buttons here. Most important one: action.properties.blockButton (boolean), that determines whether the Button should be a blockButton or inlineButton.

File size: 5.4 KB
Line 
1define([
2    'dojo/_base/declare',
3    'dojo/_base/lang',
4    'dojo/fx',
5    'dijit/_WidgetBase',
6    'dijit/_TemplatedMixin',
7    'dijit/_WidgetsInTemplateMixin',
8    'dijit/_Container',
9    './LineWithActionsWidgetThijs',
10    'dojo/text!./templates/SelectorThijs.html',
11    'dojo/dom-class'
12    ],function(
13        declare,
14        lang,
15        fx,
16        _WidgetBase,
17        _TemplatedMixin,
18        _WidgetsInTemplateMixin,
19        _Container,
20        LineWithActionsWidget,
21        templateString,
22        domClass
23        ){
24        return declare('rft.ui.SelectorThijs',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
25            templateString: templateString,
26            title: "The professional as a participant",
27            baseClass: 'rftSelector',
28            color: 'red',    // This is hardcoded for now, will serve as default value later! (Selector defaults to blue!) Only affects color of lineWithActions
29            postCreate: function() {
30                var infoFunction = function() {
31                    alert("Show info here");
32                }
33                new LineWithActionsWidget({
34                    title: this.title,
35                    color: this.color,
36                    actions: {
37                        "Accept" : {
38                            callback: function(arg){},
39                            properties: {
40                                blockButton: true,
41                                color: this.color
42                            }
43                        }
44                    }
45                },this.titleNode);
46                var selectorLine = new LineWithActionsWidget({
47                    title: 'None',
48                    color: this.color,
49                    actions: {
50                        "HalfArrowDown" : {
51                            callback: lang.hitch(this,function(){
52                                var node = this.optionsNode;
53                                var show = fx.wipeIn({
54                                    node: node
55                                });
56                                var hide = fx.wipeOut({
57                                    node: node
58                                });
59                                hide.play();
60                                var folded = true;
61                                return function(e) {
62                                    if ( folded ) {
63                                        // Bit of an ugly solution, really. Limit workload by limiting search to child elements of selecorLine.buttonsNode
64                                        var downArrowIcon = dojo.query(".rftBlockButton .rftIconHalfArrowDown", selectorLine.buttonsNode)[0];  // Query the down arrow rftIcon span
65                                        if (downArrowIcon){
66                                            domClass.replace(downArrowIcon, "rftIconHalfArrowUp", "rftIconHalfArrowDown");
67                                        }
68                                        show.play();
69                                        folded = false;
70                                    } else {
71                                        // Bit of an ugly solution, really. Limit workload by limiting search to child elements of selecorLine.buttonsNode
72                                        var upArrowIcon = dojo.query(".rftBlockButton .rftIconHalfArrowUp", selectorLine.buttonsNode)[0];  // Query the up arrow rftIcon span
73                                        if (upArrowIcon){
74                                            domClass.replace(upArrowIcon, "rftIconHalfArrowDown", "rftIconHalfArrowUp");
75                                        }
76                                        hide.play();
77                                        folded = true;
78                           
79                                    }
80                                    e.preventDefault();
81                                    e.stopPropagation();
82                                };
83                            })(),
84                            properties: {
85                                blockButton: true,
86                                color: this.color,
87                                showLabel: false
88                            }
89                        }
90                    }
91                },this.selectedItemNode);
92                new LineWithActionsWidget({
93                    title: 'Are there direct colleagues among the other participants?',
94                    actions: {
95                        "Inspect" : {
96                            callback: infoFunction,
97                            properties: {
98                                blockButton: false,
99                                showLabel: false
100                            }
101                        }
102                    }
103                }).placeAt(this.optionsNode);
104                /*
105                new LineWithActionsWidget({
106                    title: 'Do you personally know ithers present at the current session?',
107                    actions: {
108                        "Inspect" : infoFunction
109                    }
110                }).placeAt(this.optionsNode);
111                new LineWithActionsWidget({
112                    title: 'Have you worked with other participants before?',
113                    actions: {
114                        "Inspect" : infoFunction
115                    }
116                }).placeAt(this.optionsNode);
117                */
118            }
119        });
120    });
Note: See TracBrowser for help on using the repository browser.