X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/634abe44a671e272552f0016155211ae91be09de..11135898543370ecf4ffa95dbea14cba4c33f57c:/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 9fa1c9d2..7101c5cf 100644 --- a/src/redakcja/static/js/wiki/view_properties.js +++ b/src/redakcja/static/js/wiki/view_properties.js @@ -139,6 +139,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 '); @@ -162,12 +165,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) { @@ -178,6 +186,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 = $('
'); + if (!item.usable) { + $('input', elem).remove(); + } + if (item.hidden) { + $('input', elem).prop('disabled', 'disabled'); + } + $('input', elem).val(item.value); + $('input', elem).val(item.value); + $('.value', elem).text(item.value); + $('.name', elem).append(item.name); + $('.description', elem).append(item.description); + let valueMatch = value && value.startsWith(item.value); + if (valueMatch) { + $('label', elem).addClass('text-primary') + if (value == item.value) { + $('input', elem).prop('checked', true); + } + } + if (item.sub) { + let subT = $(' '); + let sub = $('