From: Aleksander Ɓukasz Date: Wed, 5 Jun 2013 15:16:02 +0000 (+0200) Subject: Merging rng2 and rng modules X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/e47b0769de4853ef9c027592533804e39f247f44 Merging rng2 and rng modules --- diff --git a/modules.js b/modules.js index 0e073f1..5a297cf 100644 --- a/modules.js +++ b/modules.js @@ -17,6 +17,5 @@ define(function(require) { metadataEditor: require('modules/metadataEditor/metadataEditor'), nodeFamilyTree: require('modules/nodeFamilyTree/nodeFamilyTree'), - rng2: require('modules/rng2/rng2') } }); \ No newline at end of file diff --git a/modules.less b/modules.less index 251c077..e7384e1 100644 --- a/modules.less +++ b/modules.less @@ -1,5 +1,4 @@ @import 'modules/rng/rng.less'; -@import 'modules/rng2/layout.less'; @import 'modules/mainBar/mainBar.less'; @import 'modules/indicator/indicator.less'; @import 'modules/nodePane/nodePane.less'; diff --git a/modules/rng/editingLayout.html b/modules/rng/editingLayout.html new file mode 100644 index 0000000..f98ca07 --- /dev/null +++ b/modules/rng/editingLayout.html @@ -0,0 +1,6 @@ +
+
+
+
+
+
\ No newline at end of file diff --git a/modules/rng/editingLayout.less b/modules/rng/editingLayout.less new file mode 100644 index 0000000..219497c --- /dev/null +++ b/modules/rng/editingLayout.less @@ -0,0 +1,52 @@ +.rng-module-rng2-left { + float: left; + width: 600px; +} + +.rng-module-rng2-right { + float: right; + position: relative; + width: 258px; + margin-left: 50px; + + border-width: 1px 1px 1px 1px; + border-style: solid; + border-color: #ddd; + padding: 5px 15px; + + p, td, label, input, select { + font-size: 11px; + line-height:13px; + } + + select { + -webkit-appearance: button; + -moz-appearance: button; + appearance: button; + height: auto; + line-height: 14px; + } + + legend { + font-size:11px; + height:30px; + } + + + .rng-view-tabs-tabBar { + position:absolute; + top:-1px; + right:-50px; + border-width: 1px 1px 1px 0px; + border-style: solid; + border-color: #ddd; + padding: 5px; + background: #ededed; + } + + label + select { + position:relative; + top: 5px; + } + +} \ No newline at end of file diff --git a/modules/rng/rng.js b/modules/rng/rng.js index 4b9aecf..e1277e5 100644 --- a/modules/rng/rng.js +++ b/modules/rng/rng.js @@ -1,14 +1,18 @@ define([ 'fnpjs/layout', +'fnpjs/vbox', 'views/tabs/tabs', -'libs/text!./mainLayout.html' -], function(layout, tabs, mainLayoutTemplate) { +'libs/text!./mainLayout.html', +'libs/text!./editingLayout.html', +], function(layout, vbox, tabs, mainLayoutTemplate, editingLayoutTemplate) { return function(sandbox) { 'use strict'; var mainTabs = (new tabs.View()).render(); var mainLayout = new layout.Layout(mainLayoutTemplate); + var editingLayout = new layout.Layout(editingLayoutTemplate); + sandbox.getDOM().append(mainLayout.getAsView()); function addTab(title, slug, view) { @@ -38,7 +42,7 @@ return function(sandbox) { ready: function() { mainLayout.setView('mainView', mainTabs.getAsView()); - _.each(['visualEditor', 'sourceEditor', 'rng2', 'mainBar', 'indicator'], function(moduleName) { + _.each(['visualEditor', 'sourceEditor', 'documentCanvas', 'nodePane', 'metadataEditor', 'nodeFamilyTree', 'mainBar', 'indicator'], function(moduleName) { sandbox.getModule(moduleName).start(); }); }, @@ -76,6 +80,71 @@ return function(sandbox) { ready: function() { mainLayout.setView('messages', sandbox.getModule('indicator').getView()); } + }; + + + var sidebar = (new tabs.View({stacked: true})).render(); + var box = new vbox.VBox(); + editingLayout.setView('rightColumn', sidebar.getAsView()); + addTab('rng2 test', 'rng2test', editingLayout.getAsView()); + + eventHandlers.documentCanvas = { + ready: function() { + sandbox.getModule('documentCanvas').setDocument(sandbox.getModule('data').getDocument()); + editingLayout.setView('leftColumn', sandbox.getModule('documentCanvas').getView()); + }, + + nodeSelected: function(node) { + sandbox.getModule('nodePane').setNode(node); + sandbox.getModule('nodeFamilyTree').setNode(node); + }, + + contentChanged: function() { + + }, + + nodeHovered: function(node) { + + }, + + nodeBlured: function(node) { + + } + }; + + eventHandlers.nodePane = { + ready: function() { + //sidebar.addTab({icon: 'pencil'}, 'nodePane', sandbox.getModule('nodePane').getView()); + box.appendView(sandbox.getModule('nodePane').getView()); + sidebar.addTab({icon: 'pencil'}, 'edit', box.getAsView()); + }, + + nodeChanged: function(attr, value) { + sandbox.getModule('documentCanvas').modifyCurrentNode(attr, value); + } + }; + + eventHandlers.metadataEditor = { + ready: function() { + sandbox.getModule('metadataEditor').setMetadata(sandbox.getModule('data').getDocument()); + sidebar.addTab({icon: 'info-sign'}, 'metadataEditor', sandbox.getModule('metadataEditor').getView()); + } + }; + + eventHandlers.nodeFamilyTree = { + ready: function() { + //sidebar.addTab({icon: 'home'}, 'family', sandbox.getModule('nodeFamilyTree').getView()); + box.appendView(sandbox.getModule('nodeFamilyTree').getView()); + }, + nodeEntered: function(id) { + sandbox.getModule('documentCanvas').highlightNode(id); + }, + nodeLeft: function(id) { + sandbox.getModule('documentCanvas').dimNode(id); + }, + nodeSelected: function(id) { + sandbox.getModule('documentCanvas').selectNode(id); + } } /* api */ diff --git a/modules/rng/rng.less b/modules/rng/rng.less index 6641668..7e8241c 100644 --- a/modules/rng/rng.less +++ b/modules/rng/rng.less @@ -1 +1,2 @@ -@import 'mainLayout.less'; \ No newline at end of file +@import 'mainLayout.less'; +@import 'editingLayout.less'; \ No newline at end of file diff --git a/modules/rng2/layout.html b/modules/rng2/layout.html deleted file mode 100644 index f98ca07..0000000 --- a/modules/rng2/layout.html +++ /dev/null @@ -1,6 +0,0 @@ -
-
-
-
-
-
\ No newline at end of file diff --git a/modules/rng2/layout.less b/modules/rng2/layout.less deleted file mode 100644 index 9b603dd..0000000 --- a/modules/rng2/layout.less +++ /dev/null @@ -1,53 +0,0 @@ - -.rng-module-rng2-left { - float: left; - width: 600px; -} - -.rng-module-rng2-right { - float: right; - position: relative; - width: 258px; - margin-left: 50px; - - border-width: 1px 1px 1px 1px; - border-style: solid; - border-color: #ddd; - padding: 5px 15px; - - p, td, label, input, select { - font-size: 11px; - line-height:13px; - } - - select { - -webkit-appearance: button; - -moz-appearance: button; - appearance: button; - height: auto; - line-height: 14px; - } - - legend { - font-size:11px; - height:30px; - } - - - .rng-view-tabs-tabBar { - position:absolute; - top:-1px; - right:-50px; - border-width: 1px 1px 1px 0px; - border-style: solid; - border-color: #ddd; - padding: 5px; - background: #ededed; - } - - label + select { - position:relative; - top: 5px; - } - -} \ No newline at end of file diff --git a/modules/rng2/rng2.js b/modules/rng2/rng2.js deleted file mode 100644 index e488e1b..0000000 --- a/modules/rng2/rng2.js +++ /dev/null @@ -1,104 +0,0 @@ -define([ -'fnpjs/layout', -'fnpjs/vbox', -'views/tabs/tabs', -'libs/text!./layout.html', -], -function(layout, vbox, tabs, layoutTemplate) { - -'use strict'; - -return function(sandbox) { - var view = new layout.Layout(layoutTemplate); - - var sidebar = new tabs.View({stacked: true}); - sidebar.render(); - - var box = new vbox.VBox(); - - - view.setView('rightColumn', sidebar.$el); - - var eventHandlers = {}; - - eventHandlers.documentCanvas = { - ready: function() { - sandbox.getModule('documentCanvas').setDocument(sandbox.getModule('data').getDocument()); - view.setView('leftColumn', sandbox.getModule('documentCanvas').getView()); - }, - - nodeSelected: function(node) { - sandbox.getModule('nodePane').setNode(node); - sandbox.getModule('nodeFamilyTree').setNode(node); - }, - - contentChanged: function() { - - }, - - nodeHovered: function(node) { - - }, - - nodeBlured: function(node) { - - } - }; - - eventHandlers.nodePane = { - ready: function() { - //sidebar.addTab({icon: 'pencil'}, 'nodePane', sandbox.getModule('nodePane').getView()); - box.appendView(sandbox.getModule('nodePane').getView()); - sidebar.addTab({icon: 'pencil'}, 'edit', box.getAsView()); - }, - - nodeChanged: function(attr, value) { - sandbox.getModule('documentCanvas').modifyCurrentNode(attr, value); - } - }; - - eventHandlers.metadataEditor = { - ready: function() { - sandbox.getModule('metadataEditor').setMetadata(sandbox.getModule('data').getDocument()); - sidebar.addTab({icon: 'info-sign'}, 'metadataEditor', sandbox.getModule('metadataEditor').getView()); - } - }; - - eventHandlers.nodeFamilyTree = { - ready: function() { - //sidebar.addTab({icon: 'home'}, 'family', sandbox.getModule('nodeFamilyTree').getView()); - box.appendView(sandbox.getModule('nodeFamilyTree').getView()); - }, - nodeEntered: function(id) { - sandbox.getModule('documentCanvas').highlightNode(id); - }, - nodeLeft: function(id) { - sandbox.getModule('documentCanvas').dimNode(id); - }, - nodeSelected: function(id) { - sandbox.getModule('documentCanvas').selectNode(id); - } - } - - - - return { - start: function() { - sandbox.getModule('documentCanvas').start(); - sandbox.getModule('nodePane').start(); - sandbox.getModule('metadataEditor').start(); - sandbox.getModule('nodeFamilyTree').start(); - - sandbox.publish('ready'); - }, - handleEvent: function(moduleName, eventName, args) { - if(eventHandlers[moduleName] && eventHandlers[moduleName][eventName]) { - eventHandlers[moduleName][eventName].apply(eventHandlers, args); - } - }, - getView: function() { return view.getAsView(); } - - } -} - -}); \ No newline at end of file