even more tutorial in editor (status bar)
[fnpeditor.git] / src / editor / modules / documentToolbar / actionView.js
index ddef396..8ac81b9 100644 (file)
@@ -1,6 +1,7 @@
 define(function(require) {
     
 'use strict';
 define(function(require) {
     
 'use strict';
+/* globals gettext */
 
 var $ = require('libs/jquery'),
     Backbone = require('libs/backbone'),
 
 var $ = require('libs/jquery'),
     Backbone = require('libs/backbone'),
@@ -37,13 +38,19 @@ var ActionView = Backbone.View.extend({
         this.action.on('paramsChanged', function() {
             this.render();
         }, this);
         this.action.on('paramsChanged', function() {
             this.render();
         }, this);
-        this.setElement(viewTemplate());
+        this.setElement(viewTemplate({tutorial: this.options.tutorial}));
     },
     render: function() {
         /* globals document */
 
         var actionState = this.action.getState();
 
     },
     render: function() {
         /* globals document */
 
         var actionState = this.action.getState();
 
+        if(!actionState) {
+            this.$el.html(buttonTemplate({label: gettext('error :('), iconName:''}));
+            this._button().attr('disabled', true);
+            return;
+        }
+
         var templateContext = {
             label: actionState.label || '?',
             iconName: (iconExists(actionState.icon)) ? actionState.icon : null,
         var templateContext = {
             label: actionState.label || '?',
             iconName: (iconExists(actionState.icon)) ? actionState.icon : null,
@@ -101,8 +108,7 @@ var ActionView = Backbone.View.extend({
         this.trigger('mousedown');
     },
     onExecute: function() {
         this.trigger('mousedown');
     },
     onExecute: function() {
-        var ret = this.action.execute();
-        this.trigger('actionExecuted', this.action, ret);
+        this.action.execute();
     },
     onSelectionChange: function(e) {
         var select = $(e.target),
     },
     onSelectionChange: function(e) {
         var select = $(e.target),
@@ -120,8 +126,8 @@ var ActionView = Backbone.View.extend({
     }
 });
 
     }
 });
 
-var create = function(action) {
-    var view = new ActionView({action:action});
+var create = function(action, tutorial) {
+    var view = new ActionView({action: action, tutorial: tutorial});
     view.render();
 
     return {
     view.render();
 
     return {