From 6887d1d1e853af7fe2a6a91a95b5a6570f3c705b Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 4 Jan 2011 11:33:00 +0530 Subject: [PATCH] basic embed --- pandora/app/views.py | 5 +++++ pandora/templates/embed.html | 23 +++++++++++++++++++++++ pandora/urls.py | 2 ++ static/js/pandora.embed.js | 20 ++++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 pandora/templates/embed.html create mode 100755 static/js/pandora.embed.js diff --git a/pandora/app/views.py b/pandora/app/views.py index c2e0b90c..6779fe3c 100644 --- a/pandora/app/views.py +++ b/pandora/app/views.py @@ -22,6 +22,11 @@ def index(request): return render_to_response('index.html', context) +def embed(request): + context = RequestContext(request, {'settings': settings}) + return render_to_response('embed.html', context) + + def timeline(request): context = RequestContext(request, {'settings': settings}) return render_to_response('timeline.html', context) diff --git a/pandora/templates/embed.html b/pandora/templates/embed.html new file mode 100644 index 00000000..d3108940 --- /dev/null +++ b/pandora/templates/embed.html @@ -0,0 +1,23 @@ + + + + {{settings.SITENAME}} + + + + + + + + + + + + + + diff --git a/pandora/urls.py b/pandora/urls.py index 252ba460..9500abef 100644 --- a/pandora/urls.py +++ b/pandora/urls.py @@ -38,7 +38,9 @@ if settings.DEBUG: (r'^tests/(?P.*)$', 'django.views.static.serve', {'document_root': settings.TESTS_ROOT}), ) + urlpatterns += patterns('', + (r'^.*?embed$', 'app.views.embed'), (r'^[A-Z0-9].*$', 'app.views.index'), (r'^$', 'app.views.index'), ) diff --git a/static/js/pandora.embed.js b/static/js/pandora.embed.js new file mode 100755 index 00000000..844d4198 --- /dev/null +++ b/static/js/pandora.embed.js @@ -0,0 +1,20 @@ +/*** + Pandora embed +***/ + +var pandora = new Ox.App({ + apiURL: '/api/', + config: '/site.json', + init: 'hello', +}).launch(function(data) { + var d = $('
').html('Pan.do/ra embed') + .css({'position': 'absolute', + 'padding-top': $(window).height()/4, + 'padding-left':$(window).width()/4}); + $(document.body).append(d); + var d = $('
').html('here be unicorns') + .css({'position': 'absolute', + 'padding-top': $(window).height()/2, + 'padding-left':$(window).width()/2}); + $(document.body).append(d); +});