Changeset 510 for Dev/trunk/src/client/qed-client/widgets/Selector.js
- Timestamp:
- 03/12/14 15:16:54 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/widgets/Selector.js
r495 r510 1 1 define([ 2 "../lib/object", 2 3 "./LineWithActionsWidget", 3 4 "dijit/_Container", … … 16 17 "dojo/query", 17 18 "dojo/text!./templates/Selector.html" 18 ], function( LineWithActionsWidget, _Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, registry, baseArray, declare, event, lang, Source, domClass, domConstruct, fx, query, templateString) {19 ], function(objectFuns, LineWithActionsWidget, _Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, registry, baseArray, declare, event, lang, Source, domClass, domConstruct, fx, query, templateString) { 19 20 20 21 function get(selector, item) { … … 62 63 }, 63 64 _createTitleLine: function() { 64 var actions = {};65 var action = null;66 65 var userActions = 67 66 lang.isFunction(this.selectedActions) ? 68 67 this.selectedActions() : 69 68 this.selectedActions; 70 if ( userActions ) { 71 for (var actionName in userActions) { 72 if ( userActions.hasOwnProperty(actionName) ) { 73 action = userActions[actionName]; 74 actions[actionName] = { 75 callback: action.callback && 76 lang.hitch(this,this._onSelectedAction, 77 action.callback), 78 properties: { 79 blockButton: true, 80 label: action.title || actionName, 81 icon: action.icon, 82 tooltip: action.description 83 } 84 85 }; 86 } 87 } 88 } 89 69 70 var actions = objectFuns.map(userActions||{},function(action,actionName){ 71 return { 72 callback: action.callback && 73 lang.hitch(this,this._onSelectedAction, 74 action.callback), 75 properties: { 76 blockButton: true, 77 label: action.title || actionName, 78 icon: action.icon, 79 tooltip: action.description 80 } 81 82 }; 83 }, this); 90 84 this._titleLine = new LineWithActionsWidget({ 91 85 title: this.title, … … 205 199 }, 206 200 _createLineNode: function(item) { 207 var actions = {};208 201 var userActions = 209 202 lang.isFunction(this.itemActions) ? 210 203 this.itemActions(item) : 211 204 this.itemActions; 212 if (userActions) { 213 for (var actionName in userActions) { 214 if ( userActions.hasOwnProperty(actionName) ) { 215 var action = userActions[actionName]; 216 actions[actionName] = { 217 callback: action.callback && 218 lang.partial(action.callback,item,this), 219 properties: { 220 blockButton: false, 221 showLabel: false, 222 icon: action.icon + " black", 223 tooltip: action.description 224 } 225 }; 226 } 227 } 228 } 205 var actions = objectFuns.map(userActions||{},function(action,actionName){ 206 return { 207 callback: action.callback && 208 lang.partial(action.callback,item,this), 209 properties: { 210 blockButton: false, 211 showLabel: false, 212 icon: action.icon + " black", 213 tooltip: action.description 214 } 215 }; 216 }, this); 229 217 var w = new LineWithActionsWidget({ 230 218 title: get(this.itemTitle,item),
Note: See TracChangeset
for help on using the changeset viewer.