fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Maint
[redakcja.git]
/
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
51f26d5
..
be027e0
100644
(file)
--- a/
src/redakcja/static/js/wiki/view_properties.js
+++ b/
src/redakcja/static/js/wiki/view_properties.js
@@
-1,8
+1,5
@@
(function($){
(function($){
- let w = function() {};
- w = console.log;
-
const elementDefs = {
"ilustr": {
"attributes": [
const elementDefs = {
"ilustr": {
"attributes": [
@@
-35,7
+32,10
@@
"name": "href",
},
],
"name": "href",
},
],
- }
+ "tab": {"attributes": [{"name": "szer"}]},
+ "naglowek_parsza": {"attributes": [{"name": "nazwa"}]},
+ "naglowek_czytanie": {"attributes": [{"name": "nazwa"}]}
+ },
};
class PropertiesPerspective extends $.wiki.SidebarPerspective {
};
class PropertiesPerspective extends $.wiki.SidebarPerspective {
@@
-86,17
+86,11
@@
html2text({
element: self.$edited[0],
success: function(xml) {
html2text({
element: self.$edited[0],
success: function(xml) {
- w(222)
let $xmlelem = $($.parseXML(xml));
let $xmlelem = $($.parseXML(xml));
- w(333, $xmlelem)
- w($input.data('property'), $input.val());
$xmlelem.contents().attr($input.data('property'), inputval);
$xmlelem.contents().attr($input.data('property'), inputval);
- w(444, $xmlelem)
let newxml = (new XMLSerializer()).serializeToString($xmlelem[0]);
let newxml = (new XMLSerializer()).serializeToString($xmlelem[0]);
- w(555, newxml)
xml2html({
xml: newxml,
xml2html({
xml: newxml,
- base: self.doc.getBase(),
success: function(html) {
let htmlElem = $(html);
self.$edited.replaceWith(htmlElem);
success: function(html) {
let htmlElem = $(html);
self.$edited.replaceWith(htmlElem);
@@
-139,6
+133,9
@@
rdfdesc.append('\n ');
rdf.append('\n ');
}
rdfdesc.append('\n ');
rdf.append('\n ');
}
+ if (field.filter && field.filter.startswith) {
+ span.text(field.filter.startswith[0]);
+ }
span.appendTo(rdfdesc);
rdfdesc.append('\n ');
span.appendTo(rdfdesc);
rdfdesc.append('\n ');
@@
-165,7
+162,7
@@
self.doc.refreshImageGallery({
success: function(galleryImages) {
self.doc.refreshImageGallery({
success: function(galleryImages) {
- $.each(
self.doc.
galleryImages, (i, imgItem) => {
+ $.each(galleryImages, (i, imgItem) => {
let img = $("<img>").attr("src", imgItem.thumb).attr('title', imgItem.url).data('url', imgItem.url).on('click', function() {
imglist.find('img').removeClass('active');
$(this).addClass('active');
let img = $("<img>").attr("src", imgItem.thumb).attr('title', imgItem.url).data('url', imgItem.url).on('click', function() {
imglist.find('img').removeClass('active');
$(this).addClass('active');
@@
-230,6
+227,7
@@
$.ajax({
url: field.value_type.chooser.source,
$.ajax({
url: field.value_type.chooser.source,
+ data: field.filter ? {'filter': JSON.stringify(field.filter)} : '',
success: function(data) {
add_options(body, data, input.val());
}
success: function(data) {
add_options(body, data, input.val());
}
@@
-384,6
+382,18
@@
// lang
}
// 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');
displayMetaProperty($fg) {
let self = this;
let ns = $fg.data('ns');
@@
-398,6
+408,11
@@
selector += "[x-ns='"+ns+"']";
}
$(selector, self.$edited).each(function() {
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,
self.addMetaInput(
$('.c', $fg),
field,