if not modifying pledge use ack data from previous transaction to prefill ack boxes [#37939351]

pull/1/head
Andromeda Yelton 2012-10-17 11:54:29 -04:00
parent 79fca69cf9
commit 96918d60a5
2 changed files with 21 additions and 1 deletions

View File

@ -8,6 +8,7 @@
<link type="text/css" rel="stylesheet" href="/static/css/pledge.css" /> <link type="text/css" rel="stylesheet" href="/static/css/pledge.css" />
<script type="text/javascript" src="/static/js/reconcile_pledge.js"></script> <script type="text/javascript" src="/static/js/reconcile_pledge.js"></script>
{% endblock %} {% endblock %}
{% block news %} {% block news %}
@ -128,11 +129,15 @@
{% if transaction.ack_name %} {% if transaction.ack_name %}
<div id="pass_ack_name" style="display: none;">{{ transaction.ack_name }}</div> <div id="pass_ack_name" style="display: none;">{{ transaction.ack_name }}</div>
{% else %} {% else %}
<div id="pass_ack_name" style="display: none;">{{ request.user.username }}</div> <div id="pass_ack_name" style="display: none;">{{ ack_name }}</div>
{% endif %} {% endif %}
<div id="pass_ack_link" style="display: none;">{{ transaction.ack_link }}</div> <div id="pass_ack_link" style="display: none;">{{ transaction.ack_link }}</div>
<div id="pass_ack_dedication" style="display: none;">{{ transaction.ack_dedication }}</div> <div id="pass_ack_dedication" style="display: none;">{{ transaction.ack_dedication }}</div>
{% if transaction.anonymous %}
<div id="pass_anon" style="display: none;">{{ transaction.anonymous }}</div> <div id="pass_anon" style="display: none;">{{ transaction.anonymous }}</div>
{% else %}
<div id="pass_anon" style="display: none;">{{ anonymous }}</div>
{% endif %}
{% endblock %} {% endblock %}

View File

@ -676,6 +676,19 @@ class PledgeView(FormView):
context = super(PledgeView, self).get_context_data(**kwargs) context = super(PledgeView, self).get_context_data(**kwargs)
context['nonprofit'] = settings.NONPROFIT context['nonprofit'] = settings.NONPROFIT
# use preferences from last transaction, if any
try:
last_transaction = Transaction.objects.filter(user=self.request.user).order_by('-date_modified')[0]
except:
last_transaction = None
if last_transaction:
ack_name=last_transaction.ack_name
anonymous=last_transaction.anonymous
else:
ack_name=self.request.user.username
anonymous=''
context.update({ context.update({
'work':self.work, 'work':self.work,
'campaign':self.campaign, 'campaign':self.campaign,
@ -684,6 +697,8 @@ class PledgeView(FormView):
'faqmenu': 'modify' if self.transaction else 'pledge', 'faqmenu': 'modify' if self.transaction else 'pledge',
'transaction': self.transaction, 'transaction': self.transaction,
'tid': self.transaction.id if self.transaction else None, 'tid': self.transaction.id if self.transaction else None,
'ack_name':ack_name,
'anonymous':anonymous,
}) })
return context return context