views.mainTabs.addTab(title, slug, view);\r
}\r
\r
+ var commands = {\r
+ highlightDocumentNode: function(wlxmlNode, origin) {\r
+ ['documentCanvas', 'nodeBreadCrumbs', 'nodeFamilyTree'].forEach(function(moduleName) {\r
+ if(!origin || moduleName != origin)\r
+ sandbox.getModule(moduleName).highlightNode(wlxmlNode)\r
+ });\r
+ },\r
+ dimDocumentNode: function(wlxmlNode, origin) {\r
+ ['documentCanvas', 'nodeBreadCrumbs', 'nodeFamilyTree'].forEach(function(moduleName) {\r
+ if(!origin || moduleName != origin)\r
+ sandbox.getModule(moduleName).dimNode(wlxmlNode)\r
+ });\r
+ }\r
+ }\r
+ \r
+\r
var views = {\r
mainLayout: new layout.Layout(mainLayoutTemplate),\r
mainTabs: (new tabs.View()).render(),\r
}\r
\r
views.visualEditing.setView('rightColumn', views.visualEditingSidebar.getAsView());\r
- addMainTab('rng2 test', 'rng2test', views.visualEditing.getAsView());\r
+ addMainTab('Edytor', 'editor', views.visualEditing.getAsView());\r
\r
sandbox.getDOM().append(views.mainLayout.getAsView());\r
\r
views.visualEditingSidebar.addTab({icon: 'pencil'}, 'edit', views.currentNodePaneLayout.getAsView());\r
- \r
- \r
\r
\r
/* Events handling */\r
}\r
};\r
\r
- eventHandlers.visualEditor = {\r
- ready: function() {\r
- sandbox.getModule('visualEditor').setDocument(sandbox.getModule('data').getDocument());\r
- addMainTab(gettext('Visual'), 'visual', sandbox.getModule('visualEditor').getView());\r
- \r
- }\r
- };\r
- \r
eventHandlers.data = {\r
ready: function() {\r
views.mainLayout.setView('mainView', views.mainTabs.getAsView());\r
\r
- _.each(['visualEditor', 'sourceEditor', 'documentCanvas', 'documentToolbar', 'nodePane', 'metadataEditor', 'nodeFamilyTree', 'mainBar', 'indicator'], function(moduleName) {\r
+ _.each(['sourceEditor', 'documentCanvas', 'documentToolbar', 'nodePane', 'metadataEditor', 'nodeFamilyTree', 'nodeBreadCrumbs', 'mainBar', 'indicator'], function(moduleName) {\r
sandbox.getModule(moduleName).start();\r
});\r
},\r
}\r
}\r
\r
- eventHandlers.rng2 = {\r
- ready: function() {\r
- addMainTab('rng2 test', 'rng2test', sandbox.getModule('rng2').getView());\r
- \r
- }\r
- }\r
- \r
eventHandlers.mainBar = {\r
ready: function() {\r
views.mainLayout.setView('topPanel', sandbox.getModule('mainBar').getView());\r
nodeSelected: function(node) {\r
sandbox.getModule('nodePane').setNode(node);\r
sandbox.getModule('nodeFamilyTree').setNode(node);\r
+ sandbox.getModule('nodeBreadCrumbs').setNode(node);\r
},\r
\r
contentChanged: function() {\r
\r
},\r
\r
- nodeHovered: function(node) {\r
- sandbox.getModule('nodeFamilyTree').highlightNode(node.attr('id'));\r
+ nodeHovered: function(wlxmlNode) {\r
+ commands.highlightDocumentNode(wlxmlNode);\r
},\r
\r
- nodeBlured: function(node) {\r
- sandbox.getModule('nodeFamilyTree').dimNode(node.attr('id'));\r
+ nodeBlured: function(wlxmlNode) {\r
+ commands.dimDocumentNode(wlxmlNode);\r
}\r
};\r
\r
ready: function() {\r
views.currentNodePaneLayout.appendView(sandbox.getModule('nodeFamilyTree').getView());\r
},\r
- nodeEntered: function(id) {\r
- sandbox.getModule('documentCanvas').highlightNode(id);\r
+ nodeEntered: function(wlxmlNode) {\r
+ commands.highlightDocumentNode(wlxmlNode, 'nodeFamilyTree');\r
},\r
- nodeLeft: function(id) {\r
- sandbox.getModule('documentCanvas').dimNode(id);\r
+ nodeLeft: function(wlxmlNode) {\r
+ commands.dimDocumentNode(wlxmlNode, 'nodeFamilyTree');\r
},\r
- nodeSelected: function(id) {\r
- sandbox.getModule('documentCanvas').selectNode(id);\r
+ nodeSelected: function(wlxmlNode) {\r
+ sandbox.getModule('documentCanvas').selectNode(wlxmlNode);\r
}\r
};\r
\r
sandbox.getModule('documentCanvas').wrapSelectionWithNewNode(wlxmlTag, wlxmlClass);\r
}\r
}\r
+ };\r
+ \r
+ eventHandlers.nodeBreadCrumbs = {\r
+ ready: function() {\r
+ views.visualEditing.setView('statusBar', sandbox.getModule('nodeBreadCrumbs').getView());\r
+ },\r
+ nodeHighlighted: function(wlxmlNode) {\r
+ commands.highlightDocumentNode(wlxmlNode, 'nodeBreadCrumbs');\r
+ },\r
+ nodeDimmed: function(wlxmlNode) {\r
+ commands.dimDocumentNode(wlxmlNode, 'nodeBreadCrumbs');\r
+ },\r
+ nodeSelected: function(wlxmlNode) {\r
+ sandbox.getModule('documentCanvas').selectNode(wlxmlNode);\r
+ } \r
}\r
\r
/* api */\r