+ PropertiesPerspective.prototype.addMetaInput = function(cont, field, element) {
+ let self = this;
+
+ let ig = $('<div class="input-group">');
+ //ig.data('edited', element);
+ ig.appendTo(cont);
+
+ if (field.value_type.hasLanguage) {
+ let pp = $("<div class='input-group-prepend'>");
+ let lang_input = $("<input class='form-control' size='1' class='lang'>");
+ lang_input.data('edited', $(element));
+ lang_input.data('edited-attr', 'x-a-xml-lang');
+ lang_input.val(
+ $(element).attr('x-a-xml-lang')
+ );
+ lang_input.appendTo(pp);
+ pp.appendTo(ig);
+ }
+
+ let $aninput;
+ if (field.value_type.widget == 'select') {
+ $aninput = $("<select class='form-control'>");
+ $.each(field.value_type.options, function() {
+ $("<option>").text(this).appendTo($aninput);
+ })
+ } else {
+ $aninput = $("<input class='form-control'>");
+ if (field.value_type.autocomplete) {
+ $aninput.autocomplete(field.value_type.autocomplete);
+ }
+ }
+ $aninput.data('edited', $(element))
+ $aninput.val(
+ $(element).text()
+ );
+ $aninput.appendTo(ig);
+
+ let ap = $("<div class='input-group-append'>");
+ ap.appendTo(ig);
+ $("<button class='meta-delete btn btn-outline-secondary'>x</button>").appendTo(ap);
+
+ // lang
+ };
+
+
+ PropertiesPerspective.prototype.displayMetaProperty = function($fg) {
+ let self = this;
+ let ns = $fg.data('ns');
+ let tag = $fg.data('tag');
+ let field = $fg.data('field');
+
+ // clear container
+ $('.c', $fg).empty();
+
+ 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) {
+ $('<div class="text-warning">WYMAGANE</div>').appendTo($('.c', $fg));
+ }
+ }
+ };
+