From 4cab8b0725fd5a88f5a508e584b4acd346a824fc Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 27 Jun 2023 12:02:46 +0200 Subject: [PATCH] Image chooser. --- src/cover/views.py | 2 +- src/documents/models/book.py | 2 +- src/redakcja/settings/__init__.py | 2 + src/redakcja/static/css/html.scss | 10 ++ src/redakcja/static/img/sample_cover.png | Bin 11750 -> 3487 bytes src/redakcja/static/js/wiki/view_gallery.js | 2 +- .../static/js/wiki/view_properties.js | 43 ++++- src/wiki/locale/pl/LC_MESSAGES/django.mo | Bin 4077 -> 4110 bytes src/wiki/locale/pl/LC_MESSAGES/django.po | 160 +++++++++--------- src/wiki/templates/wiki/document_details.html | 35 ++-- src/wiki/templates/wiki/media_dialog.html | 13 ++ src/wiki/views.py | 11 +- 12 files changed, 173 insertions(+), 107 deletions(-) create mode 100644 src/wiki/templates/wiki/media_dialog.html diff --git a/src/cover/views.py b/src/cover/views.py index e89e7962..d00123cc 100644 --- a/src/cover/views.py +++ b/src/cover/views.py @@ -22,7 +22,7 @@ from cover import forms from cover.utils import get_import_data -PREVIEW_SIZE = (216, 300) +PREVIEW_SIZE = (212, 300) def preview(request, book, chunk=None, rev=None): diff --git a/src/documents/models/book.py b/src/documents/models/book.py index 1b34fb64..f40af29b 100644 --- a/src/documents/models/book.py +++ b/src/documents/models/book.py @@ -399,7 +399,7 @@ class Book(models.Model): self.build_cover() def build_cover(self): - width, height = 216, 300 + width, height = 212, 300 try: xml = self.materialize(publishable=True).encode('utf-8') info = BookInfo.from_bytes(xml) diff --git a/src/redakcja/settings/__init__.py b/src/redakcja/settings/__init__.py index 6e705f1f..70512cb5 100644 --- a/src/redakcja/settings/__init__.py +++ b/src/redakcja/settings/__init__.py @@ -125,6 +125,8 @@ LEGIMI_BIG_WORDS = 10000 LEGIMI_SMALL_PRICE = 7 LEGIMI_BIG_PRICE = 20 +THUMBNAIL_PRESERVE_FORMAT = True + STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', diff --git a/src/redakcja/static/css/html.scss b/src/redakcja/static/css/html.scss index cfd7fc2d..881083a6 100644 --- a/src/redakcja/static/css/html.scss +++ b/src/redakcja/static/css/html.scss @@ -538,3 +538,13 @@ div[x-node] > .uwaga { border:0; color: black; } + + +#media-chooser { + img { + border: 3px solid transparent; + &.active { + border-color: green; + } + } +} diff --git a/src/redakcja/static/img/sample_cover.png b/src/redakcja/static/img/sample_cover.png index f7a678e495b55f92834c03bdb50315068bd6a97b..355a82db4153aee06db34ec95f2c4948a6876583 100644 GIT binary patch literal 3487 zcmeH~c{CgN7RSxj_Gvpzm!Y*yUsY|TYDq0&S~H_)qm7KTiKUflsp5Hy^cR%;ubI(n` z3i3Fpd0bONL*t<5r60h%=X(u}&n)+SzI(IN)Xdqn-|_t60wlgzIx&Gh0!{8*L4z

{ z24VEULEUg(K=8xxh`E0*KInc@tubZ)0^gN~JX=U^y`(H4WdnUk{5rJ&;%cOdnd@kaD4mTgPq z_UQ_WEecMOikA}FMZnez*RXSXrF6N*z5AzSw|haYPX|5rYX9YXLm;B(!uo zP8qy2NB0UP9YR&2H-40j`4U{)ae_FLlB)hkKm#djG-5}g>bVoW0e0*Y-jLU6tljH& zB4|E%I)s%#DU)>(1AojjFOnz6xGy}@PBt%vW63B*XMZ!>qy$}qE$rA>+;Bl?b`Pg# zLKC@-gfdgSMKz4TYXPi?o7x|TIn_r*n~1PPYz3>V>8-+d7*_PPZxktdd-20+_kcx# zomwo#5F7w|+A+aOfjiP_);k0dBa1$8)@aRT=4yKESj=l$%EP4up=pb)jjTLi0y(!z zL#Lj~&gA%jbTUZaEvIX(0S5DZPN#>z>W85Q0~m4@!X0zE5;>>Yj>HFTvF4Stm_32D z{S}8%)gEw(Vb$^*=JW&3lM<|weAV{b`%S8gSjmhnYcGg6@Mxx?dqD7x_EQo5Xn#&| zYs|_xMON)sQ2ybrw79>5)v11Kt_&r>$fkJdR$??Kl|22j^5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-24wcZZGP|Puk9xW%0MthcjtuD%&%ha zWZ}HzM?gP)&3-fuHqPKA+9gV1)HG(pwDd8R=A#XqKOyshg9t?|UQe6v3JR(NjMa}v*o%wpRY6fn^Mwl2{oGZ}>BmM{CPQRl7 diff --git a/src/redakcja/static/js/wiki/view_gallery.js b/src/redakcja/static/js/wiki/view_gallery.js index e04342ff..5152f439 100644 --- a/src/redakcja/static/js/wiki/view_gallery.js +++ b/src/redakcja/static/js/wiki/view_gallery.js @@ -150,7 +150,7 @@ newPage = normalizeNumber(newPage, this.doc.galleryImages.length); this.$numberInput.val(newPage); this.config().page = newPage; - $('.gallery-image img', this.$element).attr('src', this.doc.galleryImages[newPage - 1]); + $('.gallery-image img', this.$element).attr('src', this.doc.galleryImages[newPage - 1].url); }; ScanGalleryPerspective.prototype.alterZoom = function(delta){ diff --git a/src/redakcja/static/js/wiki/view_properties.js b/src/redakcja/static/js/wiki/view_properties.js index 204a4dec..54051737 100644 --- a/src/redakcja/static/js/wiki/view_properties.js +++ b/src/redakcja/static/js/wiki/view_properties.js @@ -8,6 +8,7 @@ "attributes": [ { "name": "src", + "type": "media", }, { "name": "alt", @@ -151,6 +152,26 @@ }); + $('#media-chooser').on('show.bs.modal', function (event) { + var input = $("input", $(event.relatedTarget).parent()); + var modal = $(this); + modal.data('target-input', input); + var imglist = modal.find('.modal-body'); + $.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); + }); + }) + $('#media-chooser .ctrl-ok').on('click', function (event) { + $('#media-chooser').data('target-input') + .val( + (new URL($('#media-chooser .active').data('url'), document.baseURI)).href + ).trigger('change'); + $('#media-chooser').modal('hide'); + }); self.$pane.on('click', '.current-convert', function() { self.convert($(this).attr('data-to')); @@ -334,22 +355,28 @@ let $fg = $("

"); $("