X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/9437f74bdc87107e38ca37f21d7d74579ad6f2aa..75394bbfb6d76eb2ac7ee3adf9529528f8f3bf50:/src/redakcja/static/js/wiki/view_properties.js?ds=sidebyside

diff --git a/src/redakcja/static/js/wiki/view_properties.js b/src/redakcja/static/js/wiki/view_properties.js
index 7e284a50..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 = $("<span x-node='RDF' x-ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>");
+                    self.$edited.prepend(rdf); 
+                    self.$edited.prepend('\n  ');
+                   
+                }
+                rdfdesc = $("> [x-node='Description']", rdf);
+                if (!rdfdesc.length) {
+                    rdfdesc = $("<span x-node='Description' x-ns='http://www.w3.org/1999/02/22-rdf-syntax-ns#' x-a-rdf-about='" + self.doc.fullUri + "'>");
+                    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 = $("<input class='form-control'>");
+        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()
@@ -266,8 +292,12 @@
 
         //  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,