Refactoring: cleaning directories structure
[fnpeditor.git] / src / editor / modules / mainBar / mainBar.js
diff --git a/src/editor/modules/mainBar/mainBar.js b/src/editor/modules/mainBar/mainBar.js
new file mode 100644 (file)
index 0000000..ecf6812
--- /dev/null
@@ -0,0 +1,29 @@
+define([
+'libs/jquery',
+'libs/underscore',
+'libs/text!./template.html'], function($, _, template) {
+
+'use strict';
+
+return function(sandbox) {
+
+    var view = $(_.template(template)());
+    view.find('button').click(function(e) {
+        e.preventDefault();
+        sandbox.publish('cmd.' + $(e.target).attr('data-cmd'));
+    });
+
+    return {
+        start: function() { sandbox.publish('ready'); },
+        getView: function() {return view;},
+        setCommandEnabled: function(cmd, enabled) {
+            view.find('[data-cmd='+cmd+']').toggleClass('disabled', !enabled);
+        },
+        setVersion: function(version) {
+            view.find('.version').text(version);
+        }
+    };
+
+};
+
+});
\ No newline at end of file