[Assorted-commits] SF.net SVN: assorted:[1438] pitch-in/trunk
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-05-31 20:08:01
|
Revision: 1438 http://assorted.svn.sourceforge.net/assorted/?rev=1438&view=rev Author: yangzhang Date: 2009-05-31 20:07:57 +0000 (Sun, 31 May 2009) Log Message: ----------- - added publisher - resized logo - style tweaks - refactored views, esp listing of contribs - added hidden sponsorship view - converted to valid xhtml - filled out the README Modified Paths: -------------- pitch-in/trunk/README pitch-in/trunk/src/pitchin/pitchin/templates/base.html pitch-in/trunk/src/pitchin/pitchin/templates/main.html pitch-in/trunk/src/pitchin/pitchin/templates/pool.html pitch-in/trunk/src/pitchin/pitchin/urls.py pitch-in/trunk/src/pitchin/pitchin/views.py pitch-in/trunk/src/pitchin/static/default.css pitch-in/trunk/src/pitchin/static/pitchin.png Added Paths: ----------- pitch-in/trunk/publish.bash Modified: pitch-in/trunk/README =================================================================== --- pitch-in/trunk/README 2009-05-28 16:56:05 UTC (rev 1437) +++ pitch-in/trunk/README 2009-05-31 20:07:57 UTC (rev 1438) @@ -1,5 +1,37 @@ -Nice new features in Django 1.0: +Overview +-------- -- new cycle syntax: cycle '0' '1' -- autoescape -- for key, value in collection +PitchIn is a simple web application for collaboratively managing a money pool. +The service runs on [Google App Engine] at <http://pitch-in.appspot.com/>. + +Requirements +------------ + +- [Django] 0.96 +- [Google App Engine] + +[Django]: http://www.djangoproject.com/ +[Google App Engine]: http://code.google.com/appengine/ + +Resources +--------- + +These are some other resources I used in the creation of this website: + +- [RoundedCornr](http://www.roundedcornr.com/) +- [Web 2.0 Logo Creator](http://creatr.cc/creatr/) + +Todo +---- + +- Disallow updates +- Email notification +- Administration link for removes, updates, de-anonymizing +- Anonymous participants (visible only to administration) +- Other types of pools besides integers (decimals, unique strings, strings) +- Comprehensive logging +- Archiving/garbage collection +- Upgrade to Django 1.0. Nice new features in Django 1.0 include: + - new cycle syntax: cycle '0' '1' + - autoescape + - for key, value in collection Copied: pitch-in/trunk/publish.bash (from rev 1424, clamp/trunk/publish.bash) =================================================================== --- pitch-in/trunk/publish.bash (rev 0) +++ pitch-in/trunk/publish.bash 2009-05-31 20:07:57 UTC (rev 1438) @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +fullname='PitchIn' +version=1.0 +license=agpl3 +websrcs=( README ) +rels=( src-tgz: ) +nodl=true +. assorted.bash "$@" Modified: pitch-in/trunk/src/pitchin/pitchin/templates/base.html =================================================================== --- pitch-in/trunk/src/pitchin/pitchin/templates/base.html 2009-05-28 16:56:05 UTC (rev 1437) +++ pitch-in/trunk/src/pitchin/pitchin/templates/base.html 2009-05-31 20:07:57 UTC (rev 1438) @@ -1,5 +1,8 @@ -<html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>{% block title %}PitchIn{% endblock %}</title> <link rel="stylesheet" type="text/css" href="static/default.css"/> </head> @@ -7,13 +10,29 @@ <div class="box"> <div class="boxtop"><div></div></div> <div class="header"> - <img src="static/pitchin.png"/> + <a href="/"><img src="static/pitchin.png" alt="PitchIn logo"/></a> </div> <div class="body"> {% block body %}{% endblock %} - <small>PitchIn © 2009 <a href="http://www.mit.edu/~y_z/">Yang Zhang</a></small> + <div style="margin-top: 50px"> + <small> + <strong>PitchIn</strong> © 2009 <a href="http://www.mit.edu/~y_z/">YZ</a> | + <a href="http://assorted.sf.net/pitch-in/">AGPL Source</a> <!--| + <a href="sponsorship">Sponsorship</a>--> + </small> + </div> </div> <div class="boxbottom"><div></div></div> </div> + <script type="text/javascript"> + var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); + document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); + </script> + <script type="text/javascript"> + try { + var pageTracker = _gat._getTracker("UA-7136318-2"); + pageTracker._trackPageview(); + } catch(err) {} + </script> </body> </html> Modified: pitch-in/trunk/src/pitchin/pitchin/templates/main.html =================================================================== --- pitch-in/trunk/src/pitchin/pitchin/templates/main.html 2009-05-28 16:56:05 UTC (rev 1437) +++ pitch-in/trunk/src/pitchin/pitchin/templates/main.html 2009-05-31 20:07:57 UTC (rev 1438) @@ -10,7 +10,7 @@ <form action="/create" method="post"> <div> <input class="text-input" type="text" name="descrip"/> - <input type="submit" width="50" value="Create Pool"> + <input type="submit" value="Create Pool"/> </div> </form> <div class="example"> Modified: pitch-in/trunk/src/pitchin/pitchin/templates/pool.html =================================================================== --- pitch-in/trunk/src/pitchin/pitchin/templates/pool.html 2009-05-28 16:56:05 UTC (rev 1437) +++ pitch-in/trunk/src/pitchin/pitchin/templates/pool.html 2009-05-31 20:07:57 UTC (rev 1438) @@ -1,27 +1,37 @@ {% extends 'base.html' %} {% block body %} <p style="font-size: larger"><span style="font-weight: bold">Pool:</span> {{descrip|escape}}</p> - {% for contrib in contribs %} - <div class="row{% cycle 0,1 %}">{{contrib.0|escape}}: {{contrib.1|escape}}</div> - {% endfor %} - {% for contrib in aggcontribs %} - <div class="aggrow">{{contrib.0|escape}}: {{contrib.1|escape}}</div> - {% endfor %} + {% if not contribs %} + <p style="font-style: italic;">(no participants yet)</p> + {% else %} + {% for contrib in contribs %} + <div class="row{% cycle 0,1 %}">{{contrib.0|escape}}: {{contrib.1|escape}}</div> + {% endfor %} + {% for contrib in aggcontribs %} + <div class="aggrow">{{contrib.0|escape}}: {{contrib.1|escape}}</div> + {% endfor %} + {% endif %} <p> To add or update your own contribution to the pool, enter the following information. </p> <form action="/pool" method="post"> <p class="error">{{error}}</p> - <input type="hidden" name="key" value="{{key|urlencode}}"/> <div> - <label name="name">Name:</label> - <input type="text" name="name"/> + <input type="hidden" name="key" value="{{key|urlencode}}"/> </div> <div> - <label name="amount">Contribution:</label> - <input type="text" name="amount"/> + <label> + Name: + <input type="text" name="name" value="{{name|escape}}"/> + </label> </div> + <div> + <label> + Contribution: + <input type="text" name="amount" value="{{amount|escape}}"/> + </label> + </div> <div><input type="submit" value="Enter the pool!"/></div> </form> {% endblock %} Modified: pitch-in/trunk/src/pitchin/pitchin/urls.py =================================================================== --- pitch-in/trunk/src/pitchin/pitchin/urls.py 2009-05-28 16:56:05 UTC (rev 1437) +++ pitch-in/trunk/src/pitchin/pitchin/urls.py 2009-05-31 20:07:57 UTC (rev 1438) @@ -8,6 +8,7 @@ (r'^$', 'pitchin.views.main'), (r'^create$', 'pitchin.views.create'), (r'^pool$', 'pitchin.views.pool'), + (r'^sponsorship$', 'pitchin.views.sponsorship'), # Uncomment the admin/doc line below and add 'django.contrib.admindocs' # to INSTALLED_APPS to enable admin documentation: Modified: pitch-in/trunk/src/pitchin/pitchin/views.py =================================================================== --- pitch-in/trunk/src/pitchin/pitchin/views.py 2009-05-28 16:56:05 UTC (rev 1437) +++ pitch-in/trunk/src/pitchin/pitchin/views.py 2009-05-31 20:07:57 UTC (rev 1438) @@ -8,20 +8,12 @@ def getContribs(pool): return cPickle.loads(str(pool.contribs)) def serContribs(contribs): return cPickle.dumps(contribs, 2) -def showContribs(pool): - contribs = getContribs(pool) +def aggContribs(contribs): if len(contribs) == 0: - return '<p style="font-style: italic;">(no participants yet)</p>' + return '' else: - return contribs.items() , [('Max total', sum(contribs.itervalues())), - ('If everyone paid the minimum', len(contribs) * min(contribs.itervalues()))] - s = '<div class="rows">' - for i, (name, amount) in enumerate(contribs.iteritems()): - s += '<div class="row%d">%s: %d</div>' % (i % 2, cgi.escape(name), amount) - s += '<div class="aggrow">Max total: %d</div>' % (sum(contribs.itervalues()),) - s += '<div class="aggrow">If everyone paid the minimum: %d</div>' % (len(contribs) * min(contribs.itervalues()),) - s += '</div>' - return s + return [('Max total', sum(contribs.itervalues())), + ('If everyone paid the minimum', len(contribs) * min(contribs.itervalues()))] class invalid_submit(Exception): pass def validate(pred, msg): @@ -34,7 +26,9 @@ def create(request): if request.REQUEST['descrip'].strip() == '': - return render_to_response('main.html', {'error': 'Must specify a description'}) + return render_to_response('main.html', + dict(error = 'Must specify a description', + descrip = request.REQUEST['descrip'])) pool = Pool(descrip = request.REQUEST['descrip'], contribs = cPickle.dumps({})) pool.put() return render_to_response('created.html', {'key': pool.key()}) @@ -43,14 +37,16 @@ if request.method == 'GET': return view(request) else: return update(request) -def view(request, error = ''): +def view(request, **params): + if 'key' not in request.REQUEST: + return HttpResponseRedirect('/') pool = getPool(request) return render_to_response('pool.html', - dict(error = error, - descrip = pool.descrip, - contribs = showContribs(pool)[0], - aggcontribs = showContribs(pool)[1], - key = request.REQUEST['key'])) + dict(descrip = pool.descrip, + contribs = getContribs(pool), + aggcontribs = aggContribs(getContribs(pool)), + key = request.REQUEST['key'], + **params)) def update(request): try: @@ -59,7 +55,7 @@ try: amount = int(request.REQUEST['amount']) except ValueError: raise invalid_submit('You must enter an integer dollar amount.') except invalid_submit, ex: - return view(request, error = ex) + return view(request, error = ex, name = request.REQUEST['name'], amount = request.REQUEST['amount']) else: pool = getPool(request) contribs = getContribs(pool) @@ -67,3 +63,6 @@ pool.contribs = cPickle.dumps(contribs) pool.put() return HttpResponseRedirect('/pool?key=%s' % pool.key()) + +def sponsorship(request): + return render_to_response('sponsorship.html') Modified: pitch-in/trunk/src/pitchin/static/default.css =================================================================== --- pitch-in/trunk/src/pitchin/static/default.css 2009-05-28 16:56:05 UTC (rev 1437) +++ pitch-in/trunk/src/pitchin/static/default.css 2009-05-31 20:07:57 UTC (rev 1438) @@ -8,7 +8,7 @@ .header { text-align: center; width: 100%; } .body { margin: 0 30px; text-align: center; } .error { color: red; } -.example { background-color: #ffffcc; } +.example { background-color: #ffffcc; margin: 50px 0; padding: 10px 0; } .boxbottom div { background: url(bl.png) no-repeat bottom left; } .boxbottom { background: url(br.png) no-repeat bottom right; } label, input { @@ -23,9 +23,12 @@ } .text-input { width: 75%; } .quote { font-family: serif; font-size: 50pt; float: left; } -.line { width: 75%; font-size: larger; font-style: italic; margin: 0 auto; } +.line { width: 75%; font-size: larger; font-style: italic; margin: 0 auto; margin-bottom: 50px; } .rows { width: 75%; margin: 0 auto; } .row0, .row1, .aggrow { padding-top: 3px; padding-bottom: 3px; } -.row0 { background-color: #dddddd; } -.row1 { background-color: #eeeeee; } +.row0 { background-color: #e3e3f8; } +.row1 { background-color: #eeeeff; } .aggrow { font-weight: bold; } +a:link { color: #55aaff; text-decoration: none; } +a:visited { color: #55aaff; text-decoration: none; } +a:hover { color: #ff3399; } Modified: pitch-in/trunk/src/pitchin/static/pitchin.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |