|
28 | 28 | * <ul style='list-style-type: none'> |
29 | 29 | * <li>.name - (String) The name of the action, displayed on the button |
30 | 30 | * <li>.title - (String) Optional title, used for the tooltip |
| 31 | + * <li>.class - (String) Optional class to add to the action button |
| 32 | + * <li>.include - (String) Optional include src for the button. Used for custom button layouts (icons, dropdowns, etc) |
| 33 | + * <li>.includeClass - (String) Optional class to set on the include src div (only relevant when include is set). |
31 | 34 | * <li>.actionFn - (function(action)) Function to invoke when the action selected |
32 | 35 | * </ul> |
33 | 36 | * @param {function (action, item))} enableButtonForItemFn function(action, item) Used to enabled/disable an action button based on the current item |
|
120 | 123 | </file> |
121 | 124 |
|
122 | 125 | <file name="script.js"> |
123 | | - angular.module('patternfly.views').controller('ViewCtrl', ['$scope', |
124 | | - function ($scope) { |
| 126 | + angular.module('patternfly.views').controller('ViewCtrl', ['$scope', '$templateCache', |
| 127 | + function ($scope, $templateCache) { |
125 | 128 | $scope.eventText = ''; |
126 | 129 | var handleSelect = function (item, e) { |
127 | 130 | $scope.eventText = item.name + ' selected\r\n' + $scope.eventText; |
|
239 | 242 | $scope.eventText = item.name + " : " + action.name + "\r\n" + $scope.eventText; |
240 | 243 | }; |
241 | 244 |
|
| 245 | + var buttonInclude = '<span class="fa fa-plus"></span>{{actionButton.name}}'; |
| 246 | +
|
| 247 | + $templateCache.put('my-button-template', buttonInclude); |
242 | 248 | $scope.actionButtons = [ |
243 | 249 | { |
244 | 250 | name: 'Action 1', |
|
247 | 253 | }, |
248 | 254 | { |
249 | 255 | name: 'Action 2', |
| 256 | + class: 'btn-primary', |
250 | 257 | title: 'Do something else', |
251 | 258 | actionFn: performAction |
| 259 | + }, |
| 260 | + { |
| 261 | + name: 'Action 3', |
| 262 | + include: 'my-button-template', |
| 263 | + title: 'Do something special', |
| 264 | + actionFn: performAction |
252 | 265 | } |
253 | 266 | ]; |
254 | 267 | $scope.menuActions = [ |
|
0 commit comments