mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 08:17:58 -05:00
Whitespace cleanup in promotelinkform.html.
This commit is contained in:
committed by
Brian Simpson
parent
f0c080a46f
commit
8e8883b440
@@ -31,6 +31,7 @@
|
||||
from r2.lib import js
|
||||
import simplejson
|
||||
%>
|
||||
|
||||
<%namespace file="utils.html"
|
||||
import="error_field, checkbox, image_upload" />
|
||||
<%namespace name="utils" file="utils.html"/>
|
||||
@@ -38,9 +39,9 @@
|
||||
${unsafe(js.use('sponsored'))}
|
||||
|
||||
<%def name="javascript_setup()">
|
||||
<script type="text/javascript">
|
||||
$(function() { update_bid("*[name=bid]"); });
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function() { update_bid("*[name=bid]"); });
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
${self.javascript_setup()}
|
||||
@@ -65,426 +66,465 @@ ${self.javascript_setup()}
|
||||
|
||||
|
||||
<div class="create-promotion">
|
||||
|
||||
<%
|
||||
title = _("create a promotion") if not thing.link else _("edit promotion")
|
||||
%>
|
||||
<h1>${title}</h1>
|
||||
|
||||
%if thing.link:
|
||||
${thing.listing}
|
||||
%endif
|
||||
|
||||
<div class="create-promo">
|
||||
|
||||
%if thing.link:
|
||||
<div class="pretty-form">
|
||||
<%utils:line_field title="${_('campaign dashboard')}" id="campaign-field" css_class="rounded">
|
||||
|
||||
<div class="help">
|
||||
<div class="infotext rounded" id="campaign-help">
|
||||
<p>This dashboard allows you to easily place ads on reddit.
|
||||
You can target a specific community or simply run on the main
|
||||
page.
|
||||
</p></div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div id="campaign" style="${'display:none' if thing.campaigns else ''}"
|
||||
class="campaign infotext rounded" method="post" action="/api/add_campaign">
|
||||
|
||||
|
||||
<input type="hidden" name="link_id" value="${to36(thing.link._id)}"/>
|
||||
<%
|
||||
start_title = "Date when your sponsored link will start running. We start new campaigns at midnight UTC+5"
|
||||
end_title = "Date when your sponsored link will end (at midnight UTC+5)"
|
||||
targeting_title = "name of the community that you are targeting. A blank entry here means that the ad is untargeted and will run site-wide "
|
||||
newcamp_title = "click to create a new campaign. To edit an existing campaing in the table below, click the 'edit' button."
|
||||
%>
|
||||
<table class="preftable">
|
||||
<tr>
|
||||
<th>duration</th>
|
||||
<td class="prefright">
|
||||
<%
|
||||
mindate = thing.startdate
|
||||
if c.user_is_sponsor:
|
||||
mindate = thing.promote_date_today.strftime('%m/%d/%Y')
|
||||
%>
|
||||
<input type="hidden" id="date-min" name="date-min" value="${mindate}" />
|
||||
<%self:datepicker name="startdate", value="${thing.startdate}"
|
||||
minDateSrc="date-min" initfuncname="init_startdate">
|
||||
function(elem) {
|
||||
check_enddate(elem, $("#enddate"));
|
||||
update_bid(elem);
|
||||
}
|
||||
</%self:datepicker>
|
||||
-
|
||||
<%self:datepicker name="enddate", value="${thing.enddate}"
|
||||
minDateSrc="startdate" initfuncname="init_enddate" min_date_offset="86400000">
|
||||
function(elem) { update_bid(elem); }
|
||||
</%self:datepicker>
|
||||
|
||||
${error_field("BAD_DATE", "startdate", "div")}
|
||||
${error_field("BAD_FUTURE_DATE", "startdate", "div")}
|
||||
${error_field("BAD_DATE", "enddate", "div")}
|
||||
${error_field("BAD_FUTURE_DATE", "enddate", "div")}
|
||||
${error_field("BAD_DATE_RANGE", "enddate", "div")}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>total bid</th>
|
||||
<td class="prefright">
|
||||
${error_field("BAD_BID", "bid", "div")}
|
||||
${error_field("BID_LIVE", "bid", "div")}
|
||||
$<input id="bid" name="bid" size="7" type="text" class="rounded styled-input"
|
||||
style="width:auto"
|
||||
onchange="update_bid(this)"
|
||||
onkeyup="update_bid(this)"
|
||||
title="Minimum is $${'%.2f' % thing.min_daily_bid} per day, or $${'%.2f' % (thing.min_daily_bid * 1.5)} per day targeted"
|
||||
value="${'%.2f' % (thing.min_daily_bid * 5)}"
|
||||
data-min_daily_bid="${thing.min_daily_bid}"
|
||||
/>
|
||||
<span class="bid-info gray"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
targeting
|
||||
</th>
|
||||
<td class="prefright">
|
||||
<input id="no_targeting" class="nomargin"
|
||||
type="radio" value="none" name="targeting"
|
||||
onclick="return targeting_off(this)"
|
||||
checked="checked" />
|
||||
<label for="no_targeting">no targeting (displays site-wide)</label>
|
||||
<p id="no_targeting_minimum" class="minimum-spend">minimum $20 / day</p>
|
||||
<input id="targeting" class="nomargin"
|
||||
type="radio" value="one" name="targeting"
|
||||
onclick="return targeting_on(this)" />
|
||||
<label for="targeting">
|
||||
enable targeting (runs on a specific subreddit)
|
||||
</label>
|
||||
<p id="targeted_minimum" class="minimum-spend">minimum $30 / day</p>
|
||||
<script type="text/javascript">
|
||||
$(function()
|
||||
{
|
||||
var c = $(".campaign input[name=targeting]:checked");
|
||||
if (c.val() == 'one') {
|
||||
targeting_on(c);
|
||||
} else {
|
||||
targeting_off(c);
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
init_startdate();
|
||||
init_enddate();
|
||||
$("#campaign").find("button[name=create]").show().end()
|
||||
.find("button[name=save]").hide().end();
|
||||
update_bid("*[name=bid]");
|
||||
})
|
||||
</script>
|
||||
<div class="targeting" style="display:none">
|
||||
<ul>
|
||||
<li>By targeting, your ad will only appear in front of users who subscribe to the subreddit that you specify.</li>
|
||||
<li>Your ad will also appear at the top of the hot listing for that subreddit</li>
|
||||
<li>You can only target one subreddit per campaign. If you would like to submit to more than one subreddit, add a new campaign (its easy, you just fill this form out again).</li>
|
||||
</ul>
|
||||
${error_field("OVERSOLD", "sr", "div")}
|
||||
${SubredditSelector()}
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<input type="hidden" name="campaign_id36" value="" />
|
||||
<span class="status error"></span>
|
||||
<button name="cancel"
|
||||
onclick="return cancel_edit()" class="fancybutton">
|
||||
cancel
|
||||
</button>
|
||||
<button name="save"
|
||||
onclick="return post_pseudo_form('.campaign', 'edit_campaign')" class="fancybutton">
|
||||
save
|
||||
</button>
|
||||
<button name="create"
|
||||
onclick="return post_pseudo_form('.campaign', 'edit_campaign')" class="fancybutton">
|
||||
create
|
||||
</button>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="error TOO_MANY_CAMPAIGNS field-title infotext rounded
|
||||
${'hidden' if len(thing.campaigns) < g.MAX_CAMPAIGNS_PER_LINK else ''}"
|
||||
data-MAX="${g.MAX_CAMPAIGNS_PER_LINK}" data-CAMP="${len(thing.campaigns)}">
|
||||
<p>${_("You have too many campaigns for this link.")} 
|
||||
<a href="/promoted/new_promo/">${_("It's time to start fresh!")}</a></p>
|
||||
</div>
|
||||
<div class="existing-campaigns infotext rounded" data-max-campaigns="${g.MAX_CAMPAIGNS_PER_LINK}">
|
||||
<table style="${'display:none' if not thing.campaigns else ''}">
|
||||
<tr>
|
||||
<th title="${start_title}">start</th>
|
||||
<th title="${end_title}">end</th>
|
||||
<th>duration</th>
|
||||
<th>bid</th>
|
||||
<th title="${targeting_title}">targeting</th>
|
||||
<th style="align:right">
|
||||
<button class="new-campaign fancybutton"
|
||||
${'disabled="disabled"' if len(thing.campaigns) >= g.MAX_CAMPAIGNS_PER_LINK else ''}
|
||||
title="${newcamp_title}"
|
||||
onclick="return create_campaign(this)">+ add new</button>
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
%for rc in sorted(thing.campaigns, key=lambda rc: rc.start_date):
|
||||
$.new_campaign(${unsafe(','.join(simplejson.dumps(attr) for attr in
|
||||
[rc.campaign_id36, rc.start_date, rc.end_date, rc.duration,
|
||||
rc.bid, rc.sr, rc.status]))});
|
||||
%endfor
|
||||
$.set_up_campaigns();
|
||||
});
|
||||
</script>
|
||||
<p class="error"
|
||||
style="${'display:none' if thing.campaigns else ''}">
|
||||
You don't have any campaigns for this link yet. You should add one.
|
||||
</p>
|
||||
</div>
|
||||
</%utils:line_field>
|
||||
</div>
|
||||
%endif
|
||||
|
||||
<div class="pretty-form" id="promo-form">
|
||||
<h1>${_("create a promotion") if not thing.link else _("edit promotion")}</h1>
|
||||
|
||||
%if thing.link:
|
||||
<input type="hidden" name="link_id" value="${to36(thing.link._id)}"/>
|
||||
${thing.listing}
|
||||
%endif
|
||||
<%
|
||||
trusted = c.user_is_sponsor or c.user.trusted_sponsor
|
||||
%>
|
||||
<%utils:line_field title="${_('title')}" id="title-field" css_class="rounded">
|
||||
<textarea name="title" rows="2" cols="1"
|
||||
${"disabled" if (promote.is_promoted(thing.link) and
|
||||
not trusted) else ""}
|
||||
wrap="hard" class="rounded">${thing.link.title if thing.link else ''}</textarea>
|
||||
${error_field("NO_TEXT", "title", "div")}
|
||||
${error_field("TOO_LONG", "title", "div")}
|
||||
<div class="infotext rounded">
|
||||
<p>A good title is important to the success of your campaign. reddit users are an intelligent, thoughtful group, and reward those who engage them</p>
|
||||
</div>
|
||||
</%utils:line_field>
|
||||
|
||||
<%utils:line_field title="${_('url')}" id="url-field" css_class="rounded">
|
||||
<input name="kind" value="link" type="hidden"/>
|
||||
<input id="url" name="url" type="text"
|
||||
${"disabled" if (promote.is_promoted(thing.link) and
|
||||
not trusted) else ""}
|
||||
value="${('self' if thing.link.is_self else thing.link.url) if thing.link else ""}" class="rounded"/>
|
||||
${error_field("NO_URL", "url", "div")}
|
||||
${error_field("BAD_URL", "url", "div")}
|
||||
${error_field("DOMAIN_BANNED", "url", "div")}
|
||||
${error_field("ALREADY_SUB", "url", "div")}
|
||||
<div class="infotext rounded">
|
||||
<p>Provide the URL of your ad. <em>No redirects please!</em></p>
|
||||
</div>
|
||||
%if c.user_is_sponsor:
|
||||
<label style="display:block; text-align:right" for="domain">Override display domain:</label>
|
||||
<input id="domain" name="domain" type="text"
|
||||
%if getattr(thing.link, "domain_override", False):
|
||||
value="${thing.link.domain_override}" class="rounded"
|
||||
%else:
|
||||
class="gray rounded" value="optional"
|
||||
%endif
|
||||
/>
|
||||
<div class="infotext rounded">
|
||||
<p>Choose a different domain name to display on the site (the small grey text next to a link</p>
|
||||
</div>
|
||||
%endif
|
||||
</%utils:line_field>
|
||||
<div class="create-promo">
|
||||
%if thing.link:
|
||||
<div class="pretty-form">
|
||||
<%utils:line_field title="${_('campaign dashboard')}" id="campaign-field" css_class="rounded">
|
||||
|
||||
%if thing.link and (trusted or not promote.is_promoted(thing.link)):
|
||||
<%utils:line_field title="${_('look and feel')}"
|
||||
description="images will be resized if larger than 70 x 70 pixels" css_class="rounded">
|
||||
<div class="delete-field">
|
||||
<%utils:image_upload post_target="/api/link_thumb"
|
||||
current_image="${thumb}"
|
||||
label="${_('upload header image:')}"
|
||||
ask_type="True">
|
||||
<input type="hidden" name="link_id" value="${thing.link._fullname}" />
|
||||
## overwrite the completed image function
|
||||
<script type="text/javascript">
|
||||
completedUploadImage = (function(cu) {
|
||||
return function(status, img_src, name, errors) {
|
||||
cu(status, "", "", errors);
|
||||
$.things('${thing.link._fullname}').find(".thumbnail img")
|
||||
.attr("src", img_src + "?v=" + Math.random());
|
||||
}})(completedUploadImage);
|
||||
</script>
|
||||
</%utils:image_upload>
|
||||
<div class="clearleft"></div>
|
||||
</div>
|
||||
</%utils:line_field>
|
||||
<%utils:line_field title="${_('options')}" id="commenting-field" css_class="rounded">
|
||||
<div class="delete-field">
|
||||
<%
|
||||
clicks = views = 0
|
||||
disable_comments = False
|
||||
if thing.link:
|
||||
disable_comments = getattr(thing.link, "disable_comments",
|
||||
False)
|
||||
clicks = getattr(thing.link, "maximum_clicks", 0) or 0
|
||||
views = getattr(thing.link, "maximum_views", 0) or 0
|
||||
%>
|
||||
${checkbox("disable_comments",
|
||||
_("disable comments"), disable_comments)} <br />
|
||||
%if c.user_is_sponsor:
|
||||
${checkbox("set_maximum_clicks",
|
||||
unsafe("maximum clicks:  " +
|
||||
"<input type='text' style='width:auto' " +
|
||||
"onfocus='update_box(this)' " +
|
||||
"name='maximum_clicks' size='7' " +
|
||||
"value='%s' />" % clicks),
|
||||
clicks)} <br />
|
||||
${checkbox("set_maximum_views",
|
||||
unsafe("maximum views: " +
|
||||
"<input type='text' style='width:auto' " +
|
||||
"onfocus='update_box(this)' " +
|
||||
"name='maximum_views' size='7' " +
|
||||
"value='%s' />" % views),
|
||||
views)} <br />
|
||||
%endif
|
||||
<div class="help">
|
||||
<div class="infotext rounded" id="campaign-help">
|
||||
<p>
|
||||
This dashboard allows you to easily place ads on reddit.
|
||||
You can target a specific community or simply run on the main
|
||||
page.
|
||||
</p>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<div id="campaign"
|
||||
style="${'display:none' if thing.campaigns else ''}"
|
||||
class="campaign infotext rounded"
|
||||
method="post" action="/api/add_campaign">
|
||||
|
||||
<input type="hidden" name="link_id" value="${to36(thing.link._id)}"/>
|
||||
|
||||
<%
|
||||
start_title = "Date when your sponsored link will start running. We start new campaigns at midnight UTC+5"
|
||||
end_title = "Date when your sponsored link will end (at midnight UTC+5)"
|
||||
targeting_title = "name of the community that you are targeting. A blank entry here means that the ad is untargeted and will run site-wide "
|
||||
newcamp_title = "click to create a new campaign. To edit an existing campaing in the table below, click the 'edit' button."
|
||||
%>
|
||||
|
||||
<table class="preftable">
|
||||
<tr>
|
||||
<th>duration</th>
|
||||
<td class="prefright">
|
||||
<%
|
||||
mindate = thing.startdate
|
||||
if c.user_is_sponsor:
|
||||
mindate = thing.promote_date_today.strftime('%m/%d/%Y')
|
||||
%>
|
||||
<input type="hidden" id="date-min" name="date-min" value="${mindate}" />
|
||||
<%self:datepicker name="startdate", value="${thing.startdate}"
|
||||
minDateSrc="date-min" initfuncname="init_startdate">
|
||||
function(elem) {
|
||||
check_enddate(elem, $("#enddate"));
|
||||
update_bid(elem);
|
||||
}
|
||||
</%self:datepicker>
|
||||
-
|
||||
<%self:datepicker name="enddate", value="${thing.enddate}"
|
||||
minDateSrc="startdate" initfuncname="init_enddate"
|
||||
min_date_offset="86400000">
|
||||
function(elem) { update_bid(elem); }
|
||||
</%self:datepicker>
|
||||
|
||||
${error_field("BAD_DATE", "startdate", "div")}
|
||||
${error_field("BAD_FUTURE_DATE", "startdate", "div")}
|
||||
${error_field("BAD_DATE", "enddate", "div")}
|
||||
${error_field("BAD_FUTURE_DATE", "enddate", "div")}
|
||||
${error_field("BAD_DATE_RANGE", "enddate", "div")}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>total bid</th>
|
||||
<td class="prefright">
|
||||
${error_field("BAD_BID", "bid", "div")}
|
||||
${error_field("BID_LIVE", "bid", "div")}
|
||||
$<input id="bid" name="bid" size="7" type="text"
|
||||
class="rounded styled-input"
|
||||
style="width:auto"
|
||||
onchange="update_bid(this)"
|
||||
onkeyup="update_bid(this)"
|
||||
title="Minimum is $${'%.2f' % thing.min_daily_bid} per day, or $${'%.2f' % (thing.min_daily_bid * 1.5)} per day targeted"
|
||||
value="${'%.2f' % (thing.min_daily_bid * 5)}"
|
||||
data-min_daily_bid="${thing.min_daily_bid}"/>
|
||||
<span class="bid-info gray"></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>targeting</th>
|
||||
<td class="prefright">
|
||||
<input id="no_targeting" class="nomargin"
|
||||
type="radio" value="none" name="targeting"
|
||||
onclick="return targeting_off(this)"
|
||||
checked="checked" />
|
||||
<label for="no_targeting">no targeting (displays site-wide)</label>
|
||||
<p id="no_targeting_minimum" class="minimum-spend">minimum $20 / day</p>
|
||||
<input id="targeting" class="nomargin"
|
||||
type="radio" value="one" name="targeting"
|
||||
onclick="return targeting_on(this)" />
|
||||
<label for="targeting">enable targeting (runs on a specific subreddit)</label>
|
||||
<p id="targeted_minimum" class="minimum-spend">minimum $30 / day</p>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var c = $(".campaign input[name=targeting]:checked");
|
||||
if (c.val() == 'one') {
|
||||
targeting_on(c);
|
||||
} else {
|
||||
targeting_off(c);
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
init_startdate();
|
||||
init_enddate();
|
||||
$("#campaign").find("button[name=create]").show().end()
|
||||
.find("button[name=save]").hide().end();
|
||||
update_bid("*[name=bid]");
|
||||
})
|
||||
</script>
|
||||
|
||||
<div class="targeting" style="display:none">
|
||||
<ul>
|
||||
<li>By targeting, your ad will only appear in front of users who subscribe to the subreddit that you specify.</li>
|
||||
<li>Your ad will also appear at the top of the hot listing for that subreddit</li>
|
||||
<li>You can only target one subreddit per campaign. If you would like to submit to more than one subreddit, add a new campaign (its easy, you just fill this form out again).</li>
|
||||
</ul>
|
||||
${error_field("OVERSOLD", "sr", "div")}
|
||||
${SubredditSelector()}
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
<input type="hidden" name="campaign_id36" value="" />
|
||||
<span class="status error"></span>
|
||||
<button name="cancel"
|
||||
onclick="return cancel_edit()" class="fancybutton">
|
||||
cancel
|
||||
</button>
|
||||
|
||||
<button name="save"
|
||||
onclick="return post_pseudo_form('.campaign', 'edit_campaign')"
|
||||
class="fancybutton">
|
||||
save
|
||||
</button>
|
||||
|
||||
<button name="create"
|
||||
onclick="return post_pseudo_form('.campaign', 'edit_campaign')"
|
||||
class="fancybutton">
|
||||
create
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<div class="error TOO_MANY_CAMPAIGNS field-title infotext rounded ${'hidden' if len(thing.campaigns) < g.MAX_CAMPAIGNS_PER_LINK else ''}"
|
||||
data-MAX="${g.MAX_CAMPAIGNS_PER_LINK}"
|
||||
data-CAMP="${len(thing.campaigns)}">
|
||||
<p>
|
||||
${_("You have too many campaigns for this link.")} 
|
||||
<a href="/promoted/new_promo/">${_("It's time to start fresh!")}</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="existing-campaigns infotext rounded"
|
||||
data-max-campaigns="${g.MAX_CAMPAIGNS_PER_LINK}">
|
||||
<table style="${'display:none' if not thing.campaigns else ''}">
|
||||
<tr>
|
||||
<th title="${start_title}">start</th>
|
||||
<th title="${end_title}">end</th>
|
||||
<th>duration</th>
|
||||
<th>bid</th>
|
||||
<th title="${targeting_title}">targeting</th>
|
||||
<th style="align:right">
|
||||
<button class="new-campaign fancybutton"
|
||||
${'disabled="disabled"' if len(thing.campaigns) >= g.MAX_CAMPAIGNS_PER_LINK else ''}
|
||||
title="${newcamp_title}"
|
||||
onclick="return create_campaign(this)">+ add new</button>
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
%for rc in sorted(thing.campaigns, key=lambda rc: rc.start_date):
|
||||
$.new_campaign(${unsafe(','.join(simplejson.dumps(attr) for attr in
|
||||
[rc.campaign_id36, rc.start_date, rc.end_date, rc.duration,
|
||||
rc.bid, rc.sr, rc.status]))});
|
||||
%endfor
|
||||
$.set_up_campaigns();
|
||||
});
|
||||
</script>
|
||||
|
||||
<p class="error"
|
||||
style="${'display:none' if thing.campaigns else ''}">
|
||||
You don't have any campaigns for this link yet. You should add one.
|
||||
</p>
|
||||
</div>
|
||||
</%utils:line_field>
|
||||
</div>
|
||||
<div class="infotext rounded">
|
||||
<p>Comments are a great way to get feedback from customers, and the reddit community is known for being vocal in comment threads.</p>
|
||||
</div>
|
||||
</%utils:line_field>
|
||||
%if c.user_is_sponsor or c.user.trusted_sponsor:
|
||||
<%utils:line_field title="${_('media')}" id="commenting-field" css_class="rounded">
|
||||
<div class="delete-field">
|
||||
<label for="width">Dimensions:</label> 
|
||||
<input name="media-width" type='text' size='5' maxsize='5'
|
||||
id="width"
|
||||
style="width:auto"
|
||||
%if thing.link.media_object:
|
||||
value='${thing.link.media_object.get("width", 0)}'
|
||||
%else:
|
||||
placeholder="${_('width')}"
|
||||
%endif
|
||||
/>
|
||||
x <input name="media-height" type='text' size='5' maxsize='5'
|
||||
style="width:auto"
|
||||
%if thing.link.media_object:
|
||||
value='${thing.link.media_object.get("height", 0)}'
|
||||
%else:
|
||||
placeholder="${_('height')}"
|
||||
%endif
|
||||
/>
|
||||
<p>
|
||||
<label for="media-embed">Embed Code</label>
|
||||
<textarea id="media-embed" name="media-embed" rows="7" cols="1">
|
||||
%if thing.link.media_object:
|
||||
${thing.link.media_object.get('content','')}
|
||||
%endif
|
||||
</textarea>
|
||||
</p>
|
||||
${checkbox("media-override", "media override (adds an onclick to the link to generate a drop-down rather than a link out)", getattr(thing.link, "media_override", False) or False)}<br />
|
||||
</div>
|
||||
</%utils:line_field>
|
||||
%endif
|
||||
%else:
|
||||
<div class="rules">
|
||||
By clicking "next" you agree to the <a href="http://www.reddit.com/wiki/selfservicepromotion">Self Serve Advertising Rules.</a>
|
||||
</div>
|
||||
%endif
|
||||
|
||||
<div class="pretty-form" id="promo-form">
|
||||
%if thing.link:
|
||||
<input type="hidden" name="link_id" value="${to36(thing.link._id)}"/>
|
||||
%endif
|
||||
|
||||
<div class="save-button">
|
||||
<%
|
||||
if thing.link:
|
||||
name = "save"
|
||||
text = _("save options")
|
||||
else:
|
||||
name = "create"
|
||||
text = _("next")
|
||||
%>
|
||||
${error_field("RATELIMIT", "ratelimit")}
|
||||
 
|
||||
<span class="status error"></span>
|
||||
${error_field("RATELIMIT", "ratelimit")}
|
||||
<button name="${name}" class="btn fancybutton" type="button"
|
||||
onclick="return post_pseudo_form('#promo-form', 'edit_promo')"
|
||||
>${text}</button>
|
||||
<%
|
||||
trusted = c.user_is_sponsor or c.user.trusted_sponsor
|
||||
%>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<%utils:line_field title="${_('title')}" id="title-field" css_class="rounded">
|
||||
<textarea name="title" rows="2" cols="1"
|
||||
${"disabled" if (promote.is_promoted(thing.link) and not trusted) else ""}
|
||||
wrap="hard" class="rounded">${thing.link.title if thing.link else ''}</textarea>
|
||||
${error_field("NO_TEXT", "title", "div")}
|
||||
${error_field("TOO_LONG", "title", "div")}
|
||||
<div class="infotext rounded">
|
||||
<p>A good title is important to the success of your campaign. reddit users are an intelligent, thoughtful group, and reward those who engage them</p>
|
||||
</div>
|
||||
</%utils:line_field>
|
||||
|
||||
<%utils:line_field title="${_('url')}" id="url-field" css_class="rounded">
|
||||
<input name="kind" value="link" type="hidden"/>
|
||||
<input id="url" name="url" type="text"
|
||||
${"disabled" if (promote.is_promoted(thing.link) and not trusted) else ""}
|
||||
value="${('self' if thing.link.is_self else thing.link.url) if thing.link else ""}"
|
||||
class="rounded"/>
|
||||
${error_field("NO_URL", "url", "div")}
|
||||
${error_field("BAD_URL", "url", "div")}
|
||||
${error_field("DOMAIN_BANNED", "url", "div")}
|
||||
${error_field("ALREADY_SUB", "url", "div")}
|
||||
<div class="infotext rounded">
|
||||
<p>Provide the URL of your ad. <em>No redirects please!</em></p>
|
||||
</div>
|
||||
|
||||
%if c.user_is_sponsor:
|
||||
<label style="display:block; text-align:right" for="domain">Override display domain:</label>
|
||||
<input id="domain" name="domain" type="text"
|
||||
%if getattr(thing.link, "domain_override", False):
|
||||
value="${thing.link.domain_override}" class="rounded"
|
||||
%else:
|
||||
class="gray rounded" value="optional"
|
||||
%endif
|
||||
/>
|
||||
|
||||
<div class="infotext rounded">
|
||||
<p>Choose a different domain name to display on the site (the small grey text next to a link</p>
|
||||
</div>
|
||||
%endif
|
||||
</%utils:line_field>
|
||||
|
||||
%if thing.link and (trusted or not promote.is_promoted(thing.link)):
|
||||
<%utils:line_field title="${_('look and feel')}"
|
||||
description="images will be resized if larger than 70 x 70 pixels"
|
||||
css_class="rounded">
|
||||
<div class="delete-field">
|
||||
<%utils:image_upload post_target="/api/link_thumb"
|
||||
current_image="${thumb}"
|
||||
label="${_('upload header image:')}"
|
||||
ask_type="True">
|
||||
<input type="hidden" name="link_id" value="${thing.link._fullname}" />
|
||||
|
||||
## overwrite the completed image function
|
||||
<script type="text/javascript">
|
||||
completedUploadImage = (function(cu) {
|
||||
return function(status, img_src, name, errors) {
|
||||
cu(status, "", "", errors);
|
||||
$.things('${thing.link._fullname}').find(".thumbnail img")
|
||||
.attr("src", img_src + "?v=" + Math.random());
|
||||
}
|
||||
})(completedUploadImage);
|
||||
</script>
|
||||
|
||||
</%utils:image_upload>
|
||||
<div class="clearleft"></div>
|
||||
</div>
|
||||
</%utils:line_field>
|
||||
|
||||
<%utils:line_field title="${_('options')}" id="commenting-field"
|
||||
css_class="rounded">
|
||||
<div class="delete-field">
|
||||
|
||||
<%
|
||||
clicks = views = 0
|
||||
disable_comments = False
|
||||
if thing.link:
|
||||
disable_comments = getattr(thing.link, "disable_comments", False)
|
||||
clicks = getattr(thing.link, "maximum_clicks", 0) or 0
|
||||
views = getattr(thing.link, "maximum_views", 0) or 0
|
||||
%>
|
||||
|
||||
${checkbox("disable_comments", _("disable comments"), disable_comments)}
|
||||
<br />
|
||||
|
||||
%if c.user_is_sponsor:
|
||||
${checkbox("set_maximum_clicks",
|
||||
unsafe("maximum clicks:  " +
|
||||
"<input type='text' style='width:auto' " +
|
||||
"onfocus='update_box(this)' " +
|
||||
"name='maximum_clicks' size='7' " +
|
||||
"value='%s' />" % clicks),
|
||||
clicks)}
|
||||
<br />
|
||||
|
||||
${checkbox("set_maximum_views",
|
||||
unsafe("maximum views: " +
|
||||
"<input type='text' style='width:auto' " +
|
||||
"onfocus='update_box(this)' " +
|
||||
"name='maximum_views' size='7' " +
|
||||
"value='%s' />" % views),
|
||||
views)}
|
||||
<br />
|
||||
|
||||
%endif
|
||||
</div>
|
||||
|
||||
<div class="infotext rounded">
|
||||
<p>Comments are a great way to get feedback from customers, and the reddit community is known for being vocal in comment threads.</p>
|
||||
</div>
|
||||
</%utils:line_field>
|
||||
|
||||
%if c.user_is_sponsor or c.user.trusted_sponsor:
|
||||
<%utils:line_field title="${_('media')}" id="commenting-field" css_class="rounded">
|
||||
<div class="delete-field">
|
||||
<label for="width">Dimensions:</label> 
|
||||
<input name="media-width" type='text' size='5' maxsize='5'
|
||||
id="width"
|
||||
style="width:auto"
|
||||
%if thing.link.media_object:
|
||||
value='${thing.link.media_object.get("width", 0)}'
|
||||
%else:
|
||||
placeholder="${_('width')}"
|
||||
%endif
|
||||
/>
|
||||
x
|
||||
<input name="media-height" type='text' size='5' maxsize='5'
|
||||
style="width:auto"
|
||||
%if thing.link.media_object:
|
||||
value='${thing.link.media_object.get("height", 0)}'
|
||||
%else:
|
||||
placeholder="${_('height')}"
|
||||
%endif
|
||||
/>
|
||||
<p>
|
||||
<label for="media-embed">Embed Code</label>
|
||||
<textarea id="media-embed" name="media-embed" rows="7" cols="1">
|
||||
%if thing.link.media_object:
|
||||
${thing.link.media_object.get('content','')}
|
||||
%endif
|
||||
</textarea>
|
||||
</p>
|
||||
${checkbox("media-override",
|
||||
"media override (adds an onclick to the link to generate a drop-down rather than a link out)",
|
||||
getattr(thing.link, "media_override", False) or False)}
|
||||
<br />
|
||||
|
||||
</div>
|
||||
</%utils:line_field>
|
||||
%endif
|
||||
|
||||
%else:
|
||||
<div class="rules">
|
||||
By clicking "next" you agree to the <a href="http://www.reddit.com/wiki/selfservicepromotion">Self Serve Advertising Rules.</a>
|
||||
</div>
|
||||
%endif
|
||||
|
||||
<div class="save-button">
|
||||
<%
|
||||
if thing.link:
|
||||
name = "save"
|
||||
text = _("save options")
|
||||
else:
|
||||
name = "create"
|
||||
text = _("next")
|
||||
%>
|
||||
|
||||
${error_field("RATELIMIT", "ratelimit")}
|
||||
 
|
||||
<span class="status error"></span>
|
||||
${error_field("RATELIMIT", "ratelimit")}
|
||||
<button name="${name}" class="btn fancybutton" type="button"
|
||||
onclick="return post_pseudo_form('#promo-form', 'edit_promo')">
|
||||
${text}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
${self.right_panel()}
|
||||
</div>
|
||||
|
||||
<%def name="right_panel()">
|
||||
</%def>
|
||||
%if thing.link and c.user_is_sponsor:
|
||||
<div class="spacer bidding-history">
|
||||
%if thing.bids:
|
||||
<%utils:line_field title="${_('bidding history')}" css_class="rounded">
|
||||
|
||||
${self.right_panel()}
|
||||
<%
|
||||
from r2.models import Account, bidding
|
||||
accounts = Account._byID(set(x.account_id for x in thing.bids), True)
|
||||
%>
|
||||
|
||||
%if thing.link and c.user_is_sponsor:
|
||||
<div class="spacer bidding-history">
|
||||
%if thing.bids:
|
||||
<%utils:line_field title="${_('bidding history')}" css_class="rounded">
|
||||
<%
|
||||
from r2.models import Account, bidding
|
||||
accounts = Account._byID(set(x.account_id for x in thing.bids), True)
|
||||
%>
|
||||
<table class="bid-table">
|
||||
<tr>
|
||||
<th>date</th>
|
||||
<th>user</th>
|
||||
<th>transaction id</th>
|
||||
<th>campaign id</th>
|
||||
<th>pay id</th>
|
||||
<th>amount</th>
|
||||
<th>status</th>
|
||||
</tr>
|
||||
%for bid in thing.bids:
|
||||
<%
|
||||
status = bidding.Bid.STATUS.name[bid.status].lower()
|
||||
%>
|
||||
<tr class="bid-${status}">
|
||||
<td>${bid.date}</td>
|
||||
<td>${accounts[bid.account_id].name}</td>
|
||||
<td>${bid.transaction}</td>
|
||||
<td>${bid.campaign}</td>
|
||||
<td>${bid.pay_id}</td>
|
||||
<td>$${"%.2f" % bid.bid}</td>
|
||||
<td class="bid-status">${status}</td>
|
||||
</tr>
|
||||
%endfor
|
||||
</table>
|
||||
</%utils:line_field>
|
||||
<table class="bid-table">
|
||||
<tr>
|
||||
<th>date</th>
|
||||
<th>user</th>
|
||||
<th>transaction id</th>
|
||||
<th>campaign id</th>
|
||||
<th>pay id</th>
|
||||
<th>amount</th>
|
||||
<th>status</th>
|
||||
</tr>
|
||||
%for bid in thing.bids:
|
||||
<%
|
||||
status = bidding.Bid.STATUS.name[bid.status].lower()
|
||||
%>
|
||||
<tr class="bid-${status}">
|
||||
<td>${bid.date}</td>
|
||||
<td>${accounts[bid.account_id].name}</td>
|
||||
<td>${bid.transaction}</td>
|
||||
<td>${bid.campaign}</td>
|
||||
<td>${bid.pay_id}</td>
|
||||
<td>$${"%.2f" % bid.bid}</td>
|
||||
<td class="bid-status">${status}</td>
|
||||
</tr>
|
||||
%endfor
|
||||
</table>
|
||||
</%utils:line_field>
|
||||
%endif
|
||||
|
||||
<form id="promotion-history" method="post" action="/post/promote_note"
|
||||
onsubmit="post_form(this, 'promote_note'); $('#promote_note').val('');return false;">
|
||||
<%utils:line_field title="${_('promotion history')}" css_class="rounded">
|
||||
<div style="font-size:smaller; margin-bottom: 10px;">
|
||||
For correspondence, the email address of this author is 
|
||||
<a href="mailto:${thing.author.email}">${thing.author.email}</a>.
|
||||
</div>
|
||||
|
||||
<div style="font-size:smaller; margin-bottom: 10px;">
|
||||
To check with <a href="https://account.authorize.net/">authorize.net</a>,
|
||||
use CustomerID <b>${thing.author._fullname}</b>  when searching by batch.
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="link" value="${thing.link._fullname}"/>
|
||||
<label for="promote_note">add note:</label>
|
||||
<input id="promote_note" name="note" value="" type="text" size="40" />
|
||||
<button type="submit">save</button>
|
||||
<div class="notes">
|
||||
%for line in thing.promotion_log:
|
||||
<p>${line}</p>
|
||||
%endfor
|
||||
</div>
|
||||
</%utils:line_field>
|
||||
</form>
|
||||
</div>
|
||||
%endif
|
||||
|
||||
<form id="promotion-history" method="post" action="/post/promote_note"
|
||||
onsubmit="post_form(this, 'promote_note'); $('#promote_note').val('');return false;">
|
||||
<%utils:line_field title="${_('promotion history')}" css_class="rounded">
|
||||
<div style="font-size:smaller; margin-bottom: 10px;">
|
||||
For correspondence, the email address of this author is 
|
||||
<a href="mailto:${thing.author.email}">${thing.author.email}</a>.
|
||||
</div>
|
||||
<div style="font-size:smaller; margin-bottom: 10px;">
|
||||
To check with <a href="https://account.authorize.net/">
|
||||
authorize.net</a>, use CustomerID
|
||||
 <b>${thing.author._fullname}</b>  when searching by batch.
|
||||
</div>
|
||||
<input type="hidden" name="link" value="${thing.link._fullname}"/>
|
||||
<label for="promote_note">add note:</label>
|
||||
<input id="promote_note" name="note" value="" type="text" size="40" />
|
||||
<button type="submit">save</button>
|
||||
<div class="notes">
|
||||
%for line in thing.promotion_log:
|
||||
<p>${line}</p>
|
||||
%endfor
|
||||
</div>
|
||||
</%utils:line_field>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
%endif
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
Reference in New Issue
Block a user