Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Rough in UI for account cancelation; #54
Browse files Browse the repository at this point in the history
Now that the three scripts involved in account cancelation have been
moved to (tested) methods on Participant, we're ready to wire up the UI.
This commit rebases the original work we did on the UI on top of the
separate line of development we ended up pursuing for the Participant
methods.
  • Loading branch information
chadwhitacre committed Jun 10, 2014
1 parent 9babe81 commit 2cd93f1
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 146 deletions.
84 changes: 0 additions & 84 deletions bin/deactivate.py

This file was deleted.

41 changes: 0 additions & 41 deletions bin/final-gift.py

This file was deleted.

19 changes: 0 additions & 19 deletions bin/untip.py

This file was deleted.

10 changes: 10 additions & 0 deletions js/gittip/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,14 @@ Gittip.account.init = function() {
return false;
});


// Wire up cancel knob.
// ====================

$('.cancel form').submit(function(e) {
e.stopPropagation();
e.preventDefault();
if (confirm("Really cancel account!? This can't be undone!"))
window.location.href = './cancel';
});
};
4 changes: 4 additions & 0 deletions js/gittip/cancel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Gittip.cancel = {};

Gittip.cancel.init = function() {
}
3 changes: 2 additions & 1 deletion scss/buttons-knobs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ button.selected:hover, button.selected.drag,
}

button.join-leave[data-is-member="true"],
.button.join-leave[data-is-member="true"] {
.button.join-leave[data-is-member="true"],
button.cancel-account {
font-weight: normal;
background: none;
color: $red;
Expand Down
12 changes: 11 additions & 1 deletion scss/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,14 @@
padding: 0;
text-transform: uppercase;
}
input {
input[type="radio"] + label {
display: inline;
margin: 0;
}
input[type="radio"]:disabled + label {
color: #888;
}
input:not([type]), input[type="text"] {
font: normal 11pt/14pt $Helvetica;
width: 292px;
margin: 0;
Expand All @@ -431,6 +438,9 @@
input.disabled {
color: $light-brown;
}
input[type="radio"] {
vertical-align: middle;
}

.half input {
width: 137px;
Expand Down
57 changes: 57 additions & 0 deletions www/%username/account/cancel.spt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
from gittip.utils import get_participant
[---]
participant = get_participant(request, restrict=True)
hero = "Cancel Account"
title = participant.username # used in the title tag
username = participant.username # used in footer shared with on/$platform/
# pages

can_upstream = participant.get_dollars_receiving() > 0
can_downstream = participant.get_dollars_giving() > 0

if POST:
final_disbursement_option = request.body['final_disbursement_option']
participant.cancel(final_disbursement_option)
request.redirect('/')
[---] text/html
{% extends "templates/base.html" %}

{% block heading %}
<h2 class="top"><span>Cancel Account</span></h2>
{% endblock %}

{% block box %}
<div class="on-form">
<form method="POST">
<div class="constrain-width group" style="margin-top: 35px;">
{% if participant.balance > 0 %}
<p>You have a balance of ${{ participant.balance }}.
What should we do with it?</p>

<ul>
<li><input type="radio" name="final_disbursement_option" id="r2"
value="bank" checked />
<label for="r2">Send it to my bank account</label></li>
<li><input type="radio" name="final_disbursement_option" id="r3"
value="upstream" {{ 'disabled' if not can_upstream }} />
<label for="r3">Refund it to my patrons</label></li>
<li><input type="radio" name="final_disbursement_option" id="r4"
value="downstream" {{ 'disabled' if not can_downstream }} />
<label for="r4">Give it to my tippees</label></li>
</ul>
{% endif %}
<p>Here's what we'll do when you cancel your account:</p>
<ul>
<li>Turn off all tips you are currently receiving.</li>
<li>Zero out all tips you are currently receiving.</li>
<li>Make it so there are no more you are currently receiving.</li>
</ul>
</div>
<div class="nav level-1">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="selected larger cancel-account" id="save"
type="submit">Cancel My Gittip Account</button>
</div>
</form>
</div>
{% endblock %}
11 changes: 11 additions & 0 deletions www/%username/account/index.html.spt
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@ locked = False
</td>
</tr>
</table>

<!-- Cancel Account! -->
<div class="cancel">
<h2>Cancel</h2>
<form action="./cancel" method="GET">
<div class="buttons">
<button class="cancel-account" type="submit">Cancel Account</button>
</div>
</form>
</div>

</div>
</div>
{% endblock %}

0 comments on commit 2cd93f1

Please sign in to comment.