mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 08:17:58 -05:00
Fix post-submit updates of flair template entry form.
This commit is contained in:
@@ -2032,7 +2032,7 @@ class ApiController(RedditController):
|
||||
|
||||
@validatedForm(VFlairManager(),
|
||||
VModhash(),
|
||||
flair_template_id = nop('id'),
|
||||
flair_template_id = nop('flair_template_id'),
|
||||
text = VFlairText('text'),
|
||||
css_class = VFlairCss('css_class'),
|
||||
text_editable = VBoolean('text_editable'))
|
||||
@@ -2070,7 +2070,6 @@ class ApiController(RedditController):
|
||||
|
||||
new = True
|
||||
|
||||
# TODO(intortus): ...
|
||||
# Push changes back to client.
|
||||
if new:
|
||||
jquery('#empty-flair-template').before(
|
||||
@@ -2079,10 +2078,13 @@ class ApiController(RedditController):
|
||||
empty_template._committed = True # to disable unnecessary warning
|
||||
jquery('#empty-flair-template').html(
|
||||
FlairTemplateEditor(empty_template).render(style='html'))
|
||||
form.set_html('.status', _('saved'))
|
||||
else:
|
||||
form.set_html('.flaircell:first',
|
||||
FlairTemplateEditor(ft).render(style='html'))
|
||||
form.set_html('.status', _('saved'))
|
||||
jquery('input[name="text"]').data('saved', text)
|
||||
jquery('input[name="css_class"]').data('saved', css_class)
|
||||
form.set_html('.status', _('saved'))
|
||||
|
||||
@validatedForm(VFlairManager(), VModhash())
|
||||
def POST_clearflairtemplates(self, form, jquery):
|
||||
|
||||
@@ -120,7 +120,9 @@ $(function() {
|
||||
// Attach event handlers to the various flair forms that may be on page.
|
||||
$(".flairlist").delegate(".flairtemplate form", "submit",
|
||||
makeOnSubmit('flairtemplate'));
|
||||
$(".flairlist").delegate("form.flair-entry", "submit",
|
||||
$(".flairlist").delegate("form.clearflairtemplates", "submit",
|
||||
makeOnSubmit('clearflairtemplates'));
|
||||
$(".flairlist").delegate(".flairgrant form", "submit",
|
||||
makeOnSubmit('flair'));
|
||||
$(".flairlist").delegate("form.clearflairtemplates", "submit",
|
||||
makeOnSubmit('clearflairtemplates'));
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
<h2>users with flair</h2>
|
||||
|
||||
<div class="flairlist pretty-form">
|
||||
<div class="flairgrant flairlist pretty-form">
|
||||
<%utils:line_field title="${_('jump to user (or add):')}" css_class="flair-jump">
|
||||
<form method="get">
|
||||
<% name = thing.user.name if thing.user else thing.name %>
|
||||
|
||||
@@ -24,9 +24,10 @@
|
||||
|
||||
<div class="flairtemplate flairrow">
|
||||
<form action="/post/flairtemplate"
|
||||
${'id=%s' % thing.id if thing.id else ''}
|
||||
method="post" class="medium-text flair-entry">
|
||||
%if thing.id:
|
||||
<input type="hidden" name="id" value="${thing.id}" />
|
||||
<input type="hidden" name="flair_template_id" value="${thing.id}" />
|
||||
%endif
|
||||
<span class="flaircell flairsample-${thing.position} tagline">
|
||||
%if thing.text or thing.css_class:
|
||||
|
||||
Reference in New Issue
Block a user