Thema extension proposal.
[redakcja.git] / src / cover / views.py
index 82bc911..5ea4a6c 100644 (file)
@@ -65,7 +65,11 @@ def preview(request, book, chunk=None, rev=None):
 
     cover_class = request.GET.get('cover_class', 'default')
 
 
     cover_class = request.GET.get('cover_class', 'default')
 
-    cover = make_cover(info, cover_class=cover_class, width=width, height=height)
+    kwargs = {}
+    if chunk.book.project is not None:
+        if chunk.book.project.logo_mono or chunk.book.project.logo:
+            kwargs['cover_logo'] = (chunk.book.project.logo_mono or chunk.book.project.logo).path
+    cover = make_cover(info, cover_class=cover_class, width=width, height=height, **kwargs)
     response = HttpResponse(content_type=cover.mime_type())
     img = cover.final_image()
     img.save(response, cover.format)
     response = HttpResponse(content_type=cover.mime_type())
     img = cover.final_image()
     img.save(response, cover.format)
@@ -105,6 +109,11 @@ def image(request, pk):
 
     if not request.accepts('text/html') and request.accepts('application/json') or request.GET.get('format') == 'json':
         return JsonResponse({
 
     if not request.accepts('text/html') and request.accepts('application/json') or request.GET.get('format') == 'json':
         return JsonResponse({
+            'title': img.title,
+            'author': img.author,
+            'license_name': img.license_name,
+            'license_url': img.license_url,
+            'source_url': img.source_url,
             'attribution': img.attribution,
             'cut_left': img.cut_left,
             'cut_right': img.cut_right,
             'attribution': img.attribution,
             'cut_left': img.cut_left,
             'cut_right': img.cut_right,