Merging rng2 and rng modules
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 5 Jun 2013 15:16:02 +0000 (17:16 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 5 Jun 2013 15:16:02 +0000 (17:16 +0200)
modules.js
modules.less
modules/rng/editingLayout.html [new file with mode: 0644]
modules/rng/editingLayout.less [new file with mode: 0644]
modules/rng/rng.js
modules/rng/rng.less
modules/rng2/layout.html [deleted file]
modules/rng2/layout.less [deleted file]
modules/rng2/rng2.js [deleted file]

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