X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/88e7597e91bb03364d7846b160ff0b38b97c1be6..92d4704c889df1405c4d2c34e1fce5e5c1ced680:/src/redakcja/static/js/wiki/view_properties.js?ds=inline diff --git a/src/redakcja/static/js/wiki/view_properties.js b/src/redakcja/static/js/wiki/view_properties.js index e6ad1ca2..eeddf678 100644 --- a/src/redakcja/static/js/wiki/view_properties.js +++ b/src/redakcja/static/js/wiki/view_properties.js @@ -46,7 +46,7 @@ self.$pane = $("#side-properties"); - $(document).on('click', '[x-node]', function(e) { + $("#simple-editor").on('click', '[x-node]', function(e) { if (!e.redakcja_edited) { e.redakcja_edited = true; self.edit(this); @@ -57,6 +57,10 @@ self.edit($(this).data('node')); }); + $(document).on('click', '#bubbles .badge', function(e) { + self.edit($(this).data('node')); + }); + self.$pane.on('change', '.form-control', function() { let $input = $(this); @@ -68,7 +72,11 @@ } if ($input.data("edited")) { - $input.data("edited").text(inputval); + if ($input.data("edited-attr")) { + $input.data("edited").attr($input.data("edited-attr"), inputval); + } else { + $input.data("edited").text(inputval); + } return; } @@ -97,6 +105,45 @@ }); self.$edited; }); + + + self.$pane.on('click', '.meta-add', function() { + // create a metadata item + let $fg = $(this).parent(); + let ns = $fg.data('ns'); + let tag = $fg.data('tag'); + let field = $fg.data('field'); + let span = $(''); + span.attr('x-node', tag); + span.attr('x-ns', ns) + if (field.value_type.hasLanguage) { + span.attr('x-a-xml-lang', 'pl'); + } + span.appendTo( + $("> [x-node='RDF'] > [x-node='Description']", self.$edited) + ); + + self.displayMetaProperty($fg); + + return false; + }); + + self.$pane.on('click', '.meta-delete', function() { + let $fg = $(this).closest('.form-group'); + $('input', $fg).data('edited').remove(); + self.displayMetaProperty($fg); + return false; + }); + + + + self.$pane.on('click', '.current-convert', function() { + self.convert($(this).attr('data-to')); + }); + self.$pane.on('click', '#current-delete', function() { + self.delete(); + }); + oldCallback.call(this); }; @@ -111,11 +158,22 @@ let $node = $(element); $("#parents", self.$pane).empty(); + $("#bubbles").empty(); + + let b = $("
").text($node.attr('x-node')); + b.data('node', element); + $("#bubbles").append(b); + $node.parents('[x-node]').each(function() { let a = $("