X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/008b2c8d44987a6ef6b405ffc2124f28d3c6220d..a9b4700e3cd649a6dddc3b72dc0bd632f7841c74:/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 eeddf678..1fff64fe 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,18 @@ pp.appendTo(ig); } - let $aninput = $(""); + let $aninput; + if (field.value_type.widget == 'select') { + $aninput = $(""); + if (field.value_type.autocomplete) { + $aninput.autocomplete(field.value_type.autocomplete); + } + } $aninput.data('edited', $(element)) $aninput.val( $(element).text() @@ -266,13 +292,24 @@ // clear container $('.c', $fg).empty(); - - $("> [x-node='RDF'] > [x-node='Description'] > [x-node='"+tag+"'][x-ns='"+ns+"']", self.$edited).each(function() { + + let selector = "> [x-node='RDF'] > [x-node='Description'] > [x-node='"+tag+"']"; + if (ns) { + selector += "[x-ns='"+ns+"']"; + } + $(selector, self.$edited).each(function() { self.addMetaInput( $('.c', $fg), field, this); }); + + count = $('.c > .input-group', $fg).length; + if (field.required) { + if (!count) { + $('
WYMAGANE
').appendTo($('.c', $fg)); + } + } };