make pandora.json dynamic

This commit is contained in:
j 2010-09-07 15:08:23 +02:00
parent 24434a73ed
commit 7a01749b66
7 changed files with 22 additions and 5 deletions

6
README
View file

@ -33,3 +33,9 @@ Development:
Apache setup:
sudo apt-get install libapache2-mod-wsgi libapache2-mod-xsendfile
add pandora repository:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:j/pandora
sudo apt-get update
sudo apt-get install oxtools mkvtoolnix

View file

@ -32,3 +32,11 @@ def site_js(request):
siteSettings[s.key] = s.value
context = RequestContext(request, {'settings':settings, 'pages': pages, 'siteSettings': siteSettings})
return render_to_response('site.js', context, mimetype="application/javascript")
def pandora_json(request):
siteSettings = {}
for s in models.SiteSettings.objects.all():
siteSettings[s.key] = s.value
context = RequestContext(request, {'settings':settings, 'siteSettings': siteSettings})
return render_to_response('pandora.json', context, mimetype="application/javascript")

View file

@ -5,6 +5,7 @@ import os
from os.path import join
SITENAME = 'Pandora'
SITEID = 'pandora'
URL = 'pan.do/ra'
PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__))

View file

@ -3,10 +3,10 @@
***/
var app = new Ox.App({
config: '/static/json/pandora.json',
config: '/pandora.json',
init: 'hello',
id: 'oxdb',
name: 'OxDB',
id: site.id,
name: site.name,
requestURL: '/api/'
}).launch(function(data) {
Ox.print('data', data)
@ -521,7 +521,7 @@ app.constructList = function(view) {
id: data['id'],
info: data[info],
title: data.title + (data.director ? ' (' + data.director + ')' : ''),
url: 'http://0xdb.org/' + data.id + '/poster.' + size + '.' + 'jpg',
url: 'http://0xdb.org/' + data.id + '/poster.' + size + '.' + 'jpg', //url: data.poster.url.replace(/.jpg/, size + '.jpg'),
width: data.poster.width || 80 // fixme: remove later
};
},
@ -1941,4 +1941,4 @@ app.getGroupWidth = function(pos, panelWidth) {
});
*/
*/

View file

@ -1,6 +1,7 @@
var site = {};
site.url = "{{settings.URL}}";
site.name = "{{settings.SITENAME}}";
site.id = "{{settings.SITEID}}";
site.pages = {};
{% for page in pages %}

View file

@ -13,6 +13,7 @@ urlpatterns = patterns('',
(r'^api/', include('backend.urls')),
(r'^api/upload/$', 'archive.views.firefogg_upload'),
(r'^site.js$', 'app.views.site_js'),
(r'^pandora.json$', 'app.views.pandora_json'),
(r'^$', 'app.views.intro'),
(r'^ra$', 'app.views.index'),
(r'^r/(?P<key>.*)$', 'oxuser.views.recover'),