display: none;\r
}\r
\r
-#rng-skelton {\r
- position: relative;\r
-}\r
-\r
-#rng-skelton-menu {\r
- float: right;\r
-}\r
-\r
-#rng-skelton-menu li {\r
- display: inline;\r
-}\r
-\r
-#rng-skelton-messages {\r
- position: absolute;\r
- top: -22px;\r
- width:100%;\r
- text-align:center;\r
-}\r
-\r
-#rng-skelton-messages span {\r
- font-weight: bold;\r
- background: #f9edbe;\r
- padding: 2px 5px;\r
- border: solid 1px #f6e39c;\r
-}\r
-\r
-#rng-skelton-menu ul {\r
- list-style-type: none;\r
-}\r
-\r
.rng-visualEditor-nodeHoverTag {\r
position:absolute;\r
height:20px;\r
return {\r
data: require('modules/data'),\r
rng: require('modules/rng'),\r
- skelton: require('modules/skelton'),\r
+ mainBar: require('modules/mainBar/mainBar'),\r
+ indicator: require('modules/indicator/indicator'),\r
+ \r
sourceEditor: require('modules/sourceEditor'),\r
visualEditor: require('modules/visualEditor'),\r
\r
+@import 'modules/rng/rng.less';\r
@import 'modules/rng2/layout.less';\r
+@import 'modules/mainBar/mainBar.less';\r
+@import 'modules/indicator/indicator.less';\r
@import 'modules/nodePane/nodePane.less';\r
@import 'modules/metadataEditor/metadataEditor.less';
\ No newline at end of file
success: function() {sandbox.publish('savingEnded', 'success');},\r
error: function() {sandbox.publish('savingEnded', 'error');}\r
});\r
+ },\r
+ fakeSave: function() {\r
+ sandbox.publish('savingStarted');\r
+ window.setTimeout(function() {\r
+ sandbox.publish('savingEnded', 'success')\r
+ }, 2000);\r
}\r
\r
}\r
--- /dev/null
+define([\r
+'libs/jquery-1.9.1.min',\r
+'libs/underscore-min',\r
+'libs/text!./template.html'\r
+], function($, _, template) {\r
+\r
+'use strict';\r
+\r
+return function(sandbox) {\r
+\r
+ var view = {\r
+ dom: $(_.template(template)()),\r
+ setup: function() {\r
+ \r
+ }\r
+ }\r
+\r
+ return {\r
+ start: function() { sandbox.publish('ready'); },\r
+ getView: function() { return view.dom; },\r
+ showMessage: function(msg) {\r
+ view.dom.html('<span>' + msg + '</span>').show();\r
+ },\r
+ clearMessage: function() {\r
+ view.dom.empty();\r
+ }\r
+ \r
+ }\r
+\r
+}\r
+\r
+});\r
--- /dev/null
+.rng-module-indicator {\r
+ span {\r
+ font-weight: bold;\r
+ background: #f9edbe;\r
+ padding: 2px 5px;\r
+ border: solid 1px #f6e39c;\r
+ font-size:12px;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+<div class="rng-module-indicator">\r
+\r
+</div>
\ No newline at end of file
--- /dev/null
+define([\r
+'libs/jquery-1.9.1.min',\r
+'libs/underscore-min',\r
+'libs/text!./template.html'], function($, _, template) {\r
+\r
+'use strict';\r
+\r
+return function(sandbox) {\r
+\r
+ var view = $(_.template(template)());\r
+ view.find('button').click(function(e) {\r
+ e.preventDefault();\r
+ sandbox.publish('cmd.' + $(e.target).attr('data-cmd'));\r
+ })\r
+\r
+ return {\r
+ start: function() { sandbox.publish('ready'); },\r
+ getView: function() {return view;},\r
+ setCommandEnabled: function(cmd, enabled) {\r
+ view.find('[data-cmd='+cmd+']').toggleClass('disabled', !enabled);\r
+ }\r
+ }\r
+\r
+};\r
+\r
+});
\ No newline at end of file
--- /dev/null
+/*#rng-skelton-menu {\r
+ float: right;\r
+}*/\r
+\r
+.rng-module-mainBar {\r
+ li {\r
+ display: inline;\r
+ }\r
+\r
+ ul {\r
+ list-style-type: none;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+<div class="rng-module-mainBar">\r
+ <ul>\r
+ <li><button class="btn btn-mini btn-info" data-cmd="save">Zapisz</button></li>\r
+ <li><a class="btn btn-mini btn-danger" href="/">Wyjdź</a></li>\r
+ </ul>\r
+</div>
\ No newline at end of file
-define(['views/tabs/tabs'], function(tabs) {\r
+define([\r
+'fnpjs/layout',\r
+'views/tabs/tabs',\r
+'libs/text!./rng/mainLayout.html'\r
+], function(layout, tabs, mainLayoutTemplate) {\r
\r
return function(sandbox) {\r
'use strict';\r
\r
var mainTabs = (new tabs.View()).render();\r
+ var mainLayout = new layout.Layout(mainLayoutTemplate);\r
+ sandbox.getDOM().append(mainLayout.getAsView());\r
\r
function addTab(title, slug, view) {\r
mainTabs.addTab(title, slug, view);\r
/* Events handling */\r
\r
var eventHandlers = {};\r
- \r
- eventHandlers.skelton = {\r
- ready: function() {\r
- sandbox.getModule('skelton').setMainView(mainTabs.getAsView());\r
- \r
- _.each(['visualEditor', 'sourceEditor', 'rng2'], function(moduleName) {\r
- sandbox.getModule(moduleName).start();\r
- });\r
- },\r
- 'cmd.save': function() {\r
- //todo\r
- }\r
- };\r
\r
eventHandlers.sourceEditor = {\r
ready: function() {\r
\r
eventHandlers.data = {\r
ready: function() {\r
- sandbox.getModule('skelton').start();\r
+ mainLayout.setView('mainView', mainTabs.getAsView());\r
+ \r
+ _.each(['visualEditor', 'sourceEditor', 'rng2', 'mainBar', 'indicator'], function(moduleName) {\r
+ sandbox.getModule(moduleName).start();\r
+ });\r
},\r
documentChanged: function(document, reason) {\r
var slug = (reason === 'visual_edit' ? 'source' : 'visual');\r
sandbox.getModule(slug+'Editor').setDocument(document);\r
},\r
savingStarted: function() {\r
- sandbox.getModule('skelton').deactivateCommand('save');\r
- sandbox.getModule('skelton').showMessage(gettext('Saving...'));\r
+ sandbox.getModule('mainBar').setCommandEnabled('save', false);\r
+ sandbox.getModule('indicator').showMessage(gettext('Saving...'));\r
},\r
savingEnded: function(status) {\r
- sandbox.getModule('skelton').activateCommand('save');\r
- sandbox.getModule('skelton').clearMessage();\r
+ sandbox.getModule('mainBar').setCommandEnabled('save', true);\r
+ sandbox.getModule('indicator').clearMessage();\r
}\r
}\r
\r
}\r
}\r
\r
+ eventHandlers.mainBar = {\r
+ ready: function() {\r
+ mainLayout.setView('topPanel', sandbox.getModule('mainBar').getView());\r
+ },\r
+ 'cmd.save': function() {\r
+ sandbox.getModule('data').fakeSave();\r
+ }\r
+ }\r
+ \r
+ eventHandlers.indicator = {\r
+ ready: function() {\r
+ mainLayout.setView('messages', sandbox.getModule('indicator').getView());\r
+ }\r
+ }\r
+ \r
/* api */\r
\r
return {\r
--- /dev/null
+<div id="rng-module-rng-mainLayout">\r
+ <div fnpjs-place="messages"></div>\r
+ <div fnpjs-place="topPanel">\r
+ </div>\r
+ <div style="clear:both"></div>\r
+ <div fnpjs-place="mainView">\r
+ </div>\r
+</div>
\ No newline at end of file
--- /dev/null
+#rng-module-rng-mainLayout {\r
+ position: relative;\r
+ \r
+ [fnpjs-place="messages"] {\r
+ position: absolute;\r
+ top: 5px;\r
+ width:100%;\r
+ text-align:center;\r
+ }\r
+ \r
+ [fnpjs-place="topPanel"] {\r
+ float: right;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+@import 'mainLayout.less';
\ No newline at end of file
+++ /dev/null
-define(function() {\r
-\r
-return function(sandbox) {\r
- \r
- var view = $(sandbox.getTemplate('main')());\r
- \r
- view.find('#rng-skelton-menu button').click(function(e) {\r
- e.preventDefault();\r
- sandbox.publish('cmd.' + $(e.target).attr('data-cmd'));\r
- });\r
- \r
- return {\r
- start: function() {\r
- sandbox.getDOM().append(view);\r
- sandbox.publish('ready');\r
- },\r
- setMainView: function(mainView) {\r
- view.find('#rng-skelton-mainView').html(mainView);\r
- },\r
- showMessage: function(message) {\r
- view.find('#rng-skelton-messages').html('<span>'+message+'</span>').show();\r
- },\r
- clearMessage: function() {\r
- view.find('#rng-skelton-messages').empty().hide();\r
- },\r
- deactivateCommand: function(cmd) {\r
- view.find('[data-cmd='+cmd+']').addClass('disabled');\r
- },\r
- activateCommand: function(cmd) {\r
- view.find('[data-cmd='+cmd+']').removeClass('disabled');\r
- }\r
- }\r
-};\r
-\r
-});
\ No newline at end of file
initModules: ['rng'],
permissions: {
'skelton': ['getDOM'],
- 'rng': ['getModule', 'handleEvents'],
+ 'rng': ['getModule', 'handleEvents', 'getDOM'],
'rng2': ['getModule', 'handleEvents']
}
});
\ No newline at end of file