From: Harris Lapiroff Date: Mon, 13 Jun 2011 18:40:06 +0000 (-0400) Subject: Made the embed widget automatically generate URLs based on the ADMIN_URL global,... X-Git-Tag: philo-0.9.1^2~4^2~3 X-Git-Url: http://git.ithinksw.org/philo.git/commitdiff_plain/94cc95cdfa92ca66dbc1133167df42a4d419ed89?ds=sidebyside;hp=--cc Made the embed widget automatically generate URLs based on the ADMIN_URL global, which is provided by Grappelli. Unfortunately, this introduces a dependency on Grappelli. I'll return to this branch at a later date when my thinking is clearer. --- 94cc95cdfa92ca66dbc1133167df42a4d419ed89 diff --git a/philo/static/philo/js/EmbedWidget.js b/philo/static/philo/js/EmbedWidget.js index 0f972e4..bcb9f5f 100644 --- a/philo/static/philo/js/EmbedWidget.js +++ b/philo/static/philo/js/EmbedWidget.js @@ -94,8 +94,8 @@ object_name = val.split('.')[1]; // generate the url - // TODO: abstract this so it can calculate the admin url dynamically - href=["/admin", app_label, object_name, '?pop=1'].join('/'); + // TODO: Find a better way to get ADMIN_URL. Currently this only works with grappelli, which provides the javascript global ADMIN_URL + href=[ADMIN_URL, app_label, '/', object_name, '/?pop=1'].join(''); // this is a bit hackish. let's walk through it. // TODO: best to write our own template for this in the future