Parameterize the Ads template.

This commit is contained in:
Max Goodman
2012-12-12 15:56:25 -08:00
parent 78888f1373
commit 8b77613309
2 changed files with 12 additions and 13 deletions

View File

@@ -2339,7 +2339,16 @@ class AdminAwardWinners(Templated):
Templated.__init__(self, award = award, trophies = trophies)
class Ads(Templated):
pass
def __init__(self):
Templated.__init__(self)
path = ""
if c.custom_dart_keyword:
path = "r/%s/%s" % (c.site.path, c.custom_dart_keyword)
elif not c.default_sr:
path = "r/%s/" % c.site.path
self.ad_url = g.ad_domain + "/ads/" + path
self.frame_id = "ad-frame"
class Embed(Templated):
"""wrapper for embedding /help into reddit as if it were not on a separate wiki."""

View File

@@ -26,18 +26,8 @@
import random
%>
<%
name = ''
if c.custom_dart_keyword:
name = "r/%s/%s" % (c.site.name, c.custom_dart_keyword)
elif not c.default_sr:
name = "r/%s/" % c.site.name
%>
<iframe id="ad-frame" frameborder="0" scrolling="no" name="ad-frame"
src="${g.ad_domain}/ads/${name}">
<iframe id="${thing.frame_id}" frameborder="0" scrolling="no" name="${thing.frame_id}"
src="${thing.ad_url}">
</iframe>
<script type="text/javascript">