mirror of
https://github.com/kennethreitz-archive/www.gittip.com.git
synced 2026-06-21 15:50:59 +00:00
07c43280d0
I moved the sentence about collecting money out of parentheses. It was the only thing on the page in parentheses and seemed like a main enough concept to warrant its own sentence.
164 lines
4.9 KiB
HTML
164 lines
4.9 KiB
HTML
"""Twitter user page on Gittip.
|
|
"""
|
|
import datetime
|
|
import decimal
|
|
|
|
import requests
|
|
from aspen import json, Response, log
|
|
from aspen.utils import to_age, utc
|
|
from gittip import AMOUNTS, CARDINALS, db
|
|
from gittip.elsewhere import twitter
|
|
from gittip.models import Participant
|
|
# ========================================================================== ^L
|
|
|
|
# Try to load from Twitter.
|
|
# =========================
|
|
|
|
user_info = twitter.get_user_info(path['screen_name'])
|
|
|
|
|
|
# Try to load from Gittip.
|
|
# ========================
|
|
|
|
username = user_info['screen_name']
|
|
name = user_info.get('name')
|
|
if not name:
|
|
name = username
|
|
url = user_info['html_url'] = "https://twitter.com/%s" % username
|
|
|
|
account = twitter.TwitterAccount(user_info['id'], user_info)
|
|
participant = Participant.query.get(account.participant_id)
|
|
if account.is_claimed:
|
|
request.redirect('/%s/' % participant.id)
|
|
locked = account.is_locked
|
|
lock_action = "unlock" if account.is_locked else "lock"
|
|
|
|
nbackers = participant.get_number_of_backers()
|
|
title = username
|
|
|
|
# ========================================================================== ^L
|
|
{% extends templates/base.html %}
|
|
|
|
{% block heading %}<h2 class="top"><span>Twitter</span></h2>{% end %}
|
|
|
|
{% block box %}
|
|
|
|
<table class="on-elsewhere">
|
|
<tr>
|
|
<td class="picture">
|
|
<img src="{{ participant.get_img_src(128) }}" />
|
|
</td>
|
|
<td class="ready">
|
|
<h2><a href="{{ url }}">{{ username }}</a> has</h2>
|
|
<div class="number">{{ nbackers }}</div>
|
|
<div class="unit">{{ 'person' if nbackers == 1 else 'people' }} ready to give</div>
|
|
</td>
|
|
<td class="offset"></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<div class="buttons tips">
|
|
{% if account.is_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="highlight 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 pledge to <b>{{ username }}</b>.</div>
|
|
|
|
{% else %}
|
|
|
|
{% set my_tip = user.get_tip_to(participant.id) %}
|
|
<h2>Your Weekly Pledge</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">—
|
|
<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 page %}
|
|
|
|
<div class="col0">
|
|
{% if account.is_locked %}
|
|
|
|
<h2>{{ username }} has opted out of Gittip.</h2>
|
|
|
|
<p>If you are <a href="{{ user_info.get('html_url', '') }}">{{ username }}</a>
|
|
on Twitter, you can unlock your account to allow people to pledge tips to
|
|
you on Gittip.</p>
|
|
|
|
<a href="{{ twitter.oauth_url(website, u'unlock', username) }}"
|
|
><button>Unlock</button></a>
|
|
|
|
{% else %}
|
|
<script>
|
|
$(document).ready(Gittip.initTipButtons);
|
|
</script>
|
|
|
|
<h2>{{ name }} has not joined Gittip.</h2>
|
|
|
|
<p>Is this you?
|
|
{% if user.ANON %}
|
|
<a href="{{ twitter.oauth_url(website, u'opt-in', username) }}">Click
|
|
here</a> to opt in to Gittip. We never collect money for you until
|
|
you do.
|
|
{% else %}
|
|
<a href="/sign-out.html">Sign out</a> and sign back in
|
|
to claim this account
|
|
{% end %}
|
|
</p>
|
|
|
|
{% if user.ANON %}
|
|
<h2>What is Gittip?</h2>
|
|
|
|
<p>Gittip is a way to thank and support your favorite artists, musicians,
|
|
writers, programmers, etc. by setting up a small weekly cash gift to them.
|
|
<a href="/about/">Read more ...</a></p>
|
|
|
|
|
|
<h2>Don't like what you see?</h2>
|
|
|
|
<p>If you are {{ username }} you can explicitly opt out of Gittip by
|
|
locking this account. We don't allow new pledges to locked
|
|
accounts.</p>
|
|
|
|
<a href="{{ twitter.oauth_url(website, u'lock', username) }}"
|
|
><button>Lock</button></a>
|
|
{% end %}
|
|
|
|
{% end %}
|
|
</div>
|
|
{% end %}
|