1. b7w
  2. bviewer

Commits

b7w  committed e21b5c7

Image popup in profile list images

  • Participants
  • Parent commits 426c0c3
  • Branches dev

Comments (0)

Files changed (2)

File bviewer/profile/admin.py

View file
  • Ignore whitespace
     list_select_related = True
     actions = [bulk_time_update, update_time_from_exif, ]
 
-    list_display = ('path', 'file_name', 'gallery_title', 'time', )
+    list_display = ('path', 'file_name', 'gallery_title', 'image_thumbnail_popup', 'time', )
     list_filter = ('gallery__title', 'time',)
     ordering = ('-time', 'gallery', )
 
 
     image_thumbnail.allow_tags = True
 
+    def image_thumbnail_popup(self, obj):
+        url = reverse('core.download', kwargs=dict(size='tiny', uid=obj.id))
+        return smart_text('<img class="preview" src="{0}">').format(url)
+
+    image_thumbnail_popup.allow_tags = True
+
     def queryset(self, request):
         return super(ProfileImageAdmin, self).queryset(request).filter(gallery__user=request.user)
 
             kwargs['queryset'] = Gallery.objects.filter(user=request.user)
         return super(ProfileImageAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
 
+    class Media:
+        css = {
+            'all': ('profile/css/profile.css',)
+        }
+        js = ('my_code.js',)
+
 
 profile.register(Image, ProfileImageAdmin)
 

File bviewer/profile/static/profile/css/profile.css

View file
  • Ignore whitespace
 
 .thumbnails li:hover .caption {
     opacity: 1;
-}
+}
+
+.preview {
+    width: 32px;
+    height: 32px;
+}
+
+.preview:hover {
+    width: auto;
+    height: auto;
+}