metaWidget wip: integrating
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 1 Jul 2013 13:36:05 +0000 (15:36 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 1 Jul 2013 13:36:05 +0000 (15:36 +0200)
modules/documentCanvas/documentCanvas.js
modules/nodePane/nodePane.js
modules/nodePane/template.html

index deebfca..c47b8bb 100644 (file)
@@ -29,7 +29,12 @@ return function(sandbox) {
         },
         modifyCurrentNode: function(attr, value) {
             if(manager.currentNode) {
-                manager.getNodeElement(manager.currentNode).attr('wlxml-'+attr, value);
+                if(_.contains(['tag', 'class'], attr)) {
+                    manager.getNodeElement(manager.currentNode).attr('wlxml-'+attr, value);
+                } else {
+                    // changing node meta attr
+                    manager.currentNode.setMetaAttr(attr, value);
+                }
                 sandbox.publish('contentChanged');
             }
         },
index 57f5c17..39afbea 100644 (file)
@@ -2,8 +2,8 @@ define([
 'libs/text!./template.html',
 'libs/jquery-1.9.1.min',
 'libs/underscore-min',
-
-], function(templateSrc, $, _) {
+'modules/nodePane/metaWidget/metaWidget'
+], function(templateSrc, $, _, metaWidget) {
 
 'use strict';
 
@@ -27,6 +27,12 @@ return function(sandbox) {
         setNode: function(canvasNode) {
             view.find('.rng-module-nodePane-tagSelect').val(canvasNode.getTag());
             view.find('.rng-module-nodePane-classSelect').val(canvasNode.getClass());
+
+            var widget = metaWidget.create({attrs:canvasNode.getMetaAttrs()});
+            widget.on('valueChanged', function(key, value) {
+                sandbox.publish('nodeChanged', key, value);
+            });
+            view.find('.metaFields').empty().append(widget.el);
         }
     };
     
index d1e8ab2..a40e711 100644 (file)
@@ -19,5 +19,7 @@
                 <% }); %>
             </select>
         </div>
+        <div class="metaFields">
+        </div>
     </fieldset>
 </div>
\ No newline at end of file