28780f2b237ccb3c95308fbd164e9343a3a0f9d6
[fnpeditor.git] / modules / skelton.js
1 define(function() {\r
2 \r
3 return function(sandbox) {\r
4     \r
5     var view = $(sandbox.getTemplate('main')());\r
6     \r
7     view.find('#rng-skelton-menu button').click(function(e) {\r
8         e.preventDefault();\r
9         sandbox.publish('cmd.' + $(e.target).attr('data-cmd'));\r
10     });\r
11     \r
12     return {\r
13         start: function() {\r
14             sandbox.getDOM().append(view);\r
15             sandbox.publish('ready');\r
16         },\r
17         setMainView: function(mainView) {\r
18             view.find('#rng-skelton-mainView').html(mainView);\r
19         },\r
20         showMessage: function(message) {\r
21             view.find('#rng-skelton-messages').html('<span>'+message+'</span>').show();\r
22         },\r
23         clearMessage: function() {\r
24             view.find('#rng-skelton-messages').empty().hide();\r
25         },\r
26         deactivateCommand: function(cmd) {\r
27             view.find('[data-cmd='+cmd+']').addClass('disabled');\r
28         },\r
29         activateCommand: function(cmd) {\r
30             view.find('[data-cmd='+cmd+']').removeClass('disabled');\r
31         }\r
32     }\r
33 };\r
34 \r
35 });