Files
Chad Whitacre 79afef5bd8 Fix bug with updating amounts; #635
This barely fixes the immediate problem. We really would need to
refactor to implement this properly, and possibly bring on a client-side
framework (Backbone, Ember, Angular, etc.). For example, we don't handle
the case when a tip change would make receiving greater than receiving,
so that we want to flip the display of those values in the box/card. Or
if this is the first tip received, we don't add that in. That kind of
thing.
2013-02-14 13:58:48 -05:00

188 lines
6.4 KiB
HTML

{% extends base.html %}
{% block box %}
<table class="on-profile{% if participant.is_suspicious %} is-suspicious{% end %}">
<tr>
<td class="picture">
<a href="/{{ participant.id }}/"><img src="{{ participant.get_img_src(128) }}" /></a>
</td>
<td class="giving-receiving">
{% set g = giving = participant.get_dollars_giving() %}
{% set r = receiving = participant.get_dollars_receiving() %}
{% if g > r and not participant.anonymous %}
<h2 class="pad-sign">{{ participant.id }} gives</h2>
<div class="number">
{% if user == participant %}
$<span class="total-giving">{{ giving }}</span>
{% else %}
${{ giving }}
{% end %}
</div>
<div class="unit pad-sign">per
week{% if r > 0 %}, and receives ${{ receiving }}{% end %}
</div>
{% elif r > 0 %}
<h2 class="pad-sign">{{ participant.id }} receives</h2>
<div class="number">${{ receiving }}</div>
<div class="unit pad-sign">per
week{% if g > 0 %}, and gives
{% if participant.anonymous %}
anonymously
{% elif user == participant %}
$<span class="total-giving">{{ giving }}</span>
{% else %}
${{ giving }}
{% end %}
{% end %}
</div>
{% else %}
{% set age = participant.get_age_in_seconds() %}
<h2>{{ participant.id }}
{% if g > 0 %}
gives anonymously
{% elif age < 60 %}
just joined Gittip! :D
{% elif age < (60 * 60 * 24 * 7) %}
joined recently
{% else %}
is lurking
{% end %}
</h2>
{% end %}
</td>
</tr>
</table>
{% if participant.id != user.id %}
<div class="buttons tips">
{% if locked %}
<div class="help with-padding">
This account has been locked by its owner.
</div>
{% elif user.ANON %}
<h2>Your Weekly Gift</h2>
{% for amount in AMOUNTS %}
<button class="tip-anon">${{ amount }}</button>
{% end %}
<div class="help with-padding">Sign in using
<a class="flash-me" href="{{ twitter.oauth_url(website, u'opt-in', path.decoded) }}">Twitter</a> or
<a href="{{ github.oauth_url(website, u'opt-in', path.decoded) }}">GitHub</a>
to give to <b>{{ participant.id }}</b>.</div>
{% else %}
{% set my_tip = user.get_tip_to(participant.id) %}
<h2>Your Weekly Gift</h2>
{% for amount in AMOUNTS %}
<button amount="{{ amount }}" tippee="{{ participant.id }}"
class="tip{{ ' selected' if amount == my_tip else '' }}">${{ amount }}</button>
{% end %}
{% if my_tip not in AMOUNTS %}
<span class="old-amount">
<button class="tip disabled selected">{{ my_tip }}</button>
<span class="old-amount-link">&mdash;
<a href="http://blog.gittip.com/post/26505682007/is-personal-funding-viable" target="_blank">old amount</a>!</span>
</span>
{% end %}
{% if user.last_bill_result is None %}
<div id="payment-prompt" class="help{% if my_tip > 0 %} needed{% end %}">
Back your gift with a <a href="/credit-card.html"
class="highlight">credit card</a> to make sure it goes
through!</div>
{% elif user.last_bill_result %}
<div id="payment-prompt" class="help really-needed">Fix your <a
href="/credit-card.html" class="highlight">credit
card</a> to make sure your gifts go through!</div>
{% end %}
{% end %}
</div>
{% end %}
{% block nav %}{% end %}
{% if participant.id == 'aaronsw' %}
<style>
.rip {
background: black;
text-align: center;
padding: 5px;
color: white;
}
.rip a {
display: block;
color: white;
}
</style>
<div class="rip">
<a href="http://news.ycombinator.com/item?id=5046845">RIP :`(</a>
</div>
<!--
After following Aaron's career for a decade, I interacted with him for the
first time three days before he committed suicide:
https://twitter.com/aaronsw/status/288664016723791873
:`(
-->
{% end %}
{% if user.ADMIN %}
<label class="is-suspicious-knob" data-participant-id="{{ participant.id }}">
Suspicious
<input type="checkbox"
{% if participant.is_suspicious %}checked="true"{% end %} />
</label>
{% elif participant.is_suspicious %}
<div class="is-suspicious-indicator">Suspicious</div>
{% end %}
{% end %}
{% block body %}
<h2>Share</h2>
<!-- http://developers.facebook.com/docs/reference/plugins/like/ -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-send="false" data-width="120" data-show-faces="false"></div>
<!-- https://dev.twitter.com/docs/tweet-button -->
<a href="https://twitter.com/share"
class="twitter-share-button" data-lang="en"
data-text="I just tipped a hard-working genius with Gittip. You can too:"
data-url="https://www.gittip.com/">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<!-- http://www.google.com/webmasters/+1/button/ -->
<g:plusone size="small" annotation="inline" width="120"></g:plusone>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
{% end %}