4 'libs/text!./template.html'], function($, _, template) {
8 return function(sandbox) {
12 var config = sandbox.getConfig(),
13 userName = config.user && config.user.name,
14 view = $(_.template(template)({
15 userName: userName || gettext('anonymous')
18 view.find('[data-cmd]').click(function(e) {
20 var target = $(e.target);
21 if(target.hasClass('disabled')) {
24 sandbox.publish('cmd.' + $(e.target).attr('data-cmd'));
28 start: function() { sandbox.publish('ready'); },
29 getView: function() {return view;},
30 setCommandEnabled: function(cmd, enabled) {
31 view.find('[data-cmd='+cmd+']').toggleClass('disabled', !enabled);
33 setVersion: function(version) {
34 view.find('.version').text(version);