From 305f31583d897e1c6dfdeee1dada184087d0aeb7 Mon Sep 17 00:00:00 2001
From: = <=>
Date: Tue, 2 Oct 2012 20:02:45 +0100
Subject: [PATCH] Hides empty images in release.
---
spa/models/Mix.py | 5 +++
spa/podcast.py | 2 +-
static/js/app/views/mix.js | 2 +-
static/js/app/views/release.js | 7 +++-
templates/inc/xml/podcast.xml | 53 ++++++++++++++--------------
templates/views/ReleaseItemView.html | 4 +--
6 files changed, 41 insertions(+), 32 deletions(-)
diff --git a/spa/models/Mix.py b/spa/models/Mix.py
index ff9706a..468b7ab 100644
--- a/spa/models/Mix.py
+++ b/spa/models/Mix.py
@@ -2,6 +2,7 @@ from django.contrib.sites.models import Site
from django.db.models.signals import post_save
from django.dispatch import Signal, receiver
import os
+import rfc822
from core.utils import url
from datetime import datetime
from django.db import models
@@ -72,6 +73,10 @@ class Mix(_BaseModel):
#return 'media/%s/' % self.local_file.name
return '/audio/stream/%d' % self.id
+ def get_date_as_rfc822(self):
+ return rfc822.formatdate(rfc822.mktime_tz(rfc822.parsedate_tz(self.upload_date.strftime("%a, %d %b %Y %H:%M:%S"))))
+
+
@classmethod
def get_listing(cls, listing_type, user=None):
queryset = None
diff --git a/spa/podcast.py b/spa/podcast.py
index 16dfdd8..c0bbcd3 100644
--- a/spa/podcast.py
+++ b/spa/podcast.py
@@ -8,7 +8,7 @@ def get_default_podcast(request):
request,
'inc/xml/podcast.xml',
{'items': mixes},
- content_type='text/xml'
+ content_type='text/xml; charset=utf-8'
)
diff --git a/static/js/app/views/mix.js b/static/js/app/views/mix.js
index 7cf4ed4..ff0c022 100644
--- a/static/js/app/views/mix.js
+++ b/static/js/app/views/mix.js
@@ -286,4 +286,4 @@ window.MixCreateView = DSSEditableView.extend({
imageChanged:function (evt) {
this.sendImage = true;
}
-});
\ No newline at end of file
+});
diff --git a/static/js/app/views/release.js b/static/js/app/views/release.js
index 427f03c..793fa31 100644
--- a/static/js/app/views/release.js
+++ b/static/js/app/views/release.js
@@ -52,7 +52,9 @@ var ReleaseListView = Backbone.View.extend({
var date = s.match(/^(\w{3})[ ](\d{1,2}),[ ](\d{4})$/);
var m = monthNames[date[1]];
var d = String(date[2]);
- if (d.length == 1) {d = "0" + d;}
+ if (d.length == 1) {
+ d = "0" + d;
+ }
var y = date[3];
return '' + y + m + d;
},
@@ -88,6 +90,9 @@ var ReleaseItemView = Backbone.View.extend({
},
render:function () {
$(this.el).html(this.template({"item":this.model.toJSON()}));
+ if (com.podnoms.utils.isEmpty(this.model.get('release_image'))){
+ $('#release-image-div', this.el).remove();
+ }
return this;
}
});
diff --git a/templates/inc/xml/podcast.xml b/templates/inc/xml/podcast.xml
index 4fe8fce..4745c06 100644
--- a/templates/inc/xml/podcast.xml
+++ b/templates/inc/xml/podcast.xml
@@ -1,14 +1,22 @@
-