X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/634abe44a671e272552f0016155211ae91be09de..e6c778f6e92e584815a14d3e6a31a03a5e2ab7e1:/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 9fa1c9d2..3d30fd32 100644 --- a/src/redakcja/static/js/wiki/view_properties.js +++ b/src/redakcja/static/js/wiki/view_properties.js @@ -163,7 +163,7 @@ 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() { + 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'); }); @@ -178,6 +178,65 @@ $('#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 = $('