fnp
/
fnpeditor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
25dc71d
)
integration wip: bring back meta data attrs edit via node pane
author
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 22 Nov 2013 14:39:01 +0000
(15:39 +0100)
committer
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 2 Dec 2013 13:50:54 +0000
(14:50 +0100)
src/editor/modules/nodePane/metaWidget/metaWidget.js
patch
|
blob
|
history
src/editor/modules/nodePane/metaWidget/metaWidget.test.js
patch
|
blob
|
history
src/editor/modules/nodePane/nodePane.js
patch
|
blob
|
history
diff --git
a/src/editor/modules/nodePane/metaWidget/metaWidget.js
b/src/editor/modules/nodePane/metaWidget/metaWidget.js
index
14ba7b6
..
7561acd
100644
(file)
--- a/
src/editor/modules/nodePane/metaWidget/metaWidget.js
+++ b/
src/editor/modules/nodePane/metaWidget/metaWidget.js
@@
-11,9
+11,9
@@
var templates = {
string: _.template(stringFieldTpl)
};
string: _.template(stringFieldTpl)
};
-var getAttrElement = function(attr) {
+var getAttrElement = function(attr
Name, attr
) {
var toret = $('<div>');
var toret = $('<div>');
- toret.append(templates.string({name: attr
.n
ame, value: attr.value}));
+ toret.append(templates.string({name: attr
N
ame, value: attr.value}));
return toret;
};
return toret;
};
@@
-23,9
+23,9
@@
var MetaWidget = Backbone.View.extend({
},
initialize: function() {
var view = this;
},
initialize: function() {
var view = this;
-
this.options.attrs.forEach(function(attr
) {
- view.$el.append(getAttrElement(attr));
- });
+
_.keys(this.options.attrs).forEach(function(attrName
) {
+ view.$el.append(getAttrElement(attr
Name, this.options.attrs[attrName]
));
+ }
.bind(this)
);
},
onMetaFieldChange: function(e) {
var target = $(e.target);
},
onMetaFieldChange: function(e) {
var target = $(e.target);
diff --git
a/src/editor/modules/nodePane/metaWidget/metaWidget.test.js
b/src/editor/modules/nodePane/metaWidget/metaWidget.test.js
index
05b75dc
..
f546248
100644
(file)
--- a/
src/editor/modules/nodePane/metaWidget/metaWidget.test.js
+++ b/
src/editor/modules/nodePane/metaWidget/metaWidget.test.js
@@
-13,7
+13,7
@@
describe('metaWidget', function() {
var dom = $('<div>');
var widget = metaWidget.create({
el: dom,
var dom = $('<div>');
var widget = metaWidget.create({
el: dom,
- attrs:
[{name: 'uri', type: 'string', value: 'test string'}]
,
+ attrs:
{'uri': {type: 'string', value: 'test string'}}
,
});
var spy = sinon.spy();
});
var spy = sinon.spy();
diff --git
a/src/editor/modules/nodePane/nodePane.js
b/src/editor/modules/nodePane/nodePane.js
index
5b4f80e
..
7473c2e
100644
(file)
--- a/
src/editor/modules/nodePane/nodePane.js
+++ b/
src/editor/modules/nodePane/nodePane.js
@@
-36,7
+36,7
@@
return function(sandbox) {
var widget = metaWidget.create({attrs:wlxmlNodeElement.getMetaAttributes()});
widget.on('valueChanged', function(key, value) {
var widget = metaWidget.create({attrs:wlxmlNodeElement.getMetaAttributes()});
widget.on('valueChanged', function(key, value) {
-
sandbox.publish('nodeElementChange',
key, value);
+
wlxmlNodeElement.setMetaAttribute(
key, value);
});
view.find('.metaFields').empty().append(widget.el);
});
view.find('.metaFields').empty().append(widget.el);