Changeset 370 for Dev/branches/rest-dojo-ui/client/rft/ui
- Timestamp:
- 07/23/12 13:07:24 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui/client/rft/ui
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/ui
-
Property
svn:ignore
set to
.QuestionEditorPreviewItem.js.swp
-
Property
svn:ignore
set to
-
Dev/branches/rest-dojo-ui/client/rft/ui/LineWithActionsWidget.js
r356 r370 40 40 label: "Default", 41 41 iconClass: 'rftIcon rftIcon'+this.actions[action].properties.icon, 42 title: action,43 onClick: lang.hitch(this, dojo.partial(function(ac, e){44 lang.hitch(this, this.actions[ac].callback )(e);45 46 47 }, action))42 title: this.actions[action].properties.tooltip, 43 onClick: lang.hitch(this, function(action, e){ 44 action.callback && action.callback(e); 45 event.stop(e); 46 return false; 47 }, this.actions[action]) 48 48 }, this.actions[action].properties); 49 50 51 52 53 54 55 56 57 58 title: action,59 onClick: lang.hitch(this, dojo.partial(function(ac, e){60 lang.hitch(this, this.actions[ac].callback)(e);61 62 63 }, action))64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 });49 properties["class"] = properties.modifiers; 50 new Button(properties).placeAt(this.buttonsNode); 51 } else { 52 properties = lang.mixin({ 53 baseClass: 'rftInlineButton', 54 modifiers: 'black', 55 label: "Default", 56 showLabel: false, 57 iconClass: 'rftIcon rftIcon'+this.actions[action].properties.icon, 58 title: this.actions[action].properties.tooltip, 59 onClick: lang.hitch(this, function(action, e){ 60 action.callback && action.callback(e); 61 event.stop(e); 62 return false; 63 }, this.actions[action]) 64 }, this.actions[action].properties); 65 properties["class"] = properties.modifiers; 66 new Button(properties).placeAt(this.buttonsNode); 67 } 68 } 69 }, 70 refresh: function() { 71 this.titleNode.innerHTML = this.title; 72 }, 73 _onClick: function(e){ 74 var preventDefault = this.onClick(e) === false; 75 if (preventDefault) { 76 event.stop(e); 77 } 78 return !preventDefault; 79 }, 80 onClick: function(e) { 81 }, 82 _setTitleAttr: function(value){ 83 this.title = value; 84 this.refresh(); 85 } 86 }); 87 }); -
Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorPreviewItem.js
r366 r370 8 8 'dijit/_TemplatedMixin', 9 9 'dijit/_WidgetsInTemplateMixin', 10 'dijit/form/Text box',10 'dijit/form/TextBox', 11 11 'dojo/text!./templates/QuestionEditorPreviewItem.html', 12 ], function(declare, fx, _WidgetBase, domClass, lang, on, _TemplatedMixin, _WidgetsInTemplateMixin, Text box, templateFull) {12 ], function(declare, fx, _WidgetBase, domClass, lang, on, _TemplatedMixin, _WidgetsInTemplateMixin, TextBox, templateFull) { 13 13 return declare("rft.ui.QuestionEditorPreviewItem", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], { 14 14 … … 70 70 switch (this.item.widgetType) { 71 71 default: 72 this.innerWidget = new Text box();72 this.innerWidget = new TextBox(); 73 73 break; 74 74 } -
Dev/branches/rest-dojo-ui/client/rft/ui/Selector.js
r364 r370 30 30 return declare('rft.ui.Selector',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{ 31 31 templateString: templateString, 32 title: "",33 32 baseClass: 'rftSelector', 34 33 modifiers: 'blue', 34 35 title: "", 36 selectedActions: null, 37 itemActions: null, 38 // main selector action: Object 39 // title: 40 // description: 41 // icon: 42 35 43 _folded: true, 36 44 _titleLine: null, … … 42 50 domClass.add(this.selectedColorNode, "pending"); 43 51 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 44 81 this._titleLine = new LineWithActionsWidget({ 45 82 title: this.title, 46 83 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 58 85 },this.titleNode); 59 86 this._titleLine.startup(); 60 87 }, 88 _createSelectorLine: function() { 61 89 this._selectorLine = new LineWithActionsWidget({ 62 90 title: 'None', … … 76 104 this._selectorLine.startup(); 77 105 this._selectorLine.on('click',lang.hitch(this, this.onToggle)); 78 79 fx.wipeOut({80 node: this.optionsNode81 }).play();82 106 }, 83 107 _onSelect: function(item, widget) { … … 97 121 this.onSelect(item); 98 122 }, 99 _on Include: function() {100 if (this._selectedItem ) {101 this.onInclude(this._selectedItem);123 _onSelectedAction: function(callback) { 124 if (this._selectedItem && callback) { 125 callback(this._selectedItem); 102 126 } 103 127 }, … … 126 150 return false; 127 151 }, 152 128 153 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);}, 136 161 properties: { 137 162 blockButton: false, 138 163 showLabel: false, 139 icon: "Inspect" 164 icon: action.icon, 165 tooltip: action.description 140 166 } 141 167 } 142 168 } 169 } 170 var w = new LineWithActionsWidget({ 171 title: item.title, 172 actions: actions 143 173 }).placeAt(this.optionsNode); 144 174 w.startup(); 145 175 w.on("click", lang.hitch(this, this._onSelect, item, w)); 146 176 }, 147 onSelect: function(item) {}, 148 on Include: function(item) {}177 178 onSelect: function(item) {} 149 179 }); 150 180 }); -
Dev/branches/rest-dojo-ui/client/rft/ui/SurveyListView.js
r360 r370 110 110 node: node, 111 111 data: item, 112 type: "SurveyList viewItem"112 type: "SurveyListViewItem" 113 113 }; 114 114 return fullItem;
Note: See TracChangeset
for help on using the changeset viewer.