diff --git a/r2/r2/controllers/promotecontroller.py b/r2/r2/controllers/promotecontroller.py index 9d15b9bfe..f21083ec4 100644 --- a/r2/r2/controllers/promotecontroller.py +++ b/r2/r2/controllers/promotecontroller.py @@ -44,6 +44,7 @@ from r2.lib.pages import ( PromotePage, PromoteLinkForm, PromoteLinkFormCpm, + PromoteLinkNew, PromoteReport, Reddit, Roadblocks, @@ -227,22 +228,16 @@ class PromoteController(ListingController): @validate(VSponsor()) def GET_new_promo(self): - return PromotePage('content', content=PromoteLinkForm()).render() + return PromotePage('content', content=PromoteLinkNew()).render() @validate(VSponsor('link'), link=VLink('link')) def GET_edit_promo(self, link): if not link or link.promoted is None: return self.abort404() - rendered = wrap_links(link, wrapper=promote.sponsor_wrapper, - skip=False) - - form = PromoteLinkForm(link=link, - listing=rendered, - timedeltatext="") - + rendered = wrap_links(link, wrapper=promote.sponsor_wrapper, skip=False) + form = PromoteLinkForm(link, rendered) page = PromotePage('new_promo', content=form) - return page.render() diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index a6fe5a964..7c00396df 100755 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -3308,14 +3308,16 @@ class PromotePage(Reddit): kw['show_sidebar'] = False Reddit.__init__(self, title, nav_menus = nav_menus, *a, **kw) +class PromoteLinkNew(Templated): pass + class PromoteLinkForm(Templated): - def __init__(self, link=None, listing='', *a, **kw): + def __init__(self, link, listing, *a, **kw): self.setup(link, listing) Templated.__init__(self, *a, **kw) def setup(self, link, listing): self.bids = [] - if c.user_is_sponsor and link: + if c.user_is_sponsor: self.author = Account._byID(link.author_id) try: bids = bidding.Bid.lookup(thing_id=link._id) @@ -3357,13 +3359,11 @@ class PromoteLinkForm(Templated): self.mindate = mindate.strftime("%m/%d/%Y") - self.link = None + self.link = promote.wrap_promoted(link) self.listing = listing - if link: - self.link = promote.wrap_promoted(link) - campaigns = PromoCampaign._by_link(link._id) - self.campaigns = promote.get_renderable_campaigns(link, campaigns) - self.promotion_log = PromotionLog.get(link) + campaigns = PromoCampaign._by_link(link._id) + self.campaigns = promote.get_renderable_campaigns(link, campaigns) + self.promotion_log = PromotionLog.get(link) self.min_daily_bid = 0 if c.user_is_admin else g.min_promote_bid diff --git a/r2/r2/templates/promotelinkform.html b/r2/r2/templates/promotelinkform.html index 068dfc69e..a7af57347 100644 --- a/r2/r2/templates/promotelinkform.html +++ b/r2/r2/templates/promotelinkform.html @@ -66,21 +66,15 @@ ${self.javascript_setup()}