mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 08:17:58 -05:00
Delete update_bid.
It did too much and was called in several templates where it did nothing.
This commit is contained in:
committed by
Brian Simpson
parent
62bd4e6b8e
commit
6b8e323e26
@@ -195,41 +195,6 @@ r.sponsored = {
|
||||
}
|
||||
}
|
||||
|
||||
function update_bid(elem) {
|
||||
var form = $(elem).parents(".campaign");
|
||||
var is_targeted = $("#targeting").prop("checked");
|
||||
var bid = parseFloat(form.find('*[name="bid"]').val());
|
||||
var ndays = ((Date.parse(form.find('*[name="enddate"]').val()) -
|
||||
Date.parse(form.find('*[name="startdate"]').val())) / (86400*1000));
|
||||
ndays = Math.round(ndays);
|
||||
|
||||
// min bid is slightly higher for targeted promos
|
||||
var minimum_daily_bid = is_targeted ? $("#bid").data("min_daily_bid") * 1.5 :
|
||||
$("#bid").data("min_daily_bid");
|
||||
$(".minimum-spend").removeClass("error");
|
||||
if (bid < ndays * minimum_daily_bid) {
|
||||
$(".bid-info").addClass("error");
|
||||
if (is_targeted) {
|
||||
$("#targeted_minimum").addClass("error");
|
||||
} else {
|
||||
$("#no_targeting_minimum").addClass("error");
|
||||
}
|
||||
|
||||
form.find('button[name="create"], button[name="save"]')
|
||||
.prop("disabled", "disabled")
|
||||
.addClass("disabled");
|
||||
} else {
|
||||
$(".bid-info").removeClass("error");
|
||||
form.find('button[name="create"], button[name="save"]')
|
||||
.removeProp("disabled")
|
||||
.removeClass("disabled");
|
||||
}
|
||||
|
||||
$(".bid-info").html(" →" +
|
||||
"<b>$" + (bid/ndays).toFixed(2) +
|
||||
"</b> per day for <b>" + ndays + " day(s)</b>");
|
||||
}
|
||||
|
||||
var dateFromInput = function(selector, offset) {
|
||||
if(selector) {
|
||||
var input = $(selector);
|
||||
|
||||
@@ -28,9 +28,6 @@
|
||||
<%namespace file="utils.html" import="error_field"/>
|
||||
|
||||
${unsafe(js.use('sponsored'))}
|
||||
<script type="text/javascript">
|
||||
$(function() { update_bid("#bid-field"); });
|
||||
</script>
|
||||
|
||||
<div class="payment-setup">
|
||||
<h1>${_("set up payment for this link")}</h1>
|
||||
|
||||
@@ -60,13 +60,12 @@ ${unsafe(js.use('sponsored'))}
|
||||
newd.getDate() + "/" + newd.getFullYear());
|
||||
}
|
||||
$("#datepicker-enddate").datepicker("destroy");
|
||||
update_bid(elem);
|
||||
}
|
||||
</%p:datepicker>
|
||||
-
|
||||
<%p:datepicker name="enddate", value="${thing.enddate}"
|
||||
minDateSrc="startdate" initfuncname="init_enddate">
|
||||
function(elem) { update_bid(elem); }
|
||||
function(elem) { }
|
||||
</%p:datepicker>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user