commit
b4c1d09e88
|
@ -973,6 +973,7 @@ def pledger():
|
||||||
pledger.instance = Badge.objects.get(name='pledger')
|
pledger.instance = Badge.objects.get(name='pledger')
|
||||||
return pledger.instance
|
return pledger.instance
|
||||||
pledger.instance=None
|
pledger.instance=None
|
||||||
|
|
||||||
def pledger2():
|
def pledger2():
|
||||||
if not pledger2.instance:
|
if not pledger2.instance:
|
||||||
pledger2.instance = Badge.objects.get(name='pledger2')
|
pledger2.instance = Badge.objects.get(name='pledger2')
|
||||||
|
@ -1019,6 +1020,7 @@ class UserProfile(models.Model):
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return accounts[0]
|
return accounts[0]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def old_account(self):
|
def old_account(self):
|
||||||
accounts = self.user.account_set.filter(date_deactivated__isnull=False).order_by('-date_deactivated')
|
accounts = self.user.account_set.filter(date_deactivated__isnull=False).order_by('-date_deactivated')
|
||||||
|
@ -1031,6 +1033,31 @@ class UserProfile(models.Model):
|
||||||
def pledges(self):
|
def pledges(self):
|
||||||
return self.user.transaction_set.filter(status=TRANSACTION_STATUS_ACTIVE)
|
return self.user.transaction_set.filter(status=TRANSACTION_STATUS_ACTIVE)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def last_transaction(self):
|
||||||
|
from regluit.payment.models import Transaction
|
||||||
|
try:
|
||||||
|
return Transaction.objects.filter(user=self.user).order_by('-date_modified')[0]
|
||||||
|
except IndexError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def ack_name(self):
|
||||||
|
# use preferences from last transaction, if any
|
||||||
|
last = self.last_transaction
|
||||||
|
if last and last.ack_name:
|
||||||
|
return last.ack_name
|
||||||
|
else:
|
||||||
|
return self.user.username
|
||||||
|
|
||||||
|
@property
|
||||||
|
def anon_pref(self):
|
||||||
|
# use preferences from last transaction, if any
|
||||||
|
last = self.last_transaction
|
||||||
|
if last:
|
||||||
|
return last.anonymous
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
#class CampaignSurveyResponse(models.Model):
|
#class CampaignSurveyResponse(models.Model):
|
||||||
# # generic
|
# # generic
|
||||||
|
|
|
@ -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 %}
|
||||||
|
@ -125,14 +126,7 @@
|
||||||
<div class="cancel_notice">
|
<div class="cancel_notice">
|
||||||
{% if faqmenu == 'modify' %}We hope you won't, but of course you're also free to <a href="{% url pledge_cancel campaign_id=work.last_campaign.id %}">cancel your pledge</a>.{% endif %}</div>
|
{% if faqmenu == 'modify' %}We hope you won't, but of course you're also free to <a href="{% url pledge_cancel campaign_id=work.last_campaign.id %}">cancel your pledge</a>.{% endif %}</div>
|
||||||
<div id="pass_supporter_name" style="display: none;">{{ request.user.username }}</div>
|
<div id="pass_supporter_name" style="display: none;">{{ request.user.username }}</div>
|
||||||
{% if transaction.ack_name %}
|
|
||||||
<div id="pass_ack_name" style="display: none;">{{ transaction.ack_name }}</div>
|
|
||||||
{% else %}
|
|
||||||
<div id="pass_ack_name" style="display: none;">{{ request.user.username }}</div>
|
|
||||||
{% endif %}
|
|
||||||
<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_anon" style="display: none;">{{ transaction.anonymous }}</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -644,15 +644,18 @@ class PledgeView(FormView):
|
||||||
transactions = self.campaign.transactions().filter(user=self.request.user, status=TRANSACTION_STATUS_ACTIVE, type=PAYMENT_TYPE_AUTHORIZATION)
|
transactions = self.campaign.transactions().filter(user=self.request.user, status=TRANSACTION_STATUS_ACTIVE, type=PAYMENT_TYPE_AUTHORIZATION)
|
||||||
premium_id = self.request.REQUEST.get('premium_id', 150)
|
premium_id = self.request.REQUEST.get('premium_id', 150)
|
||||||
if transactions.count() == 0:
|
if transactions.count() == 0:
|
||||||
ack_name=''
|
ack_name=self.request.user.profile.ack_name
|
||||||
ack_dedication=''
|
ack_dedication=''
|
||||||
anonymous=''
|
anonymous=self.request.user.profile.anon_pref
|
||||||
else:
|
else:
|
||||||
self.transaction = transactions[0]
|
self.transaction = transactions[0]
|
||||||
if premium_id == 150 and self.transaction.premium is not None:
|
if premium_id == 150 and self.transaction.premium is not None:
|
||||||
premium_id = self.transaction.premium.id
|
premium_id = self.transaction.premium.id
|
||||||
ack_name=self.transaction.ack_name
|
if self.transaction.ack_name:
|
||||||
ack_dedication=self.transaction.ack_dedication
|
ack_name = self.transaction.ack_name
|
||||||
|
else:
|
||||||
|
ack_name = self.request.user.profile.ack_name
|
||||||
|
ack_dedication = self.transaction.ack_dedication
|
||||||
anonymous=self.transaction.anonymous
|
anonymous=self.transaction.anonymous
|
||||||
|
|
||||||
self.data = {'preapproval_amount':self.get_preapproval_amount(), 'premium_id':premium_id,
|
self.data = {'preapproval_amount':self.get_preapproval_amount(), 'premium_id':premium_id,
|
||||||
|
|
|
@ -12,19 +12,17 @@ $j().ready(function() {
|
||||||
var anonbox = $j('#anonbox input');
|
var anonbox = $j('#anonbox input');
|
||||||
var ackSection = $j('#ack_section');
|
var ackSection = $j('#ack_section');
|
||||||
var supporterName = $j('#pass_supporter_name').html();
|
var supporterName = $j('#pass_supporter_name').html();
|
||||||
var ackName = $j('#pass_ack_name').html();
|
var ackName = $j('#id_ack_name').val();
|
||||||
var ackLink = $j('#pass_ack_link').html();
|
var ackDedication = $j('#id_ack_dedication').val();
|
||||||
var ackDedication = $j('#pass_ack_dedication').html();
|
|
||||||
if(ackDedication == 'None') {
|
if(ackDedication == 'None') {
|
||||||
ackDedication = '';
|
ackDedication = '';
|
||||||
}
|
}
|
||||||
var acks = {
|
var acks = {
|
||||||
ack_name: ackName,
|
ack_name: ackName,
|
||||||
ack_link: ackLink,
|
|
||||||
ack_dedication: ackDedication
|
ack_dedication: ackDedication
|
||||||
};
|
};
|
||||||
|
|
||||||
var ackAnon = $j('#pass_anon').html();
|
var ackAnon = $j('#id_anonymous').val();
|
||||||
|
|
||||||
// we're not letting people submit arbitrary links
|
// we're not letting people submit arbitrary links
|
||||||
$j('#id_ack_link').attr('disabled', 'disabled');
|
$j('#id_ack_link').attr('disabled', 'disabled');
|
||||||
|
@ -75,17 +73,11 @@ $j().ready(function() {
|
||||||
// fill mandatory premium link input with supporter page
|
// fill mandatory premium link input with supporter page
|
||||||
var activateLink = function() {
|
var activateLink = function() {
|
||||||
$j('#ack_link').removeClass('ack_inactive').addClass('ack_active');
|
$j('#ack_link').removeClass('ack_inactive').addClass('ack_active');
|
||||||
if(ackLink) {
|
|
||||||
$j('input#id_ack_link').val(ackLink);
|
|
||||||
} else {
|
|
||||||
$j('input#id_ack_link').val('https://unglue.it/supporter/'+supporterName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// empty mandatory premium link
|
// empty mandatory premium link
|
||||||
var deactivateLink = function() {
|
var deactivateLink = function() {
|
||||||
$j('#ack_link').removeClass('ack_active').addClass('ack_inactive');
|
$j('#ack_link').removeClass('ack_active').addClass('ack_inactive');
|
||||||
$j('input#id_ack_link').val('');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var anonymizeName = function() {
|
var anonymizeName = function() {
|
||||||
|
|
Loading…
Reference in New Issue