mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-05 03:00:15 -04:00
flair: Cleanup form submission.
This commit is contained in:
@@ -37,6 +37,13 @@ $(function() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getFlairAttrs($el) {
|
||||
if ($el.data('name')) {
|
||||
return {name: $el.data('name')}
|
||||
}
|
||||
return {link: $el.thing_id()}
|
||||
}
|
||||
|
||||
function selectFlairInSelector(e) {
|
||||
$(".flairselector li").removeClass("selected");
|
||||
$(this).addClass("selected");
|
||||
@@ -75,8 +82,9 @@ $(function() {
|
||||
}
|
||||
|
||||
function postFlairSelection(e) {
|
||||
$(this).parent().parent().siblings("input").val(this.id);
|
||||
post_form(this.parentNode.parentNode.parentNode, "selectflair");
|
||||
$(this).find(".status").html(reddit.status_msg.submitting).show()
|
||||
var $btn = $(this.parentNode.parentNode).find('.flairselectbtn')
|
||||
simple_post_form(this, "selectflair", getFlairAttrs($btn));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -177,12 +185,8 @@ $(function() {
|
||||
($(button).position().left + $(button).width() - 18) + "px")
|
||||
.css("top", $(button).position().top + "px");
|
||||
|
||||
var params = {};
|
||||
$(selector).siblings("form").find("input").each(
|
||||
function(idx, inp) {
|
||||
params[inp.name] = inp.value;
|
||||
});
|
||||
$.request("flairselector", params, handleResponse, true, "html");
|
||||
var attrs = getFlairAttrs($(this))
|
||||
$.request("flairselector", attrs, handleResponse, true, "html");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
(<a href="javascript://void(0)">${_('remove flair')}</a>)
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="name" value="${thing.target_name}">
|
||||
<input type="hidden" name="flair_template_id">
|
||||
<div class="customizer">
|
||||
<input type="text" size="16" maxlength="64" name="text">
|
||||
|
||||
@@ -66,9 +66,6 @@
|
||||
<li>
|
||||
<a class="flairselectbtn" href="javascript://void(0)">${_('flair')}</a>
|
||||
<div class="flairselector drop-choices"></div>
|
||||
<form>
|
||||
<input type="hidden" name="link" value="${thing.thing._fullname}">
|
||||
</form>
|
||||
</li>
|
||||
%endif
|
||||
%if thing.show_rescrape:
|
||||
|
||||
@@ -54,9 +54,8 @@
|
||||
${flair(thing, enabled=thing.force_show_flair)}
|
||||
%endif
|
||||
%if thing.include_flair_selector:
|
||||
(<a class="flairselectbtn" href="javascript://void(0)">${_('edit')}</a>)
|
||||
(<a class="flairselectbtn" data-name="${thing.name}" href="javascript://void(0)">${_('edit')}</a>)
|
||||
<div class="flairselector drop-choices"></div>
|
||||
<form><input type="hidden" name="name" value="${thing.name}"></form>
|
||||
%endif
|
||||
<span class="userattrs">
|
||||
%if thing.attribs:
|
||||
|
||||
Reference in New Issue
Block a user