');
+ elem.append(subT);
+ elem.append(sub);
+ subT.on('click', () => {
+ sub.toggle()
+ });
+ add_options(sub, item.sub, valueMatch ? value : null);
+ }
+ elem.appendTo(cnt);
+ });
+ };
- $f = $("#properties-form", self.$pane);
- $f.empty();
+ $.ajax({
+ url: field.value_type.chooser.source,
+ data: field.filter ? {'filter': JSON.stringify(field.filter)} : '',
+ success: function(data) {
+ add_options(body, data, input.val());
+ }
+ });
+ })
+ $('#meta-chooser .ctrl-ok').on('click', function (event) {
+ $('#meta-chooser').data('target-input').val(
+ $('#meta-chooser :checked').val()
+ ).trigger('change');
+ $('#meta-chooser').modal('hide');
+ });
- if (element === null) {
- self.$edited = null;
- return;
+ self.$pane.on('click', '.current-convert', function() {
+ self.convert($(this).attr('data-to'));
+ });
+ self.$pane.on('click', '#current-delete', function() {
+ self.delete();
+ });
}
- let $node = $(element);
- let b = $("
").text($node.attr('x-node'));
- b.data('node', element);
- $("#bubbles").append(b);
+ edit(element) {
+ let self = this;
- $node.parents('[x-node]').each(function() {
- let a = $("
").text($(this).attr('x-node'));
- a.data('node', this);
- $("#parents", self.$pane).prepend(a)
+ $("#parents", self.$pane).empty();
+ $("#bubbles").empty();
- let b = $("").text($(this).attr('x-node'));
- b.data('node', this);
- $("#bubbles").append(b);
- })
+ let $f = $("#properties-form", self.$pane);
+ $f.empty();
+
+ if (element === null) {
+ self.$edited = null;
+ $("h1", self.$pane).text('');
+ return;
+ }
- // It's a tag.
- node = $(element).attr('x-node');
- $("h1", self.$pane).text(node);
+ let $node = $(element);
+ let b = $("").text($node.attr('x-node'));
+ b.data('node', element);
+ $("#bubbles").append(b);
- self.$edited = $(element);
+ $node.parents('[x-node]').each(function() {
+ let a = $("").text($(this).attr('x-node'));
+ a.data('node', this);
+ $("#parents", self.$pane).prepend(a)
- let nodeDef = elementDefs[node];
- if (nodeDef && nodeDef.attributes) {
- $.each(nodeDef.attributes, function(i, a) {
- self.addEditField(a, $(element).attr('x-a-wl-' + a.name)); // ...
+ let b = $("").text($(this).attr('x-node'));
+ b.data('node', this);
+ $("#bubbles").append(b);
})
- }
- // Only utwor can has matadata now.
- if (node == 'utwor') {
- $('
').appendTo($("#properties-form", self.$pane))
- META_FIELDS.forEach(function(field) {
- let $fg = $("