From 8639f6322ef10a6ac8577ad2cedfd3dc7b0a1c58 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 1 Aug 2011 18:14:51 +0200 Subject: [PATCH] actually set poster --- pandora/item/models.py | 4 ++++ static/js/pandora/ui/menu.js | 3 +-- static/js/pandora/ui/postersDialog.js | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pandora/item/models.py b/pandora/item/models.py index 7df6e512..0e944d72 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -811,6 +811,10 @@ class Item(models.Model): return None def make_poster(self, force=False): + posters = glob(os.path.abspath(os.path.join(settings.MEDIA_ROOT, + self.path('poster.*.jpg')))) + for f in filter(posters, lambda p: not p.endswith('poster.local.jpg')): + os.unlink(f) if not self.poster or force: url = self.prefered_poster_url() if url: diff --git a/static/js/pandora/ui/menu.js b/static/js/pandora/ui/menu.js index cee1e5e0..2fc9de97 100644 --- a/static/js/pandora/ui/menu.js +++ b/static/js/pandora/ui/menu.js @@ -406,8 +406,7 @@ pandora.ui.mainMenu = function() { pandora.$ui.accountDialog = (pandora.user.level == 'guest' ? pandora.ui.accountDialog('login') : pandora.ui.accountLogoutDialog()).open(); } else if (data.id == 'posters') { - var id = '0133093'; - pandora.$ui.postersDialog = pandora.ui.postersDialog(id).open(); + pandora.$ui.postersDialog = pandora.ui.postersDialog(pandora.user.ui.item).open(); } else if (data.id == 'places') { pandora.$ui.placesDialog = pandora.ui.placesDialog().open(); /* diff --git a/static/js/pandora/ui/postersDialog.js b/static/js/pandora/ui/postersDialog.js index 9ab53ce0..31596eac 100644 --- a/static/js/pandora/ui/postersDialog.js +++ b/static/js/pandora/ui/postersDialog.js @@ -94,11 +94,14 @@ pandora.ui.postersDialog = function(id) { margin: 'auto' }) ); + pandora.api.setPoster({ + id: pandora.user.ui.item, + source: source + }); } }); $panel.replaceElement(0, $list); - }); return that;