smartxml: TextNodes don't contain other nodes - let them state that
[fnpeditor.git] / src / editor / modules / statusBar / statusBar.js
1 define(function(require) {
2     
3 'use strict';
4 /* globals gettext */
5
6 var $ = require('libs/jquery'),
7     template = require('libs/text!modules/statusBar/statusBar.html'),
8     logging = require('fnpjs/logging/logging');
9
10 var logger = logging.getLogger('statusBar');
11
12 return function(sandbox){
13
14     var view = $(template);
15
16     return {
17         start: function() {
18             return sandbox.publish('ready');
19         },
20         getView: function() {
21             return view;
22         },
23         showAction: function(action) {
24             var state = action.getState(),
25                 description = state.description;
26             if(!description) {
27                 description = state.allowed ? gettext('Undescribed action') : gettext('Action not allowed');
28                 logger.info('Undescribed action: ' + action.name);
29             }
30             view.text(description);
31             if(!state.allowed) {
32                 view.prepend('<span class="badge badge-warning" style="margin-right: 5px">!</span>');
33             }
34         },
35         clearAction: function() {
36             view.text('');
37         }
38     };
39
40 };
41
42 });