From 0cdac29c22b945bf853541dce32e41672c547979 Mon Sep 17 00:00:00 2001 From: eric Date: Sun, 13 May 2012 15:32:32 -0400 Subject: [PATCH 1/4] apply intcomma to currency display everywhere and add humanize --- frontend/templates/book_panel.html | 7 ++++--- frontend/templates/campaign_detail.html | 5 +++-- frontend/templates/manage_campaign.html | 9 +++++---- .../templates/notification/pledge_charged/full.txt | 4 ++-- .../notification/pledge_status_change/full.txt | 4 ++-- .../notification/pledge_you_have_pledged/full.txt | 7 ++----- .../notification/pledge_you_have_pledged/notice.html | 5 +++-- .../templates/notification/wishlist_active/full.txt | 2 +- .../notification/wishlist_active/notice.html | 3 ++- .../notification/wishlist_near_deadline/full.txt | 9 ++++----- .../notification/wishlist_near_target/full.txt | 4 ++-- .../wishlist_premium_limited_supply/full.txt | 4 ++-- .../notification/wishlist_price_drop/full.txt | 4 ++-- frontend/templates/pledge.html | 9 +++++---- frontend/templates/pledge_cancel.html | 3 ++- frontend/templates/pledge_complete.html | 3 ++- frontend/templates/sidebar_pledge_complete.html | 7 ++++--- frontend/templates/work.html | 11 ++++++----- settings/common.py | 1 + 19 files changed, 54 insertions(+), 47 deletions(-) diff --git a/frontend/templates/book_panel.html b/frontend/templates/book_panel.html index 9124e6cc..b91db926 100644 --- a/frontend/templates/book_panel.html +++ b/frontend/templates/book_panel.html @@ -1,3 +1,4 @@ +{% load humanize %} {% with work.first_ebook as first_ebook %} {% with work.last_campaign.supporters as supporters %} {% with work.cover_image_thumbnail as thumbnail %} @@ -19,13 +20,13 @@ {% else %}{% if status == 'SUCCESSFUL' %} UNGLUED!

On: {{ deadline|date:"M d, Y" }}

-

Raised: {{ work.last_campaign.current_total }}

+

Raised: {{ work.last_campaign.current_total|intcomma }}

{% if first_ebook %}{% endif %}Read it Now
{% else %}{% if status == 'ACTIVE' %} UNGLUE IT! -

${{ work.last_campaign.current_total }} raised

${{ work.last_campaign.target }} needed

+

${{ work.last_campaign.current_total|intcomma }} raised

${{ work.last_campaign.target|intcomma }} needed

by {{ deadline|date:"M d, Y" }}

Support
@@ -148,7 +149,7 @@
{% if not is_preview %} {% ifequal status "ACTIVE" %} - ${{ work.last_campaign.current_total }} raised of ${{ work.last_campaign.target }} goal + ${{ work.last_campaign.current_total|intcomma }} raised of ${{ work.last_campaign.target|intcomma }} goal {% else %}{% if status == "INITIALIZED" %} Status: Coming soon! {% else %} diff --git a/frontend/templates/campaign_detail.html b/frontend/templates/campaign_detail.html index 69ac924c..494ca230 100644 --- a/frontend/templates/campaign_detail.html +++ b/frontend/templates/campaign_detail.html @@ -1,3 +1,4 @@ +{% load humanize %} {% extends "base.html" %} {% url privacy as privacyurl %} @@ -24,7 +25,7 @@

Campaign: {{campaign.name}}

Work: {{campaign.work}}

-

Target: {{campaign.target}}

+

Target: {{campaign.target|intcomma}}

Deadline: {{campaign.deadline}}

Status: {{campaign.status}}

ISBN: {{campaign.work.first_isbn_13}}

@@ -32,7 +33,7 @@

Embed a widget:

PayPal receiver: {{campaign.paypal_receiver}}

-

Current total (pledged/authorized): {{campaign.current_total}}

+

Current total (pledged/authorized): {{campaign.current_total|intcomma}}

{% csrf_token %} {{form.as_p}} diff --git a/frontend/templates/manage_campaign.html b/frontend/templates/manage_campaign.html index ce0bcaaf..9e118ef7 100644 --- a/frontend/templates/manage_campaign.html +++ b/frontend/templates/manage_campaign.html @@ -1,3 +1,4 @@ +{% load humanize %} {% extends "basedocumentation.html" %} {% block title %}Campaign Management{% endblock %} @@ -78,7 +79,7 @@ Please fix the following before launching your campaign:
- {{ work.last_campaign.supporters.count }} Ungluers have pledged ${{ work.last_campaign.current_total }} + {{ work.last_campaign.supporters.count }} Ungluers have pledged ${{ work.last_campaign.current_total|intcomma }}
book list status @@ -145,7 +146,7 @@ Please fix the following before launching your campaign: {% ifnotequal campaign_status 'ACTIVE' %}

Target Price

-

This is the target price for your campaign. Once you launch the campaign, you won't be able to increase it. The mimimum target is ${{form.minimum_target}} .

+

This is the target price for your campaign. Once you launch the campaign, you won't be able to increase it. The mimimum target is ${{form.minimum_target|intcomma}} .

{{ form.target.errors }}{{ form.target }}

License being offered

This is the license you are offering to use once the campaign succeeds. For more info on the licenses you can use, see Creative Commons: About the Licenses.

@@ -158,7 +159,7 @@ Please fix the following before launching your campaign: {% else %}

Target Price

-

The current target price for your campaign is ${{ campaign.target }}. Since your campaign is active, you may lower, but not raise, this target.

+

The current target price for your campaign is ${{ campaign.target|intcomma }}. Since your campaign is active, you may lower, but not raise, this target.

${{ form.target.errors }}{{ form.target }}

License being offered

@@ -194,7 +195,7 @@ Please fix the following before launching your campaign: {% for premium in premiums %}
  • - ${{ premium.amount }} + ${{ premium.amount|intcomma }} {{ premium.description }} {% if premium.type %}
    Type: {{ premium.get_type_display }}
    {% endif %} diff --git a/frontend/templates/notification/pledge_charged/full.txt b/frontend/templates/notification/pledge_charged/full.txt index cca7a2fd..32f5e9fa 100644 --- a/frontend/templates/notification/pledge_charged/full.txt +++ b/frontend/templates/notification/pledge_charged/full.txt @@ -1,9 +1,9 @@ -Congratulations! +{% load humanize %}Congratulations! Thanks to you and other ungluers, {{ work.title }} will be released to the world in an unglued ebook edition. {{ payment_processor }} will now charge your credit card. Pledge Summary -Amount pledged: {{ amount }} +Amount pledged: {{ amount|intcomma }} Premium: {{ premium }} We will notify you when the unglued ebook is available for you to read. If you've requested special premiums, the rights holder, {{ campaign.rightsholder }}, will be in touch with you via email to request any information needed to deliver your premium. diff --git a/frontend/templates/notification/pledge_status_change/full.txt b/frontend/templates/notification/pledge_status_change/full.txt index 0c489cd8..dbdb1a64 100644 --- a/frontend/templates/notification/pledge_status_change/full.txt +++ b/frontend/templates/notification/pledge_status_change/full.txt @@ -1,7 +1,7 @@ -You have modified a pledge that you had previously made to the campaign to unglue {{ campaign.work.title }} +{% load humanize %}You have modified a pledge that you had previously made to the campaign to unglue {{ campaign.work.title }} Your new pledge summary -Amount pledged: {{ amount }} +Amount pledged: {{ amount|intcomma }} Premium: {{ premium }} If you'd like to visit the project page, click here: diff --git a/frontend/templates/notification/pledge_you_have_pledged/full.txt b/frontend/templates/notification/pledge_you_have_pledged/full.txt index ce324b6d..017a44b8 100644 --- a/frontend/templates/notification/pledge_you_have_pledged/full.txt +++ b/frontend/templates/notification/pledge_you_have_pledged/full.txt @@ -1,10 +1,7 @@ -{% with work.title as title %} -{% with site.domain as domain %} -{% with work.id as work_id %} -Thank you, {{ transaction.user.username }}! You have pledged to unglue {{ title }}. If this campaign successfully raises ${{ campaign.target }} by {{ campaign.deadline|date:"M d Y" }}, this book will be released in an unglued ebook edition for all to enjoy. +{% load humanize %}{% with work.title as title %}{% with site.domain as domain %}{% with work.id as work_id %}Thank you, {{ transaction.user.username }}! You have pledged to unglue {{ title }}. If this campaign successfully raises ${{ campaign.target|intcomma }} by {{ campaign.deadline|date:"M d Y" }}, this book will be released in an unglued ebook edition for all to enjoy. Pledge summary -Amount pledged: ${{ transaction.amount }} +Amount pledged: ${{ transaction.amount|intcomma }} Premium: {{ transaction.premium.description }} You can help even more by sharing this campaign with your friends. diff --git a/frontend/templates/notification/pledge_you_have_pledged/notice.html b/frontend/templates/notification/pledge_you_have_pledged/notice.html index b43d3be6..f1c0e3eb 100644 --- a/frontend/templates/notification/pledge_you_have_pledged/notice.html +++ b/frontend/templates/notification/pledge_you_have_pledged/notice.html @@ -1,3 +1,4 @@ +{% load humanize %}
    cover image for {{ work.title }} @@ -5,12 +6,12 @@
    - You've just pledged ${{ transaction.amount }} to {{ work.title }}. + You've just pledged ${{ transaction.amount|intcomma }} to {{ work.title }}.

    Thank you, {{transaction.user.username}},

    -

    You've just pledged ${{ transaction.amount }} to {{ work.title }}. If it reaches its goal of ${{ campaign.target }} by {{ campaign.deadline|date:"M d Y"}}, it will be unglued for all to enjoy.

    +

    You've just pledged ${{ transaction.amount|intcomma }} to {{ work.title }}. If it reaches its goal of ${{ campaign.target|intcomma }} by {{ campaign.deadline|date:"M d Y"}}, it will be unglued for all to enjoy.

    You can help even more by sharing this campaign with your friends!

    • Email it!
    • Tweet it!
    • diff --git a/frontend/templates/notification/wishlist_active/full.txt b/frontend/templates/notification/wishlist_active/full.txt index 3e80e20b..fd0cf995 100644 --- a/frontend/templates/notification/wishlist_active/full.txt +++ b/frontend/templates/notification/wishlist_active/full.txt @@ -1,4 +1,4 @@ -Congratulations, you wished for it, and now there is an active Campaign for {{ campaign.work.title }} to be unglued. If ungluers like you pledge {{ campaign.target }} by {{ campaign.deadline }}, this book will be released under a Creative Commons license for everyone to enjoy. +{% load humanize %}Congratulations, you wished for it, and now there is an active Campaign for {{ campaign.work.title }} to be unglued. If ungluers like you pledge {{ campaign.target|intcomma }} by {{ campaign.deadline }}, this book will be released under a Creative Commons license for everyone to enjoy. You can help! diff --git a/frontend/templates/notification/wishlist_active/notice.html b/frontend/templates/notification/wishlist_active/notice.html index 25615dee..92c124ea 100644 --- a/frontend/templates/notification/wishlist_active/notice.html +++ b/frontend/templates/notification/wishlist_active/notice.html @@ -1,3 +1,4 @@ +{% load humanize %} {% with campaign.work.id as id %} {% with campaign.work.title as title %} @@ -11,7 +12,7 @@ The rights holder, {{ active_claim.rights_holder.rights_holder_name }}, has launched a campaign for {{ title }}!
    -
    Congratulations! You wished for a campaign, and here it is. If ungluers like you pledge {{ campaign.target }} by {{ campaign.deadline|date:"M d, Y" }}, {{ title }} will be released under a Creative Commons license for all to enjoy.
    +
    Congratulations! You wished for a campaign, and here it is. If ungluers like you pledge {{ campaign.target|intcomma }} by {{ campaign.deadline|date:"M d, Y" }}, {{ title }} will be released under a Creative Commons license for all to enjoy.
    You can help! Pledge any amount, and use the sharing options on the campaign page to tell your friends.
    diff --git a/frontend/templates/notification/wishlist_near_deadline/full.txt b/frontend/templates/notification/wishlist_near_deadline/full.txt index ea1ba40d..e344a1b1 100644 --- a/frontend/templates/notification/wishlist_near_deadline/full.txt +++ b/frontend/templates/notification/wishlist_near_deadline/full.txt @@ -1,8 +1,7 @@ -{% if campaign.left > 0 %} - The campaign to unglue a book you've wishlisted, {{ campaign.work.title}}, is almost out of time. We need to raise ${{ campaign.left }} more by {{ campaign.deadline }} in order to give this book to the world. +{% load humanize %}{% if campaign.left > 0 %} The campaign to unglue a book you've wishlisted, {{ campaign.work.title}}, is almost out of time. We need to raise ${{ campaign.left|intcomma }} more by {{ campaign.deadline }} in order to give this book to the world. {% if pledged %} - Your pledge of {{ amount }} is helping {{ campaign.work.title }} to reach its goal, but we can only unglue this book if the campaign succeeds. You can help your pledge go farther by sharing the campaign (https://{{ site.domain }}{% url work work_id=campaign.work.id %}) with your friends through your favorite media: tweet, Facebook, Tumblr, blog, G+, Pinterest, email, carrier pigeon, or good old-fashioned conversation. + Your pledge of {{ amount|intcomma }} is helping {{ campaign.work.title }} to reach its goal, but we can only unglue this book if the campaign succeeds. You can help your pledge go farther by sharing the campaign (https://{{ site.domain }}{% url work work_id=campaign.work.id %}) with your friends through your favorite media: tweet, Facebook, Tumblr, blog, G+, Pinterest, email, carrier pigeon, or good old-fashioned conversation. {% else %} We need your pledge to reach this target. Any amount helps. You can chip in towards giving this book to the world at https://{{ site.domain }}{% url pledge work_id=campaign.work.id %} . @@ -12,10 +11,10 @@ Thank you! {% else %} - The campaign to unglue a book you've wishlisted, {{ campaign.work.title}}, is on track to succeed! It has met its target price of {{ campaign.target }} and will close soon. + The campaign to unglue a book you've wishlisted, {{ campaign.work.title}}, is on track to succeed! It has met its target price of {{ campaign.target|intcomma }} and will close soon. {% if pledged %} - Your pledge of {{ amount }} is helping us give this book to the world. Thank you! When the campaign closes, we'll be in touch about how and when you'll receive your premiums. + Your pledge of ${{ amount|intcomma }} is helping us give this book to the world. Thank you! When the campaign closes, we'll be in touch about how and when you'll receive your premiums. {% else %} If you wanted to support this campaign, this is your last chance. Pledge by midnight (Eastern US time) if you want to help the campaign or receive any premiums: https://{{ site.domain }}{% url pledge work_id=campaign.work.id %} {% endif %} diff --git a/frontend/templates/notification/wishlist_near_target/full.txt b/frontend/templates/notification/wishlist_near_target/full.txt index e256a90b..481714fb 100644 --- a/frontend/templates/notification/wishlist_near_target/full.txt +++ b/frontend/templates/notification/wishlist_near_target/full.txt @@ -1,7 +1,7 @@ -The campaign to unglue a book you've wishlisted, {{ campaign.work.title}}, is close to succeeding! We only need to raise ${{ campaign.left }} more by {{ campaign.deadline }} in order to give this book to the world. +{% load humanize %}The campaign to unglue a book you've wishlisted, {{ campaign.work.title}}, is close to succeeding! We only need to raise ${{ campaign.left|intcomma }} more by {{ campaign.deadline }} in order to give this book to the world. {% if pledged %} - Your pledge of {{ amount }} is helping {{ campaign.work.title }} to reach its goal, but we can only unglue this book if the campaign succeeds. You can tip the balance by sharing the campaign (https://{{ site.domain }}{% url work work_id=campaign.work.id %}) with your friends through your favorite media: tweet, Facebook, Tumblr, blog, G+, Pinterest, email, carrier pigeon, or good old-fashioned conversation. + Your pledge of {{ amount|intcomma }} is helping {{ campaign.work.title }} to reach its goal, but we can only unglue this book if the campaign succeeds. You can tip the balance by sharing the campaign (https://{{ site.domain }}{% url work work_id=campaign.work.id %}) with your friends through your favorite media: tweet, Facebook, Tumblr, blog, G+, Pinterest, email, carrier pigeon, or good old-fashioned conversation. {% else %} We need your pledge to reach this target. Any amount helps. You can chip in towards giving this book to the world at https://{{ site.domain }}{% url pledge work_id=campaign.work.id %} . diff --git a/frontend/templates/notification/wishlist_premium_limited_supply/full.txt b/frontend/templates/notification/wishlist_premium_limited_supply/full.txt index 85efd8e9..cd014797 100644 --- a/frontend/templates/notification/wishlist_premium_limited_supply/full.txt +++ b/frontend/templates/notification/wishlist_premium_limited_supply/full.txt @@ -1,7 +1,7 @@ -Did you want one of the limited-edition premiums for the campaign to unglue {{ campaign.work.title }}? This is your last chance -- there's only one left! +{% load humanize %}Did you want one of the limited-edition premiums for the campaign to unglue {{ campaign.work.title }}? This is your last chance -- there's only one left! Premium: {{ premium.description }} -Amount: {{ premium.amount }} +Amount: {{ premium.amount|intcomma }} If you'd like to claim the last one, pledge here: https://{{ site.domain }}{% url pledge work_id=campaign.work.id %} diff --git a/frontend/templates/notification/wishlist_price_drop/full.txt b/frontend/templates/notification/wishlist_price_drop/full.txt index 8aa040e7..49c5f23c 100644 --- a/frontend/templates/notification/wishlist_price_drop/full.txt +++ b/frontend/templates/notification/wishlist_price_drop/full.txt @@ -1,7 +1,7 @@ -Good news! The rights holder, {{ campaign.rightsholder }}, has lowered the target price to ${{ campaign.target }} for {{ campaign.work.title }}. Now we only need to raise ${{ campaign.left }} by {{ campaign.deadline }} in order to give this book to the world. +{% load humanize %}Good news! The rights holder, {{ campaign.rightsholder }}, has lowered the target price to ${{ campaign.target|intcomma }} for {{ campaign.work.title }}. Now we only need to raise ${{ campaign.left|intcomma }} by {{ campaign.deadline }} in order to give this book to the world. {% if pledged %} - Your pledge of {{ amount }} is now going even farther toward helping {{ campaign.work.title }} to reach its goal. Still, we can only unglue this book if the campaign succeeds. You can help by sharing the campaign (https://{{ site.domain }}{% url work work_id=campaign.work.id %}) with your friends through your favorite media: tweet, Facebook, Tumblr, blog, G+, Pinterest, email, carrier pigeon, or good old-fashioned conversation. + Your pledge of {{ amount|intcomma }} is now going even farther toward helping {{ campaign.work.title }} to reach its goal. Still, we can only unglue this book if the campaign succeeds. You can help by sharing the campaign (https://{{ site.domain }}{% url work work_id=campaign.work.id %}) with your friends through your favorite media: tweet, Facebook, Tumblr, blog, G+, Pinterest, email, carrier pigeon, or good old-fashioned conversation. {% else %} The target may be lower, but we still need your help to reach it. Pledges of any amount help. You can chip in towards giving this book to the world at https://{{ site.domain }}{% url pledge work_id=campaign.work.id %} . diff --git a/frontend/templates/pledge.html b/frontend/templates/pledge.html index 4e334717..64daccc1 100644 --- a/frontend/templates/pledge.html +++ b/frontend/templates/pledge.html @@ -1,3 +1,4 @@ +{% load humanize %} {% extends "basepledge.html" %} {% block title %}Pledge{% endblock %} @@ -29,14 +30,14 @@
    - ${{ work.last_campaign.target }} needed by
    + ${{ work.last_campaign.target|intcomma }} needed by
    {{ work.last_campaign.deadline }}
    - {{ work.last_campaign.supporters.count }} Ungluers have pledged ${{ work.last_campaign.current_total }} + {{ work.last_campaign.supporters.count }} Ungluers have pledged ${{ work.last_campaign.current_total|intcomma }}
    book list status @@ -50,7 +51,7 @@ {% if faqmenu == 'modify' %}
    You've already pledged to this campaign.
    - Amount: ${{preapproval_amount}}.
    + Amount: ${{preapproval_amount|intcomma}}.
    Your premium: {% if premium_description %}{{ premium_description }}{% else %}You did not request a premium for this campaign.{% endif %}
    If you would like to modify your pledge, please use the following form.
    {% endif %} @@ -76,7 +77,7 @@
  • - ${{ premium.amount }} + ${{ premium.amount|intcomma }} {{ premium.description }} {% ifnotequal premium.limit 0 %}
    Only {{ premium.premium_remaining }} remaining! {% endifnotequal %} diff --git a/frontend/templates/pledge_cancel.html b/frontend/templates/pledge_cancel.html index be8bcdaa..58bf274c 100644 --- a/frontend/templates/pledge_cancel.html +++ b/frontend/templates/pledge_cancel.html @@ -1,3 +1,4 @@ +{% load humanize %} {% extends "basepledge.html" %} {% block title %}Pledge Cancelled{% endblock %} @@ -9,7 +10,7 @@ {% block doccontent %} {% if transaction %} -
    You've asked to cancel your pledge of ${{ transaction.amount }} to {{ work.title }} Did you mean to do this?
    +
    You've asked to cancel your pledge of ${{ transaction.amount|intcomma }} to {{ work.title }} Did you mean to do this?
    Yes, cancel my pledge
    Whoops, don't cancel!
    {% comment %} diff --git a/frontend/templates/pledge_complete.html b/frontend/templates/pledge_complete.html index ab9bab7a..ae52dd7a 100644 --- a/frontend/templates/pledge_complete.html +++ b/frontend/templates/pledge_complete.html @@ -1,3 +1,4 @@ +{% load humanize %} {% extends "basepledge.html" %} {% block title %}Pledge Completed{% endblock %} @@ -28,7 +29,7 @@

    Thank you!

    -

    You've just pledged ${{ transaction.amount }} to {{ work.title }}. If it reaches its goal of ${{ campaign.target }} by {{ campaign.deadline|date:"M d Y"}}, it will be unglued for all to enjoy.

    +

    You've just pledged ${{ transaction.amount|intcomma }} to {{ work.title }}. If it reaches its goal of ${{ campaign.target|intcomma }} by {{ campaign.deadline|date:"M d Y"}}, it will be unglued for all to enjoy.

    You can help even more by sharing this campaign with your friends:

    Copy/paste this into your site:
    diff --git a/frontend/templates/sidebar_pledge_complete.html b/frontend/templates/sidebar_pledge_complete.html index 7aaff4ba..1b7a981c 100644 --- a/frontend/templates/sidebar_pledge_complete.html +++ b/frontend/templates/sidebar_pledge_complete.html @@ -1,3 +1,4 @@ +{% load humanize %}