check to see if people have pledged and if so direct them to pledge_modify from sidebar rather than spawning new pledge

pull/1/head
Andromeda Yelton 2012-05-13 15:23:04 -04:00
parent ea5664b08c
commit 9a6ea26266
4 changed files with 69 additions and 27 deletions

View File

@ -45,14 +45,17 @@
</div> </div>
</div> </div>
<div class="jsmodule rounded"> <div class="jsmodule rounded clearfix">
<div class="jsmod-content"> <div class="jsmod-content">
{% if faqmenu == 'modify' %} {% if faqmenu == 'modify' %}
<div>You've already pledged to this campaign.<hr/> <div class="modify_notification clearfix"><h4>You've already pledged to this campaign:</h4>
Amount: ${{preapproval_amount}}.<br /> <div>
Your premium: {% if premium_description %}{{ premium_description }}{% else %}You did not request a premium for this campaign.{% endif %}<br/> Amount: ${{preapproval_amount}}.<br />
If you would like to modify your pledge, please use the following form.</div> Your premium: {% if premium_description %}{{ premium_description }}{% else %}You did not request a premium for this campaign.{% endif %}<br/>
</div>
<br /> You can modify your pledge below.
</div>
{% endif %} {% endif %}
{% comment %} {% comment %}
@ -89,8 +92,8 @@
<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"{% endif %} id="pledgesubmit" />
</form> </form>
</div> </div>
</div>
{% if faqmenu == 'modify' %}<div>We hope you won't, but of course you're also free to <a href="{% url pledge_cancel %}?tid={{ tid }}">cancel your pledge</a>.</div>{% endif %} {% if faqmenu == 'modify' %}<div class="spacer"></div><div>We hope you won't, but of course you're also free to <a href="{% url pledge_cancel %}?tid={{ tid }}">cancel your pledge</a>.</div>{% endif %}
{% endblock %} {% endblock %}

View File

@ -51,6 +51,7 @@ $j(document).ready(function(){
{% block content %} {% block content %}
{% with work.last_campaign_status as status %} {% with work.last_campaign_status as status %}
{% with work.id as work_id %}
<div id="main-container"> <div id="main-container">
<div class="js-main"> <div class="js-main">
<div id="js-leftcol"> <div id="js-leftcol">
@ -122,9 +123,9 @@ $j(document).ready(function(){
</div> </div>
{% if status == 'ACTIVE' %} {% if status == 'ACTIVE' %}
{% if pledged %} {% if pledged %}
<div class="btn_support modify"><form action="{% url pledge_modify work_id=work.id %}" method="get"><input type="submit" value="Modify Pledge" /></form></div> <div class="btn_support modify"><form action="{% url pledge_modify work_id %}" method="get"><input type="submit" value="Modify Pledge" /></form></div>
{% else %} {% else %}
<div class="btn_support"><form action="{% url pledge work_id=work.id %}" method="get"><input type="submit" value="Support" /></form></div> <div class="btn_support"><form action="{% url pledge work_id %}" method="get"><input type="submit" value="Support" /></form></div>
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div>
@ -159,13 +160,13 @@ $j(document).ready(function(){
{% if work.googlebooks_id %} {% if work.googlebooks_id %}
<a id="find-google" href="{{ work.googlebooks_url }}"><img src="/static/images/supporter_icons/googlebooks_square.png" title="Find on Google Books" alt="Find on Google Books" /></a> <a id="find-google" href="{{ work.googlebooks_url }}"><img src="/static/images/supporter_icons/googlebooks_square.png" title="Find on Google Books" alt="Find on Google Books" /></a>
{% endif %} {% endif %}
<a rel="nofollow" class="find-openlibrary" href="{% url work_openlibrary work.id %}"><img src="/static/images/supporter_icons/openlibrary_square.png" title="Find on OpenLibrary" alt="Find on OpenLibrary" /></a> <a rel="nofollow" class="find-openlibrary" href="{% url work_openlibrary work_id %}"><img src="/static/images/supporter_icons/openlibrary_square.png" title="Find on OpenLibrary" alt="Find on OpenLibrary" /></a>
{% if not request.user.is_anonymous %} {% if not request.user.is_anonymous %}
{% if request.user.profile.goodreads_user_link %} {% if request.user.profile.goodreads_user_link %}
<a rel="nofollow" class="find-goodreads" href="{% url work_goodreads work.id %}"><img src="/static/images/supporter_icons/goodreads_square.png" title="Find on GoodReads" alt="Find on GoodReads" /></a> <a rel="nofollow" class="find-goodreads" href="{% url work_goodreads work_id %}"><img src="/static/images/supporter_icons/goodreads_square.png" title="Find on GoodReads" alt="Find on GoodReads" /></a>
{% endif %} {% endif %}
{% if request.user.profile.librarything_id %} {% if request.user.profile.librarything_id %}
<a rel="nofollow" class="find-librarything" href="{% url work_librarything work.id %}"><img src="/static/images/supporter_icons/librarything_square.png" title="Find on LibraryThing" alt="Find on LibraryThing" /></a> <a rel="nofollow" class="find-librarything" href="{% url work_librarything work_id %}"><img src="/static/images/supporter_icons/librarything_square.png" title="Find on LibraryThing" alt="Find on LibraryThing" /></a>
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div>
@ -197,7 +198,7 @@ $j(document).ready(function(){
<div class="btn_wishlist" id="wishlist_actions"> <div class="btn_wishlist" id="wishlist_actions">
{% if request.user.is_anonymous %} {% if request.user.is_anonymous %}
<div class="create-account"> <div class="create-account">
<span title="{% url work work.id %}">Login to Add</span> <span title="{% url work work_id %}">Login to Add</span>
</div> </div>
{% else %}{% if request.user.id in work.last_campaign.supporters %} {% else %}{% if request.user.id in work.last_campaign.supporters %}
<div class="add-wishlist"> <div class="add-wishlist">
@ -205,11 +206,11 @@ $j(document).ready(function(){
</div> </div>
{% else %}{% if work in request.user.wishlist.works.all %} {% else %}{% if work in request.user.wishlist.works.all %}
<div class="remove-wishlist-workpage"> <div class="remove-wishlist-workpage">
<span id="w{{ work.id }}">Remove This</span> <span id="w{{ work_id }}">Remove This</span>
</div> </div>
{% else %} {% else %}
<div class="add-wishlist"> <div class="add-wishlist">
<span class="work_id" id="w{{ work.id }}">Add to Wishlist</span> <span class="work_id" id="w{{ work_id }}">Add to Wishlist</span>
</div> </div>
{% endif %}{% endif %}{% endif %} {% endif %}{% endif %}{% endif %}
</div> </div>
@ -321,7 +322,7 @@ $j(document).ready(function(){
<h4>Editions</h4> <h4>Editions</h4>
{% if user.is_staff %} {% if user.is_staff %}
<div><a href="{% url new_edition work.id edition.id %}">Create a new edition for this work</a><br /><br /></div> <div><a href="{% url new_edition work_id edition.id %}">Create a new edition for this work</a><br /><br /></div>
{% endif %} {% endif %}
{% if alert %}<div class="alert"><b>Ebook Contribution:</b><br />{{ alert }}</div>{% endif %} {% if alert %}<div class="alert"><b>Ebook Contribution:</b><br />{{ alert }}</div>{% endif %}
@ -336,7 +337,7 @@ $j(document).ready(function(){
OCLC: <a href="http://www.worldcat.org/oclc/{{ edition.oclc }}">{{ edition.oclc }}</a><br /> OCLC: <a href="http://www.worldcat.org/oclc/{{ edition.oclc }}">{{ edition.oclc }}</a><br />
{% endif %} {% endif %}
{% if user.is_staff %} {% if user.is_staff %}
<a href="{% url new_edition work.id edition.id %}">Edit this edition</a><br /> <a href="{% url new_edition work_id edition.id %}">Edit this edition</a><br />
{% endif %} {% endif %}
{% if edition.googlebooks_id %} {% if edition.googlebooks_id %}
See <a href="https://encrypted.google.com/books?id={{ edition.googlebooks_id }}">this edition on Google Books</a> See <a href="https://encrypted.google.com/books?id={{ edition.googlebooks_id }}">this edition on Google Books</a>
@ -391,16 +392,29 @@ $j(document).ready(function(){
<h3 class="jsmod-title"><span>Support</span></h3> <h3 class="jsmod-title"><span>Support</span></h3>
<div class="jsmod-content"> <div class="jsmod-content">
<ul class="support menu"> <ul class="support menu">
{% for premium in premiums %} {% if pledged %}
{% if premium.limit == 0 or premium.limit > premium.premium_count %} {% for premium in premiums %}
<li class="{% if forloop.first %}first{% else %}{% if forloop.last %}last{% endif %}{% endif %}"> {% if premium.limit == 0 or premium.limit > premium.premium_count %}
<a href="{% url pledge work_id=work.id %}?premium_id={{premium.id}}"> <li class="{% if forloop.first %}first{% else %}{% if forloop.last %}last{% endif %}{% endif %}">
<span class="menu-item-price">${{ premium.amount }}</span> <a href="{% url pledge_modify work_id %}?premium_id={{premium.id}}">
<span class="menu-item-desc">{{ premium.description }}</span> <span class="menu-item-price">${{ premium.amount }}</span>
{% ifnotequal premium.limit 0 %}<br /> Only {{ premium.premium_remaining }} remaining! {% endifnotequal %} <span class="menu-item-desc">{{ premium.description }}</span>
</a></li> {% ifnotequal premium.limit 0 %}<br /> Only {{ premium.premium_remaining }} remaining! {% endifnotequal %}
</a></li>
{% endif %}
{% endfor %}
{% else %}
{% for premium in premiums %}
{% if premium.limit == 0 or premium.limit > premium.premium_count %}
<li class="{% if forloop.first %}first{% else %}{% if forloop.last %}last{% endif %}{% endif %}">
<a href="{% url pledge work_id %}?premium_id={{premium.id}}">
<span class="menu-item-price">${{ premium.amount }}</span>
<span class="menu-item-desc">{{ premium.description }}</span>
{% ifnotequal premium.limit 0 %}<br /> Only {{ premium.premium_remaining }} remaining! {% endifnotequal %}
</a></li>
{% endif %}
{% endfor %}
{% endif %} {% endif %}
{% endfor %}
</ul> </ul>
</div> </div>
</div> </div>
@ -410,4 +424,5 @@ $j(document).ready(function(){
</div> </div>
</div> </div>
{% endwith %} {% endwith %}
{% endwith %}
{% endblock %} {% endblock %}

View File

@ -124,3 +124,15 @@ p {
.jsmodule.pledge .jsmod-content { .jsmodule.pledge .jsmod-content {
float: right !important; float: right !important;
} }
.modify_notification {
width: 452px;
margin-bottom: 7px;
border: solid 2px #8dc63f;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
padding: 7px;
}
.modify_notification h4 {
margin: 0 0 5px 0;
}

View File

@ -43,3 +43,15 @@ p {
float: right !important; float: right !important;
} }
} }
.modify_notification {
width: 452px;
margin-bottom: 7px;
border: solid 2px @call-to-action;
.one-border-radius(5px);
padding: 7px;
h4 {
margin: 0 0 5px 0;
}
}