X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/a5871ab5512d87a33e7e95451d26ee7d3e789742..df248fcadb1956e5027424ab9e59c41ddd96d3bd:/modules/skelton.js diff --git a/modules/skelton.js b/modules/skelton.js index 2dbd948..28780f2 100644 --- a/modules/skelton.js +++ b/modules/skelton.js @@ -1,10 +1,35 @@ -rng.modules.skelton = function(sandbox) { +define(function() { + +return function(sandbox) { + + var view = $(sandbox.getTemplate('main')()); + + view.find('#rng-skelton-menu button').click(function(e) { + e.preventDefault(); + sandbox.publish('cmd.' + $(e.target).attr('data-cmd')); + }); + return { start: function() { + sandbox.getDOM().append(view); sandbox.publish('ready'); }, - setMainView: function(view) { - sandbox.getDOM().html(view); + setMainView: function(mainView) { + view.find('#rng-skelton-mainView').html(mainView); + }, + showMessage: function(message) { + view.find('#rng-skelton-messages').html(''+message+'').show(); + }, + clearMessage: function() { + view.find('#rng-skelton-messages').empty().hide(); + }, + deactivateCommand: function(cmd) { + view.find('[data-cmd='+cmd+']').addClass('disabled'); + }, + activateCommand: function(cmd) { + view.find('[data-cmd='+cmd+']').removeClass('disabled'); } } -}; \ No newline at end of file +}; + +}); \ No newline at end of file