X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/573b9004c7bc2a6a2b29335155b4ff55d142c6b6..491078616e2129745f300c1f0357f5bac52e801d:/src/redakcja/static/js/wiki/view_properties.js?ds=inline
diff --git a/src/redakcja/static/js/wiki/view_properties.js b/src/redakcja/static/js/wiki/view_properties.js
index 5c4c0e8b..dde914fc 100644
--- a/src/redakcja/static/js/wiki/view_properties.js
+++ b/src/redakcja/static/js/wiki/view_properties.js
@@ -35,11 +35,15 @@
                     "name": "href",
                 },
             ],
-        }
+            "tab": {"attributes": [{"name": "szer"}]},
+            "naglowek_parsza": {"attributes": [{"name": "nazwa"}]},
+            "naglowek_czytanie": {"attributes": [{"name": "nazwa"}]}
+        },
     };
 
     class PropertiesPerspective extends $.wiki.SidebarPerspective {
         vsplitbar = 'WÅAÅCIWOÅCI';
+        $edited = null;
 
         constructor(options) {
             super(options);
@@ -78,6 +82,7 @@
                         } else {
                             $input.data("edited").text(inputval);
                         }
+                        $.wiki.perspectives.VisualPerspective.flush();
                         return;
                     }
 
@@ -99,6 +104,7 @@
                                     let htmlElem = $(html);
                                     self.$edited.replaceWith(htmlElem);
                                     self.edit(htmlElem);
+                                    $.wiki.activePerspective().flush();
                                 }
                             });
                         },
@@ -136,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    ');
 
@@ -146,8 +155,10 @@
 
                 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;
                 });
 
@@ -157,12 +168,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(self.doc.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) {
@@ -173,6 +189,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 = $('