From debf587e6864a6e19848bc10be472c7f51d24ecd Mon Sep 17 00:00:00 2001 From: Brian Simpson Date: Thu, 27 Mar 2014 10:40:55 -0400 Subject: [PATCH] Show a warning message when a user changes the bid of a paid campaign. --- r2/r2/public/static/js/sponsored.js | 14 +++++++++++++- r2/r2/templates/promotelinkform.html | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/r2/r2/public/static/js/sponsored.js b/r2/r2/public/static/js/sponsored.js index a7d870849..e8b58a278 100644 --- a/r2/r2/public/static/js/sponsored.js +++ b/r2/r2/public/static/js/sponsored.js @@ -397,7 +397,19 @@ r.sponsored = { check_bid: function($form) { var bid = this.get_bid($form), - minimum_bid = $("#bid").data("min_bid"); + minimum_bid = $("#bid").data("min_bid"), + campaignName = $form.find('*[name=campaign_name]').val() + + $('.budget-change-warning').hide() + if (campaignName != '') { + var $campaignRow = $('.' + campaignName), + campaignIsPaid = $campaignRow.data('paid'), + campaignBid = $campaignRow.data('bid') + + if (campaignIsPaid && bid != campaignBid) { + $('.budget-change-warning').show() + } + } $(".minimum-spend").removeClass("error"); if (bid < minimum_bid) { diff --git a/r2/r2/templates/promotelinkform.html b/r2/r2/templates/promotelinkform.html index 9105ecfe2..93dcdcb64 100644 --- a/r2/r2/templates/promotelinkform.html +++ b/r2/r2/templates/promotelinkform.html @@ -408,6 +408,9 @@ ${self.javascript_setup()}
${_('%(minimum)s minimum') % dict(minimum=format_currency(thing.min_bid, 'USD', locale=c.locale))}
+
+ ${_('if you modify the budget of this paid campaign you will need to reauthorize payment by clicking the "pay" button')} +