From a481384688b13e6124b1fed41600fd900e25a2ff Mon Sep 17 00:00:00 2001 From: Giulio Cesare Solaroli Date: Thu, 12 Feb 2015 18:04:12 +0100 Subject: [PATCH] Fixed the order of the commands in the compact view --- .../PM/UI/Components/Cards/CommandToolbar.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/delta/js/Clipperz/PM/UI/Components/Cards/CommandToolbar.js b/frontend/delta/js/Clipperz/PM/UI/Components/Cards/CommandToolbar.js index 8a239a5..0687cf7 100644 --- a/frontend/delta/js/Clipperz/PM/UI/Components/Cards/CommandToolbar.js +++ b/frontend/delta/js/Clipperz/PM/UI/Components/Cards/CommandToolbar.js @@ -83,12 +83,17 @@ Clipperz.PM.UI.Components.Cards.CommandToolbar = React.createClass({ //---------------------------------------------------------------------------- - renderCommands: function () { - var commandHandler = this.selectCommandItem; + renderCommands: function (shouldReverseCommandOrder) { + var commandHandler = this.selectCommandItem; + var commandValues = MochiKit.Base.values(this.commands()); + + if (shouldReverseCommandOrder == true) { + commandValues = MochiKit.Iter.reversed(commandValues); + } return React.DOM.ul({}, MochiKit.Base.map(function (aCommand) { return React.DOM.li({'className':aCommand['broadcastEvent'], 'onClick':commandHandler, 'data-broadcast-event':aCommand['broadcastEvent']}, [React.DOM.span({}, aCommand['label'])]); - }, MochiKit.Base.values(this.commands()))); + }, commandValues)); }, //---------------------------------------------------------------------------- @@ -100,7 +105,7 @@ Clipperz.PM.UI.Components.Cards.CommandToolbar = React.createClass({ React.DOM.div({'className':'cardMenuOptions', 'onClick':this.toggleMenu}, 'commands'), React.DOM.div({'className':React.addons.classSet({'commandMenu':true, 'show':this.state['showCommandMenu']})}, [ React.DOM.div({'className':'commandMenuMask', 'onClick':this.toggleMenu}), - React.DOM.div({'className':'commandMenu'}, this.renderCommands()) + React.DOM.div({'className':'commandMenu'}, this.renderCommands(true)) ]) ]) ]