Visual editor - status bar with breadcrumbs
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Sun, 28 Apr 2013 22:10:06 +0000 (00:10 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Sun, 28 Apr 2013 22:10:06 +0000 (00:10 +0200)
editor.css
modules/visualEditor.js

index 11cf5bd..4005085 100644 (file)
@@ -62,7 +62,7 @@ body {
     border-width: 1px;\r
     float:left;\r
     width: 600px;\r
     border-width: 1px;\r
     float:left;\r
     width: 600px;\r
-    height: 500px;\r
+    height: 470px;\r
     overflow-y: scroll;\r
     padding: 5px 10px;\r
 }\r
     overflow-y: scroll;\r
     padding: 5px 10px;\r
 }\r
@@ -104,7 +104,7 @@ body {
 #rng-visualEditor-sidebar {\r
     float:right;\r
     width: 266px;\r
 #rng-visualEditor-sidebar {\r
     float:right;\r
     width: 266px;\r
-    height:500px;\r
+    height:470px;\r
     position:relative;\r
     border-width: 1px 1px 1px 1px;\r
     border-style: solid;\r
     position:relative;\r
     border-width: 1px 1px 1px 1px;\r
     border-style: solid;\r
@@ -197,6 +197,11 @@ appearance: button;
     float:left;\r
 }\r
 \r
     float:left;\r
 }\r
 \r
+#rng-visualEditor-statusbar {\r
+    margin: 10px 5px;\r
+    font-size:0.9em;\r
+}\r
+\r
 .rng-visualEditor-sidebarContentItem fieldset {\r
     margin-bottom: 10px;\r
 }\r
 .rng-visualEditor-sidebarContentItem fieldset {\r
     margin-bottom: 10px;\r
 }\r
index a607d86..17e7f73 100644 (file)
@@ -326,9 +326,42 @@ rng.modules.visualEditor = function(sandbox) {
         }\r
     }\r
     \r
         }\r
     }\r
     \r
+    var statusBarView = {\r
+        node: view.node.find('#rng-visualEditor-statusbar'),\r
+        setup: function() {\r
+            var view = this;\r
+            view.node.on('mouseenter', 'a', function(e) {\r
+                var target = $(e.target);\r
+                mediator.nodeHighlightedById(target.attr('data-id')); \r
+            });\r
+            view.node.on('mouseleave', 'a', function(e) {\r
+                var target = $(e.target);\r
+                mediator.nodeDimmedById(target.attr('data-id')); \r
+            });\r
+            view.node.on('click', 'a', function(e) {\r
+                e.preventDefault();\r
+                mediator.nodeSelectedById($(e.target).attr('data-id'));\r
+            });\r
+        },\r
+        \r
+        showNode: function(node) {\r
+            this.node.empty();\r
+            this.node.html(sandbox.getTemplate('statusBarNodeDisplay')({node: node, parents: node.parents('[wlxml-tag]')}));\r
+            //node.parents('[wlxml-tag]')\r
+        },\r
+        \r
+        highlightNode: function(id) {\r
+            this.node.find('a[data-id="'+id+'"]').addClass('rng-hover');\r
+        },\r
+        dimNode: function(id) {\r
+            this.node.find('a[data-id="' +id+'"]').removeClass('rng-hover');\r
+        }\r
+    }\r
+    \r
     view.setup();\r
     sideBarView.setup();\r
     toolbarView.setup();\r
     view.setup();\r
     sideBarView.setup();\r
     toolbarView.setup();\r
+    statusBarView.setup();\r
     \r
     var mediator = {\r
         getCurrentNode: function() {\r
     \r
     var mediator = {\r
         getCurrentNode: function() {\r
@@ -339,6 +372,7 @@ rng.modules.visualEditor = function(sandbox) {
         },\r
         nodeSelected: function(node) {\r
             sideBarView.updateEditPane(node);\r
         },\r
         nodeSelected: function(node) {\r
             sideBarView.updateEditPane(node);\r
+            statusBarView.showNode(node);\r
         },\r
         nodeSelectedById: function(id) {\r
             view.selectNodeById(id);\r
         },\r
         nodeSelectedById: function(id) {\r
             view.selectNodeById(id);\r
@@ -369,10 +403,12 @@ rng.modules.visualEditor = function(sandbox) {
         nodeHovered: function(node) {\r
             view.highlightNode(node);\r
             sideBarView.highlightNode(node.attr('id'));\r
         nodeHovered: function(node) {\r
             view.highlightNode(node);\r
             sideBarView.highlightNode(node.attr('id'));\r
+            statusBarView.highlightNode(node.attr('id'));\r
         },\r
         nodeBlured: function(node) {\r
             view.dimNode(node);\r
             sideBarView.dimNode(node.attr('id'));\r
         },\r
         nodeBlured: function(node) {\r
             view.dimNode(node);\r
             sideBarView.dimNode(node.attr('id'));\r
+            statusBarView.dimNode(node.attr('id'));\r
         },\r
         wrapWithNodeRequest: function(wlxmlTag, wlxmlClass) {\r
             view.wrapSelectionWithNewNode(wlxmlTag, wlxmlClass);\r
         },\r
         wrapWithNodeRequest: function(wlxmlTag, wlxmlClass) {\r
             view.wrapSelectionWithNewNode(wlxmlTag, wlxmlClass);\r