X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/28866d0f2520b7515f3c06e9b61bcce4f44d53b1..3ca475c8e10c811633dec531772e18da6e5fa33d:/src/wiki/views.py diff --git a/src/wiki/views.py b/src/wiki/views.py index 062a5664..aea44390 100644 --- a/src/wiki/views.py +++ b/src/wiki/views.py @@ -21,6 +21,7 @@ from django.shortcuts import get_object_or_404, render from sorl.thumbnail import get_thumbnail from documents.models import Book, Chunk +import sources.models from . import nice_diff from wiki import forms from wiki.helpers import (JSONResponse, JSONFormInvalid, JSONServerError, @@ -250,6 +251,19 @@ def gallery(request, directory): raise http.Http404 +@never_cache +def scans_list(request, pk): + bs = get_object_or_404(sources.models.BookSource, pk=pk) + def map_to_url(filename): + return quote(("%s/%s" % (settings.MEDIA_URL, filename))) + images = [ + { + "url": map_to_url(f), + } for f in bs.get_view_files() + ] + return JSONResponse(images) + + @never_cache def diff(request, chunk_id): revA = int(request.GET.get('from', 0)) @@ -307,7 +321,7 @@ def history(request, chunk_id): "description": change.description, "author": change.author_str(), "date": localize(change.created_at), - "publishable": _("Publishable") + "\n" if change.publishable else "", + "publishable": change.publishable, "tag": ',\n'.join(str(tag) for tag in change.tags.all()), "published": _("Published") + ": " + \ localize(change.publish_log.order_by('-book_record__timestamp')[0].book_record.timestamp) \