-define(function() {\r
+define(['views/tabs/tabs'], function(tabs) {\r
\r
return function(sandbox) {\r
'use strict';\r
\r
+ var mainTabs = (new tabs.View()).render();\r
+ \r
function addTab(title, slug, view) {\r
- sandbox.getModule('tabsManager').addTab(title, slug, view);\r
+ mainTabs.addTab(title, slug, view);\r
}\r
\r
/* Events handling */\r
\r
eventHandlers.skelton = {\r
ready: function() {\r
- sandbox.getModule('tabsManager').start();\r
- },\r
- 'cmd.save': function() {\r
- var editorSlugs = ['visual', 'source'];\r
- var slug = sandbox.getModule('tabsManager').getCurrentSlug();\r
- if(_.contains(editorSlugs, slug)) {\r
- var editor = sandbox.getModule(slug+'Editor');\r
- if(editor.isDirty()) {\r
- sandbox.getModule('data').commitDocument(editor.getDocument(), slug + '_edit');\r
- editor.setDirty(false);\r
- }\r
- }\r
- sandbox.getModule('data').saveDocument();\r
- }\r
- };\r
- \r
- eventHandlers.tabsManager = {\r
- ready: function() {\r
- sandbox.getModule('skelton').setMainView(sandbox.getModule('tabsManager').getView());\r
+ sandbox.getModule('skelton').setMainView(mainTabs.getAsView());\r
+ \r
_.each(['visualEditor', 'sourceEditor', 'rng2'], function(moduleName) {\r
sandbox.getModule(moduleName).start();\r
});\r
},\r
- leaving: function(slug) {\r
- if(slug === 'source' || slug === 'visual') {\r
- var editor = sandbox.getModule(slug+'Editor');\r
- if(editor.isDirty()) {\r
- sandbox.getModule('data').commitDocument(editor.getDocument(), slug + '_edit');\r
- editor.setDirty(false);\r
- }\r
- }\r
- },\r
- showed: function(slug) {\r
- if(slug === 'visual')\r
- sandbox.getModule('visualEditor').onShowed();\r
+ 'cmd.save': function() {\r
+ //todo\r
}\r
};\r
- \r
+ \r
eventHandlers.sourceEditor = {\r
ready: function() {\r
addTab(gettext('Source'), 'source', sandbox.getModule('sourceEditor').getView());\r