Merge branch 'master' of github.com:Gluejar/regluit into ry

pull/1/head
Raymond Yee 2012-05-14 06:32:15 -07:00
commit 78791a454f
7 changed files with 32 additions and 15 deletions

View File

@ -204,7 +204,7 @@ def getManageCampaignForm ( instance, data=None, *args, **kwargs ):
error_messages={'required': 'You must enter the email associated with your Paypal account.'},
)
target = forms.DecimalField( min_value= D(settings.UNGLUEIT_MINIMUM_TARGET), error_messages={'required': 'Please specify a target price.'} )
edition = forms.ModelChoiceField(get_queryset(), widget=RadioSelect(),empty_label='no edition selected')
edition = forms.ModelChoiceField(get_queryset(), widget=RadioSelect(),empty_label='no edition selected',required = False,)
minimum_target = settings.UNGLUEIT_MINIMUM_TARGET
latest_ending = (timedelta(days=int(settings.UNGLUEIT_LONGEST_DEADLINE)) + now()).date

View File

@ -110,8 +110,14 @@ Please fix the following before launching your campaign:
<form action="#" method="POST">
{% csrf_token %}
<h3>Select the edition</h3>
<p> Please choose the edition that most closely matches the edition to be unglued:
<p> Please choose the edition that most closely matches the edition to be unglued:</p>
{{ form.edition.errors }}{{ form.edition }}
{% if campaign.edition %}
<p>You can edit the campaign's <a href="{% url rh_edition work.id campaign.edition.id %}">preferred edition</a>.</p>
{% else %}
<p>If none of the existing editions matches what you want to release, you can <a href="{% url rh_edition work.id '' %}">create a new edition</a>.</p>
{% endif %}
<h3>Make Your Pitch</h3>
<p>This will be displayed in the Campaign tab for your work. It's your main pitch to supporters. It should include:</p>
<ul class="terms">
@ -164,10 +170,10 @@ Please fix the following before launching your campaign:
<h3>License being offered</h3>
<p>If your campaign succeeds, you will be offering your ebook under a <b>{{ campaign.license }}</b> license.</p>
{{ form.license.errors }}<span style="display: none">{{ form.license }}</span>
<h3>Ending date</h3>
<p>The ending date of your campaign is <b>{{ campaign.deadline }}</b>. Your campaign will conclude on this date or when you meet your target price, whichever is earlier. You may not change the ending date of an active campaign.</p>
{{ form.deadline.errors }}<span style="display: none">{{ form.deadline }}</span>
{% endifnotequal %}
<h3>Paypal collection address</h3>

View File

@ -90,7 +90,7 @@
{% endfor %}
</ul>
<input type="submit" {% if faqmenu == 'modify' %}value="Modify Pledge"{% else %}value="Pledge"{% endif %} id="pledgesubmit" />
<input type="submit" {% if faqmenu == 'modify' %}value="Modify Pledge"{% else %}value="Pledge Now"{% endif %} id="pledgesubmit" />
</form>
</div>
</div>

View File

@ -22,6 +22,7 @@ urlpatterns = patterns(
name="terms"),
url(r"^rightsholders/$", "rh_tools", name="rightsholders"),
url(r"^rightsholders/campaign/(?P<id>\d+)/$", "manage_campaign", name="manage_campaign"),
url(r"^rightsholders/edition/(?P<work_id>\d*)/(?P<edition_id>\d*)$", "new_edition",{'by': 'rh'}, name="rh_edition"),
url(r"^rightsholders/claim/$", "claim", name="claim"),
url(r"^rh_admin/$", "rh_admin", name="rh_admin"),
url(r"^campaign_admin/$", "campaign_admin", name="campaign_admin"),

View File

@ -220,11 +220,9 @@ def work(request, work_id, action='display'):
'countdown': countdown,
})
def new_edition(request, work_id, edition_id):
def new_edition(request, work_id, edition_id, by=None):
if not request.user.is_authenticated() :
return render(request, "admins_only.html")
if not request.user.is_staff :
return render(request, "admins_only.html")
# if the work and edition are set, we save the edition and set the work
language='en'
description=''
@ -243,6 +241,12 @@ def new_edition(request, work_id, edition_id):
else:
work=None
if not request.user.is_staff :
if by == 'rh' and work is not None:
if not request.user in work.last_campaign().managers.all():
return render(request, "admins_only.html")
else:
return render(request, "admins_only.html")
if edition_id:
try:
edition = models.Edition.objects.get(id = edition_id)

View File

@ -125,8 +125,8 @@ STATIC_ROOT = '/var/www/static'
CELERYBEAT_SCHEDULE['report_new_ebooks'] = EBOOK_NOTIFICATIONS_JOB
# set -- sandbox or production Amazon FPS?
AMAZON_FPS_HOST = "fps.sandbox.amazonaws.com"
#AMAZON_FPS_HOST = "fps.amazonaws.com"
#AMAZON_FPS_HOST = "fps.sandbox.amazonaws.com"
AMAZON_FPS_HOST = "fps.amazonaws.com"
# if settings/local.py exists, import those settings -- allows for dynamic generation of parameters such as DATABASES
try:

View File

@ -1,12 +1,18 @@
// This autofills the pledge box when users select a premium tier.
var $j = jQuery.noConflict();
//give pledge box focus
$j(function() {
$j('#id_preapproval_amount').focus();
});
// This autofills the pledge box when users select a premium tier.
$j().ready(function() {
var inputbox = $j('#id_preapproval_amount');
$j('#premiums_list input').click(function() {
amount = $j(this).siblings('span.menu-item-price').html();
amount = amount.split('$')[1]
inputbox.val(amount);
amount = amount.split('$')[1];
current = inputbox.val();
if (current<amount)
{inputbox.val(amount);}
});
});
});