diff options
Diffstat (limited to 'app/photos')
-rw-r--r-- | app/photos/models.py | 4 | ||||
-rw-r--r-- | app/photos/static/image-preview.js | 1 | ||||
-rw-r--r-- | app/photos/static/my_styles.css | 38 | ||||
-rw-r--r-- | app/photos/urls.py | 5 | ||||
-rw-r--r-- | app/photos/views.py | 10 |
5 files changed, 56 insertions, 2 deletions
diff --git a/app/photos/models.py b/app/photos/models.py index 557b9a0..0e5b0e4 100644 --- a/app/photos/models.py +++ b/app/photos/models.py @@ -120,7 +120,7 @@ class LuxImage(models.Model): s = LuxImageSize.objects.get(name=size) if s not in self.sizes.all(): print("new size is "+s.name) - self.sizes.add(s) + self.sizes.add(s) return "%s%s/%s_%s.%s" % (settings.IMAGES_URL, self.pub_date.strftime("%Y"), base, size, self.get_image_ext()) def get_image_path_by_size(self, size="original"): @@ -141,7 +141,7 @@ class LuxImage(models.Model): @property def longitude(self): return self.point.x - + @property def get_previous_published(self): return self.get_previous_by_pub_date() diff --git a/app/photos/static/image-preview.js b/app/photos/static/image-preview.js index b46dbd8..b8fead5 100644 --- a/app/photos/static/image-preview.js +++ b/app/photos/static/image-preview.js @@ -36,6 +36,7 @@ function build_image_preview () { return; } } + document.addEventListener("DOMContentLoaded", function(event) { build_image_preview(); }); diff --git a/app/photos/static/my_styles.css b/app/photos/static/my_styles.css new file mode 100644 index 0000000..986c8e6 --- /dev/null +++ b/app/photos/static/my_styles.css @@ -0,0 +1,38 @@ + +/*o.v.*/ + +#id_featured_image { + /*style the "box" in its minimzed state*/ + border:1px solid black; width:230px; overflow:hidden; + height:300px; overflow-y:scroll; + /*animate collapsing the dropdown from open to closed state (v. fast)*/ +} +#id_featured_image input { + /*hide the nasty default radio buttons. like, completely!*/ + position:absolute;top:0;left:0;opacity:0; +} + + +#id_featured_image label { + /*style the labels to look like dropdown options, kinda*/ + color: #000; + display:none; + margin: 2px 2px 2px 10px; + height:102px; + opacity:.6; + background-repeat: no-repeat; +} +#id_featured_image:hover label{ + /*this is how labels render in the "expanded" state. we want to see only the selected radio button in the collapsed menu, and all of them when expanded*/ + display:block; +} +#id_featured_image label:hover { + opacity:.8; +} +#id_featured_image input:checked + label { + /*tricky! labels immediately following a checked radio button (with our markup they are semantically related) should be fully opaque regardless of hover, and they should always be visible (i.e. even in the collapsed menu*/ + opacity:1 !important; display:block; +} + +/*pfft, nothing as cool here, just the value trace*/ +#trace {margin:0 0 20px;} diff --git a/app/photos/urls.py b/app/photos/urls.py index 7be732d..1da29a6 100644 --- a/app/photos/urls.py +++ b/app/photos/urls.py @@ -16,6 +16,11 @@ urlpatterns = [ name="admin_image_preview" ), url( + r'data/admin/tn/(?P<pk>\d+)/$', + views.thumb_preview_json, + name="admin_thumb_preview" + ), + url( r'galleries/private/(?P<slug>[-\w]+)$', views.PrivateGallery.as_view(), name="private" diff --git a/app/photos/views.py b/app/photos/views.py index d2ecd39..0d51c8e 100644 --- a/app/photos/views.py +++ b/app/photos/views.py @@ -79,6 +79,16 @@ def photo_preview_json(request, pk): return HttpResponse(data) +def thumb_preview_json(request, pk): + p = LuxImage.objects.get(pk=pk) + thumb = p.get_image_by_size("tn") + data = {} + data['url'] = thumb[22:] + + data = json.dumps(data) + return HttpResponse(data) + + def gallery_list_by_area(request, slug, page): """Grabs entries by region or country""" request.page_url = '/photos/' + slug + '/%d/' |