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

Last change on this file since 333 was 333, checked in by tjcschipper, 13 years ago
  • Added rft.ui.InlineButton?, which is another preset like LargeButton? and BlockButton?. This time icon only and no label, made to fit into rftLineWithActions widgets. highlightColor: White/Black? allows for two different versions depending on icon background.
  • Make copies of rft/ui/LineWithActionsWidget and rft/ui/Selector, with -Thijs appended to the classnames. These are an attempt at integrating the newly created buttons in their intended contexts. The original classes and templates are untouched.
  • Changed LargeButton? and BlockButton? to be less hardcoded and just better.
File size: 4.2 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/Selector.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            postCreate: function() {
29                var infoFunction = function() {
30                    alert("Show info here");
31                }
32                new LineWithActionsWidget({
33                    title: this.title,
34                    actions: {
35                        "Accept" : function(){}
36                    }
37                },this.titleNode);
38                var selectorLine = new LineWithActionsWidget({
39                    title: 'None',
40                    actions: {
41                        "HalfArrowDown" : lang.hitch(this,function(){
42                            var node = this.optionsNode;
43                            var show = fx.wipeIn({
44                                node: node
45                            });
46                            var hide = fx.wipeOut({
47                                node: node
48                            });
49                            hide.play();
50                            var folded = true;
51                            return function(e) {
52                                if ( folded ) {
53                                    // Bit of an ugly solution, really. Limit workload by limiting search to child elements of selecorLine.buttonsNode
54                                    var downArrowIcon = dojo.query(".rftInlineButton .rftIconHalfArrowDown", selectorLine.buttonsNode)[0];  // Query the down arrow rftIcon span
55                                    if (downArrowIcon){
56                                        domClass.replace(downArrowIcon, "rftIconHalfArrowUp", "rftIconHalfArrowDown");
57                                    }
58                                    show.play();
59                                    folded = false;
60                                } else {
61                                    // Bit of an ugly solution, really. Limit workload by limiting search to child elements of selecorLine.buttonsNode
62                                    var upArrowIcon = dojo.query(".rftInlineButton .rftIconHalfArrowUp", selectorLine.buttonsNode)[0];  // Query the up arrow rftIcon span
63                                    if (upArrowIcon){
64                                        domClass.replace(upArrowIcon, "rftIconHalfArrowDown", "rftIconHalfArrowUp");
65                                    }
66                                    hide.play();
67                                    folded = true;
68                           
69                                }
70                                e.preventDefault();
71                                e.stopPropagation();
72                            };
73                        })()
74                    }
75                },this.selectedItemNode);
76                new LineWithActionsWidget({
77                    title: 'Are there direct colleagues among the other participants?',
78                    actions: {
79                        "Inspect" : infoFunction
80                    }
81                }).placeAt(this.optionsNode);
82                new LineWithActionsWidget({
83                    title: 'Do you personally know ithers present at the current session?',
84                    actions: {
85                        "Inspect" : infoFunction
86                    }
87                }).placeAt(this.optionsNode);
88                new LineWithActionsWidget({
89                    title: 'Have you worked with other participants before?',
90                    actions: {
91                        "Inspect" : infoFunction
92                    }
93                }).placeAt(this.optionsNode);
94            }
95        });
96    });
Note: See TracBrowser for help on using the repository browser.