From cf2ca6aa32de5fb8b7e33b6d59adcc407db73640 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 4 Oct 2013 08:16:06 -0700 Subject: [PATCH] Command buttons with additional properties --- src/UI/Shared/Toolbar/Button/ButtonView.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/UI/Shared/Toolbar/Button/ButtonView.js b/src/UI/Shared/Toolbar/Button/ButtonView.js index 1bcd36679..5a16c7d3c 100644 --- a/src/UI/Shared/Toolbar/Button/ButtonView.js +++ b/src/UI/Shared/Toolbar/Button/ButtonView.js @@ -3,8 +3,9 @@ define( [ 'app', 'marionette', + 'underscore', 'Commands/CommandController' - ], function (App, Marionette, CommandController) { + ], function (App, Marionette, _, CommandController) { return Marionette.ItemView.extend({ template : 'Shared/Toolbar/ButtonTemplate', @@ -30,8 +31,10 @@ define( var command = this.model.get('command'); if (command) { + var properties = _.extend({ name: command }, this.model.get('properties')); + CommandController.bindToCommand({ - command: {name: command}, + command: properties, element: this.$el }); } @@ -51,7 +54,7 @@ define( invokeCommand: function () { var command = this.model.get('command'); if (command) { - CommandController.Execute(command); + CommandController.Execute(command, this.model.get('properties')); } },