From 039f0edb73590283bc38ef5421e670fa40ff2480 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 1 Jul 2013 15:36:05 +0200 Subject: [PATCH] metaWidget wip: integrating --- modules/documentCanvas/documentCanvas.js | 7 ++++++- modules/nodePane/nodePane.js | 10 ++++++++-- modules/nodePane/template.html | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/documentCanvas/documentCanvas.js b/modules/documentCanvas/documentCanvas.js index deebfca..c47b8bb 100644 --- a/modules/documentCanvas/documentCanvas.js +++ b/modules/documentCanvas/documentCanvas.js @@ -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'); } }, diff --git a/modules/nodePane/nodePane.js b/modules/nodePane/nodePane.js index 57f5c17..39afbea 100644 --- a/modules/nodePane/nodePane.js +++ b/modules/nodePane/nodePane.js @@ -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); } }; diff --git a/modules/nodePane/template.html b/modules/nodePane/template.html index d1e8ab2..a40e711 100644 --- a/modules/nodePane/template.html +++ b/modules/nodePane/template.html @@ -19,5 +19,7 @@ <% }); %> +
+
\ No newline at end of file -- 2.20.1