X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/4a6513cd9ed9d66351b8973d3455204aad684fb5..eadb2822a6c87ac0f1ad3e529747c8e2cff14ae7:/src/redakcja/static/js/wiki/view_properties.js diff --git a/src/redakcja/static/js/wiki/view_properties.js b/src/redakcja/static/js/wiki/view_properties.js index a7caf10a..fd53f041 100644 --- a/src/redakcja/static/js/wiki/view_properties.js +++ b/src/redakcja/static/js/wiki/view_properties.js @@ -119,9 +119,24 @@ if (field.value_type.hasLanguage) { span.attr('x-a-xml-lang', 'pl'); } - span.appendTo( - $("> [x-node='RDF'] > [x-node='Description']", self.$edited) - ); + + rdf = $("> [x-node='RDF']", self.$edited); + if (!rdf.length) { + rdf = $(""); + self.$edited.prepend(rdf); + self.$edited.prepend('\n '); + + } + rdfdesc = $("> [x-node='Description']", rdf); + if (!rdfdesc.length) { + rdfdesc = $(""); + rdf.prepend(rdfdesc); + rdf.prepend('\n '); + rdfdesc.append('\n '); + rdf.append('\n '); + } + span.appendTo(rdfdesc); + rdfdesc.append('\n '); self.displayMetaProperty($fg); @@ -243,7 +258,26 @@ pp.appendTo(ig); } - let $aninput = $(""); + let $aninput; + if (field.value_type.widget == 'select') { + $aninput = $(""); + if (field.value_type.autocomplete) { + let autoOptions = field.value_type.autocomplete; + $aninput.autocomplete(autoOptions).autocomplete('instance')._renderItem = function(ul, item) { + let t = item.label; + if (item.name) t += '
' + item.name + ''; + if (item.description) t += '
' + item.description + ''; + return $( "
  • " ) + .append( "
    " + t + "
    " ) + .appendTo( ul ); + }; + } + } $aninput.data('edited', $(element)) $aninput.val( $(element).text()