Changeset 350 for Dev/branches/rest-dojo-ui/client/rft/ui
- Timestamp:
- 07/03/12 16:57:07 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui/client/rft/ui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/ui/LineWithActionsWidget.js
r316 r350 1 define(['dojo/_base/declare','dojo/_base/lang','dojo/on','dojo/dom', 'dijit/form/Button',1 define(['dojo/_base/declare','dojo/_base/lang','dojo/on','dojo/dom', 'dojo/dom-class', 'dijit/form/Button', 2 2 'dijit/_WidgetBase','dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin', 3 'dojo/text!./templates/LineWithActionsWidget.html'], 4 function(declare,lang,on,dom,Button,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString){ 3 'dojo/text!./templates/LineWithActionsWidget.html' 4 ], 5 function(declare,lang,on,dom,domClass,Button,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString){ 5 6 return declare('rft.ui.LineWithActionsWidget',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{ 6 7 templateString: templateString, 7 8 baseClass: 'rftLineWithButtons', 8 9 title: '', 10 modifiers: "blue", 9 11 userObject: null, 10 12 actions: {}, … … 16 18 this.inherited(arguments); 17 19 this._setupActions(); 20 domClass.add(this.domNode, this.modifiers); 18 21 this.refresh(); 19 22 }, 20 23 _setupActions: function() { 21 24 for (var action in this.actions) { 22 new Button({ 23 label: action, 24 //iconClass: 'dijitIconSearch', 25 //showLabel: false, 26 onClick: lang.hitch(this,function(){ 27 this.actions[action](this.userObject); 28 }) 29 }).placeAt(this.buttonsNode); 25 var properties; 26 if (this.actions[action].properties.blockButton == true) { // BlockButton 27 properties = lang.mixin({ 28 baseClass: 'rftBlockButton', 29 modifiers: this.modifiers, 30 label: "Default", 31 iconClass: 'rftIcon rftIcon'+this.actions[action].properties.icon, 32 title: action, 33 onClick: lang.hitch(this, this.actions[action].callback) 34 }, this.actions[action].properties); 35 properties["class"] = properties.modifiers; 36 new Button(properties).placeAt(this.buttonsNode); 37 } else { //InlineButton 38 properties = lang.mixin({ 39 baseClass: 'rftInlineButton', 40 modifiers: 'black', 41 label: "Default", 42 showLabel: false, 43 iconClass: 'rftIcon rftIcon'+this.actions[action].properties.icon, 44 title: action, 45 onClick: lang.hitch(this, this.actions[action].callback) 46 }, this.actions[action].properties); 47 properties["class"] = properties.modifiers; 48 new Button(properties).placeAt(this.buttonsNode); 49 } 30 50 } 31 51 }, … … 40 60 return !preventDefault; 41 61 }, 42 onClick: function(e) {} 62 onClick: function(e) {}, 63 _setTitleAttr: function(value){ 64 this.title = value; 65 this.refresh(); 66 } 43 67 }); 44 68 }); -
Dev/branches/rest-dojo-ui/client/rft/ui/ObjectBox.js
r349 r350 5 5 'dijit/_TemplatedMixin', 6 6 'dijit/_WidgetsInTemplateMixin', 7 'rft/ui/LineWithActionsWidget Thijs',7 'rft/ui/LineWithActionsWidget', 8 8 'dojo/text!./templates/ObjectBox.html', 9 ], function(declare, lang, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, LineWithActionsWidget Thijs, template){9 ], function(declare, lang, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, LineWithActionsWidget, template){ 10 10 return declare('rft.ui.ObjectBox', [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], { 11 11 baseClass: "rftObjectBox", … … 21 21 }, 22 22 postCreate: function() { 23 this.line1 = new LineWithActionsWidget Thijs({23 this.line1 = new LineWithActionsWidget({ 24 24 title: this.title || "Untitled", 25 25 modifiers: 'green', … … 35 35 } 36 36 }).placeAt(this.line1Node); 37 this.line2 = new LineWithActionsWidget Thijs({37 this.line2 = new LineWithActionsWidget({ 38 38 title: this.subTitle || "", 39 39 modifiers: 'green', … … 41 41 }).placeAt(this.line1Node); 42 42 var line3Actions = this._createLine3Actions(); 43 this.line3 = new LineWithActionsWidget Thijs({43 this.line3 = new LineWithActionsWidget({ 44 44 title: this.lowerTitle || "", 45 45 modifiers: 'green', … … 101 101 }, 102 102 _editObject: function(customFunction) { 103 104 105 106 107 108 109 110 103 // TODO: Pass an edit call to the page script, along with reference to the object contained in this ObjectBox 104 alert("Default edit code"); 105 customFunction(); 106 }, 107 _deleteObject: function(customFunction) { 108 // TODO: Pass a delete call to the page script, along with reference to the object contained in this ObjectBox 109 customFunction(); 110 }, 111 111 112 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 113 _setTitleAttr: function(value) { 114 this.title = value; 115 if (this.line1 && this.line1.set) { 116 this.line1.set('title', this.title); 117 } 118 }, 119 _setSubTitleAttr: function(value) { 120 this.subTitle = value; 121 if (this.line2 && this.line2.set) { 122 this.line2.set('title', this.subTitle); 123 } 124 }, 125 _setLowerTitleAttr: function(value) { 126 this.lowerTitle = value; 127 if (this.line3 && this.line3.set) { 128 this.line3.set('title', this.lowerTitle); 129 } 130 }, 131 _setObjectTypeAttr: function(value) { 132 this.objectType = value; 133 this.iconNode.className = "rftIcon typeIcon rftIcon"+this.objectType; 134 }, 135 135 136 137 138 139 140 141 142 143 144 145 136 /* This is an experiment to embed the creation function in the ObjectBox class itself. This method cannot be static, but can be called externally as such: 137 * rft.ui.ObjectBox().CreateNew(args, ref, loc); 138 * TODO: Check with Hendrik if I should do this or not! 139 * */ 140 CreateNew: function(arguments, reference, location) { 141 var newBox = new rft.ui.ObjectBox(arguments); 142 newBox.startup(); 143 newBox.placeAt(reference, location); 144 } 145 }); 146 146 }); -
Dev/branches/rest-dojo-ui/client/rft/ui/Selector.js
r316 r350 8 8 'dijit/_Container', 9 9 './LineWithActionsWidget', 10 'dojo/text!./templates/Selector.html' 10 'dojo/text!./templates/Selector.html', 11 'dojo/dom-class' 11 12 ],function( 12 13 declare, … … 18 19 _Container, 19 20 LineWithActionsWidget, 20 templateString 21 templateString, 22 domClass 21 23 ){ 22 24 return declare('rft.ui.Selector',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{ … … 24 26 title: "The professional as a participant", 25 27 baseClass: 'rftSelector', 28 modifiers: 'blue', // Extra CSS classes 26 29 postCreate: function() { 30 domClass.add(this.domNode, this.modifiers); 31 domClass.add(this.selectedColorNode, "pending"); 27 32 var infoFunction = function() { 28 33 alert("Show info here"); … … 30 35 new LineWithActionsWidget({ 31 36 title: this.title, 37 modifiers: this.modifiers, 32 38 actions: { 33 "Select" : function(){} 39 "AddToSurvey" : { 40 callback: function(arg){}, 41 properties: { 42 blockButton: true, 43 modifiers: this.modifiers, 44 icon: "Accept", 45 label: "Include" 46 } 47 } 34 48 } 35 49 },this.titleNode); 36 new LineWithActionsWidget({50 var selectorLine = new LineWithActionsWidget({ 37 51 title: 'None', 52 modifiers: this.modifiers, 38 53 actions: { 39 "V" : lang.hitch(this,function(){ 40 var node = this.optionsNode; 41 var show = fx.wipeIn({ 42 node: node 43 }); 44 var hide = fx.wipeOut({ 45 node: node 46 }); 47 hide.play(); 48 var folded = true; 49 return function(e) { 50 if ( folded ) { 51 show.play(); 52 folded = false; 53 } else { 54 hide.play(); 55 folded = true; 54 "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; 56 82 57 } 58 e.preventDefault(); 59 e.stopPropagation(); 60 }; 61 })() 83 } 84 e.preventDefault(); 85 e.stopPropagation(); 86 }; 87 })(), 88 properties: { 89 blockButton: true, 90 modifiers: this.modifiers, 91 showLabel: false, 92 icon: "HalfArrowDown" 93 } 94 } 62 95 } 63 96 },this.selectedItemNode); … … 65 98 title: 'Are there direct colleagues among the other participants?', 66 99 actions: { 67 "i" : infoFunction 68 } 69 }).placeAt(this.optionsNode); 70 new LineWithActionsWidget({ 71 title: 'Do you personally know ithers present at the current session?', 72 actions: { 73 "i" : infoFunction 74 } 75 }).placeAt(this.optionsNode); 76 new LineWithActionsWidget({ 77 title: 'Have you worked with other participants before?', 78 actions: { 79 "i" : infoFunction 100 "InfoHover" : { 101 callback: infoFunction, 102 properties: { 103 blockButton: false, 104 showLabel: false, 105 icon: "Inspect" 106 } 107 } 80 108 } 81 109 }).placeAt(this.optionsNode); -
Dev/branches/rest-dojo-ui/client/rft/ui/templates/Selector.html
r316 r350 1 1 <div> 2 <div class="${baseClass}Title" data-dojo-attach-point="titleNode"></div> 2 <div class="${baseClass}Category"> 3 <div class="${baseClass}Title" data-dojo-attach-point="titleNode"></div> 4 </div> 3 5 <div class="${baseClass}Selected"> 4 6 <div class="${baseClass}Color" data-dojo-attach-point="selectedColorNode"></div> -
Dev/branches/rest-dojo-ui/client/rft/ui/templates/SessionBar.html
r344 r350 1 1 <div class="${baseClass}"> 2 2 <span class="rftIcon rftIconSession" data-dojo-attach-point="iconNode"></span> 3 <div data-dojo-type="rft.ui.LineWithActionsWidget Thijs" data-dojo-attach-point="upperNode" data-dojo-props="modifiers: 'green', actions: {'inspect':{callback: inspect, properties: {blockButton: true, modifiers: 'white'}}}"></div>4 <div data-dojo-type="rft.ui.LineWithActionsWidget Thijs" data-dojo-attach-point="lowerNode"></div>3 <div data-dojo-type="rft.ui.LineWithActionsWidget" data-dojo-attach-point="upperNode" data-dojo-props="modifiers: 'green', actions: {'inspect':{callback: inspect, properties: {blockButton: true, modifiers: 'white'}}}"></div> 4 <div data-dojo-type="rft.ui.LineWithActionsWidget" data-dojo-attach-point="lowerNode"></div> 5 5 </div>
Note: See TracChangeset
for help on using the changeset viewer.