X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/e0f595e44766e352edfce0aaf5d32be57f448882..491078616e2129745f300c1f0357f5bac52e801d:/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 51f26d50..dde914fc 100644 --- a/src/redakcja/static/js/wiki/view_properties.js +++ b/src/redakcja/static/js/wiki/view_properties.js @@ -35,7 +35,10 @@ "name": "href", }, ], - } + "tab": {"attributes": [{"name": "szer"}]}, + "naglowek_parsza": {"attributes": [{"name": "nazwa"}]}, + "naglowek_czytanie": {"attributes": [{"name": "nazwa"}]} + }, }; class PropertiesPerspective extends $.wiki.SidebarPerspective { @@ -139,6 +142,9 @@ rdfdesc.append('\n '); rdf.append('\n '); } + if (field.filter && field.filter.startswith) { + span.text(field.filter.startswith[0]); + } span.appendTo(rdfdesc); rdfdesc.append('\n '); @@ -230,6 +236,7 @@ $.ajax({ url: field.value_type.chooser.source, + data: field.filter ? {'filter': JSON.stringify(field.filter)} : '', success: function(data) { add_options(body, data, input.val()); } @@ -384,6 +391,18 @@ // lang } + applyFilter(filter, text) { + if (filter.not) { + return !this.applyFilter(filter.not, text) + } else if (filter.startswith) { + for (prefix of filter.startswith) { + if (text.startsWith(prefix)) + return true; + } + return false; + } + } + displayMetaProperty($fg) { let self = this; let ns = $fg.data('ns'); @@ -398,6 +417,11 @@ selector += "[x-ns='"+ns+"']"; } $(selector, self.$edited).each(function() { + if (field.filter) { + let text = $(this).text(); + if (!self.applyFilter(field.filter, text)) + return; + } self.addMetaInput( $('.c', $fg), field,