editor: status bar
[fnpeditor.git] / src / editor / modules / statusBar / statusBar.js
diff --git a/src/editor/modules/statusBar/statusBar.js b/src/editor/modules/statusBar/statusBar.js
new file mode 100644 (file)
index 0000000..5ad7c6b
--- /dev/null
@@ -0,0 +1,42 @@
+define(function(require) {
+    
+'use strict';
+/* globals gettext */
+
+var $ = require('libs/jquery'),
+    template = require('libs/text!modules/statusBar/statusBar.html'),
+    logging = require('fnpjs/logging/logging');
+
+var logger = logging.getLogger('statusBar');
+
+return function(sandbox){
+
+    var view = $(template);
+
+    return {
+        start: function() {
+            return sandbox.publish('ready');
+        },
+        getView: function() {
+            return view;
+        },
+        showAction: function(action) {
+            var state = action.getState(),
+                description = state.description;
+            if(!description) {
+                description = state.allowed ? gettext('Undescribed action') : gettext('Action not allowed');
+                logger.info('Undescribed action: ' + action.name);
+            }
+            view.text(description);
+            if(!state.allowed) {
+                view.prepend('<span class="badge badge-warning" style="margin-right: 5px">!</span>');
+            }
+        },
+        clearAction: function() {
+            view.text('');
+        }
+    };
+
+};
+
+});
\ No newline at end of file