X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/f8eb70938e6ea3b3c4fac5e2f55df26fcaf21b48..fd9164545d4a1cf2d508b4125a45643a0b8375fa:/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 a3fe4323..be027e02 100644
--- a/src/redakcja/static/js/wiki/view_properties.js
+++ b/src/redakcja/static/js/wiki/view_properties.js
@@ -1,8 +1,5 @@
(function($){
- let w = function() {};
- w = console.log;
-
const elementDefs = {
"ilustr": {
"attributes": [
@@ -35,7 +32,10 @@
"name": "href",
},
],
- }
+ "tab": {"attributes": [{"name": "szer"}]},
+ "naglowek_parsza": {"attributes": [{"name": "nazwa"}]},
+ "naglowek_czytanie": {"attributes": [{"name": "nazwa"}]}
+ },
};
class PropertiesPerspective extends $.wiki.SidebarPerspective {
@@ -86,17 +86,11 @@
html2text({
element: self.$edited[0],
success: function(xml) {
- w(222)
let $xmlelem = $($.parseXML(xml));
- w(333, $xmlelem)
- w($input.data('property'), $input.val());
$xmlelem.contents().attr($input.data('property'), inputval);
- w(444, $xmlelem)
let newxml = (new XMLSerializer()).serializeToString($xmlelem[0]);
- w(555, newxml)
xml2html({
xml: newxml,
- base: self.doc.getBase(),
success: function(html) {
let htmlElem = $(html);
self.$edited.replaceWith(htmlElem);
@@ -139,6 +133,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 ');
@@ -149,7 +146,8 @@
self.$pane.on('click', '.meta-delete', function() {
let $fg = $(this).closest('.form-group');
- $('input', $fg).data('edited').remove();
+ let $ig = $(this).closest('.input-group');
+ $('input', $ig).data('edited').remove();
self.displayMetaProperty($fg);
$.wiki.perspectives.VisualPerspective.flush();
return false;
@@ -161,12 +159,17 @@
modal.data('target-input', input);
var imglist = modal.find('.modal-body');
imglist.html('');
- $.each(self.doc.galleryImages, (i, imgItem) => {
- img = $("").attr("src", imgItem.thumb).attr('title', imgItem.url).data('url', imgItem.url).on('click', function() {
- imglist.find('img').removeClass('active');
- $(this).addClass('active');
- });
- imglist.append(img);
+
+ self.doc.refreshImageGallery({
+ success: function(galleryImages) {
+ $.each(galleryImages, (i, imgItem) => {
+ let img = $("
").attr("src", imgItem.thumb).attr('title', imgItem.url).data('url', imgItem.url).on('click', function() {
+ imglist.find('img').removeClass('active');
+ $(this).addClass('active');
+ });
+ imglist.append(img);
+ });
+ }
});
})
$('#media-chooser .ctrl-ok').on('click', function (event) {
@@ -177,6 +180,66 @@
$('#media-chooser').modal('hide');
});
+ /* Meta chooser */
+ $('#meta-chooser').on('show.bs.modal', function (event) {
+ let input = $("input", $(event.relatedTarget).closest('.input-group'));
+ let $fg = $(event.relatedTarget).closest('.form-group');
+ let field = $fg.data('field');
+ let modal = $(this);
+ modal.data('target-input', input);
+ let body = modal.find('.modal-body');
+ body.html('');
+
+ let add_options = function(cnt, options, value) {
+ $.each(options, (i, item) => {
+ let elem = $('