]> asedeno.scripts.mit.edu Git - bluechips.git/commitdiff
big interface overhaul, doesn't really add any new features yet
authorScott Torborg <scott@crookedmedia.com>
Tue, 3 Nov 2009 00:34:47 +0000 (14:34 -1000)
committerScott Torborg <scott@crookedmedia.com>
Tue, 3 Nov 2009 00:50:34 +0000 (14:50 -1000)
bluechips/public/css/main.css
bluechips/public/icons/dashboard.png [new file with mode: 0644]
bluechips/public/icons/history.png [new file with mode: 0644]
bluechips/public/icons/spend.png [new file with mode: 0644]
bluechips/public/icons/transfer.png [new file with mode: 0644]
bluechips/templates/base.mako
bluechips/templates/spend/split.mako
bluechips/templates/status/index.mako
bluechips/widgets/spend.py
bluechips/widgets/transfer.py

index 963dcbd75695bf741f4202b4aecab0e1d9fd4248..3897fe07ef78883ee2ca7ae1efb450494b077b9a 100644 (file)
@@ -1,3 +1,71 @@
+body {
+    font-family: "Lucida Grande", helvetica, arial, sans-serif;
+    font-size: 0.9em;
+    width: 700px;
+}
+strong {
+    font-weight: bold;
+}
+em {
+    font-style: italic;
+}
+a {
+    color: #068600;
+}
+h1.title {
+    font-size: 1.5em;
+    width: 140px;
+}
+a:link {
+    text-decoration: none;
+}
+a:visited {
+    text-decoration: none;
+}
 .bluechips {
     color: #00a;
 }
+#nav {
+    text-align: center;
+}
+#nav td {
+    padding: 5px 20px;
+}
+div.block {
+    margin: 10px 0;
+    padding: 0 10px;
+    border-bottom: 1px solid #bbb;
+}
+table.list {
+    border-collapse: collapse;
+    width: 100%;
+    margin: 10px 0;
+}
+table.list th {
+    text-align: left;
+    padding: 2px 5px;
+    border-bottom: 1px solid #bbb;
+}
+table.list td {
+    padding: 2px 5px;
+    vertical-align: top;
+}
+table.list td.date {
+    width: 90px;
+}
+table.list td.user {
+    width: 110px;
+}
+table.list td.amount {
+    width: 90px;
+}
+#totals {
+    margin-bottom: 10px;
+}
+#totals th {
+    text-align: right;
+}
+td.labelcol {
+    text-align: right;
+    font-weight: bold;
+}
diff --git a/bluechips/public/icons/dashboard.png b/bluechips/public/icons/dashboard.png
new file mode 100644 (file)
index 0000000..2ad717c
Binary files /dev/null and b/bluechips/public/icons/dashboard.png differ
diff --git a/bluechips/public/icons/history.png b/bluechips/public/icons/history.png
new file mode 100644 (file)
index 0000000..6156d0f
Binary files /dev/null and b/bluechips/public/icons/history.png differ
diff --git a/bluechips/public/icons/spend.png b/bluechips/public/icons/spend.png
new file mode 100644 (file)
index 0000000..000faa8
Binary files /dev/null and b/bluechips/public/icons/spend.png differ
diff --git a/bluechips/public/icons/transfer.png b/bluechips/public/icons/transfer.png
new file mode 100644 (file)
index 0000000..18d9dc9
Binary files /dev/null and b/bluechips/public/icons/transfer.png differ
index 8403b016f956db65c7c0039e000b4fbdb08fa640..d12f45688243b2b7e4d40ce4dd62f2a9a7df49bf 100644 (file)
@@ -7,7 +7,6 @@
     ${h.stylesheet_link('/css/main.css')}
   </head>
   <body>
-    <h1>${self.title()}</h1>
     <% messages = h.flash.pop_messages() %>
     % if messages:
     <ul id="flash-messages">
     % endfor
     </ul>
     % endif
-    <div id="nav">
-      <ul>
-        <li>${h.link_to('Dashboard', h.url_for(controller='status',
-                                               action='index',
-                                               id=None))}</li>
-        <li>${h.link_to('Expense', h.url_for(controller='spend',
-                                             action='index',
-                                             id=None))}</li>
-        <li>${h.link_to('Transfer', h.url_for(controller='transfer',
-                                              action='index',
-                                              id=None))}</li>
-        <li>${h.link_to('History', h.url_for(controller='history',
-                                             action='index',
-                                             id=None))}</li>
-      </ul>
+    <div id="nav" class="block">
+      <table>
+        <tr>
+          <td>
+            <h1 class="title">
+              % if c.title:
+                ${c.title}
+              % else:
+                BlueChips
+              % endif
+            </h1>
+          </td>
+          <td>
+            <a href="${h.url_for(controller='status', action='index', id=None)}">
+              <img src="/icons/dashboard.png" alt="">
+              <span>Dashboard</span>
+            </a>
+          </td>
+          <td>
+            <a href="${h.url_for(controller='spend', action='index', id=None)}">
+              <img src="/icons/spend.png" alt="">
+              <span>Expense</span>
+            </a>
+          </td>
+          <td>
+            <a href="${h.url_for(controller='transfer', action='index', id=None)}">
+              <img src="/icons/transfer.png" alt="">
+              <span>Transfer</span>
+            </a>
+          </td>
+          <td>
+            <a href="${h.url_for(controller='history', action='index', id=None)}">
+              <img src="/icons/history.png" alt="">
+              <span>History</span>
+            </a>
+          </td>
+        </tr>
+      </table>
     </div>
     <div id="content">
       ${next.body()}
 % endif
 </%def>
 
+<%def name="formatUser(user)">
+  % if user.username == request.environ['REMOTE_USER']:
+    <strong>${user.name}</strong>
+  % else:
+    ${user.name}
+  % endif
+</%def>
+
 <%def name="listExpenditures(es)">
-<table>
+  <table class="list">
     <tr>
-        <th>Date</th>
-        <th>Spender</th>
-        <th>Description</th>
-        <th>Amount</th>
-        <th></th>
+      <th class="date">Date</th>
+      <th class="user">Spender</th>
+      <th class="description">Description</th>
+      <th class="amount">Amount</th>
+      <th class="editlink"></th>
     </tr>
     % for e in es:
-    <tr>
-        <td>${e.date}</td>
-        <td>${e.spender.name}</td>
-        <td>${e.description}</td>
-        <td>${e.amount}</td>
-        <td>${h.link_to('Edit', h.url_for(controller='spend', 
-                                          action='edit',
-                                          id=e.id))}</td>
-    </tr>
+      <tr>
+        <td class="date">${e.date}</td>
+        <td class="user">${formatUser(e.spender)}</td>
+        <td class="description">${e.description}</td>
+        <td class="amount">${e.amount}</td>
+        <td class="editlink">${h.link_to('Edit', h.url_for(controller='spend', action='edit', id=e.id))}</td>
+      </tr>
     % endfor
-</table>
+  </table>
 </%def>
 
 <%def name="listTransfers(ts)">
-<table>
+  <table class="list">
     <tr>
-        <th>Date</th>
-        <th>From</th>
-        <th>To</th>
-        <th>Description</th>
-        <th>Amount</th>
-        <th></th>
+      <th class="date">Date</th>
+      <th class="user">From</th>
+      <th class="user">To</th>
+      <th class="description">Description</th>
+      <th class="amount">Amount</th>
+      <th class="editlink"></th>
     </tr>
     % for t in ts:
-    <tr>
-        <td>${t.date}</td>
-        <td>${t.debtor.name}</td>
-        <td>${t.creditor.name}</td>
-        <td>${t.description}</td>
-        <td>${t.amount}</td>
-        <td>${h.link_to('Edit', h.url_for(controller='transfer', 
-                                          action='edit',
-                                          id=t.id))}</td>
-    </tr>
+      <tr>
+        <td class="date">${t.date}</td>
+        <td class="user">${formatUser(t.debtor)}</td>
+        <td class="user">${formatUser(t.creditor)}</td>
+        <td class="description">${t.description}</td>
+        <td class="amount">${t.amount}</td>
+        <td class="editlink">${h.link_to('Edit', h.url_for(controller='transfer', action='edit', id=t.id))}</td>
+      </tr>
     % endfor
-</table>
+  </table>
+</%def>
+
+<%def name="expenditureIcon()">
+&larr;<span class="dollarsign">&rarr;
+</%def>
+
+<%def name="transferIcon()">
+<span class="dollarsign">$</span>&rarr;<span class="dollarsign">$</span>
 </%def>
index 41568e5e2e886ef1c362b6a63da207a23ec79547..8dba9cc968ddf10c81b72246885c20704d864847 100644 (file)
@@ -23,29 +23,36 @@ ${c.expenditure.spender.name} on ${c.expenditure.date}, described as
 
 ${h.form('', method='post')}
 <form>
-  <ul class="field_list">
+  <table>
     % for user in c.users:
-    <%
-    name = user.username
-    try:
-        percent = c.values[name]
-    except TypeError:
+      <%
+        name = user.username
         try:
-            share = [s.share for s in c.expenditure.splits if s.user == user][0]
-            percent = (Decimal(100) * Decimal(int(share)) / Decimal(int(c.expenditure.amount))).quantize(Decimal("0.001"))
-        except IndexError:
-            percent = Decimal(0)
-    %>\
-    <li class="${form_cycle.next()}" id="${name}.container">
-      <label id="${name}.label" for="${name}" class="fieldlabel">${user.name}</label>
-      ${h.text(name, value=percent, class_="textfield required", id=name)}
-      % if name in c.errors:
-      <span class="fielderror">${c.errors[name]}</span>
-      % endif
-    </li>
+            percent = c.values[name]
+        except TypeError:
+            try:
+                share = [s.share for s in c.expenditure.splits if s.user == user][0]
+                percent = (Decimal(100) * Decimal(int(share)) / Decimal(int(c.expenditure.amount))).quantize(Decimal("0.001"))
+            except IndexError:
+                percent = Decimal(0)
+      %>\
+      <tr class="${form_cycle.next()}" id="${name}.container">
+        <td class="labelcol">
+          <label id="${name}.label" for="${name}" class="fieldlabel">${user.name}</label>
+        </td>
+        <td class="fieldcol">
+          ${h.text(name, value=percent, class_="textfield required", id=name)}
+          % if name in c.errors:
+            <span class="fielderror">${c.errors[name]}</span>
+          % endif
+        </td>
+      </tr>
     % endfor
-    <li class="${form_cycle.next()}" id="submit.container">
-      ${h.submit(None, 'Submit', class_="submitbutton")}
-    </li>
+    <tr class="${form_cycle.next()}" id="submit.container">
+      <td class="labelcol"></td>
+      <td class="fieldcol">
+        ${h.submit(None, 'Submit', class_="submitbutton")}
+      </td>
+    </tr>
   </ul>
 </form>
index 5e9539dabf3f79565940f06f92a75e2e6d69cab4..f1c21e364d02fac36bc21e5067492682b6d1b2f8 100644 (file)
@@ -1,69 +1,76 @@
 <%inherit file="/base.mako"/>
 
-<h2>Settling Transfers</h2>
+<div class="block">
+  <h2>Settling Transfers</h2>
 
-% if len(c.settle) == 0:
-<p>No need! The books are balanced!</p>
-% else:
-<p>To balance the books, the following transfers need to be made:</p>
+  % if len(c.settle) == 0:
+    <p>No need! The books are balanced!</p>
+  % else:
+    <p>To balance the books, the following transfers need to be made:</p>
 
-<table>
-    <tr>
+    <table>
+      <tr>
         <th>From</th>
         <th>To</th>
         <th>Amount</th>
-    </tr>
-    % for transfer in c.settle:
-    <tr>
-        <td>${transfer[0].username}</td>
-        <td>${transfer[1].username}</td>
-        <td>${transfer[2]}</td>
-    </tr>
-    % endfor
-</table>
-% endif
+      </tr>
+      % for transfer in c.settle:
+        <tr>
+          <td>${transfer[0].username}</td>
+          <td>${transfer[1].username}</td>
+          <td>${transfer[2]}</td>
+        </tr>
+      % endfor
+    </table>
+  % endif
+</div>
 
-<h2>Totals</h2>
+<div class="block">
+  <h2>Totals</h2>
 
-<table>
+  <table id="totals">
     <tr>
-        <td>Total</td>
-        <td>${c.total}</td>
+      <th>Total</th>
+      <td>${c.total}</td>
     </tr>
     <tr>
-        <td>Past year</td>
-        <td>${c.year_total}</td>
+      <th>Past year</th>
+      <td>${c.year_total}</td>
     </tr>
     <tr>
-        <td>Year to date</td>
-        <td>${c.this_year_total}</td>
+      <th>Year to date</th>
+      <td>${c.this_year_total}</td>
     </tr>
     <tr>
-        <td>Month to date</td>
-        <td>${c.this_month_total}</td>
+      <th>Month to date</th>
+      <td>${c.this_month_total}</td>
     </tr>
     <tr>
-        <td>Last month</td>
-        <td>${c.last_month_total}</td>
+      <th>Last month</th>
+      <td>${c.last_month_total}</td>
     </tr>
-</table>
+  </table>
+</div>
 
-<h2>Add a new transaction</h2>
+<div class="block">
+  <h2>Add a new transaction</h2>
 
-<ul>
+  <ul>
     <li>${h.link_to('Expenditure for the group', h.url_for(controller='spend', action='index'))}</li>
     <li>${h.link_to('Transfer between two people', h.url_for(controller='transfer', action='index'))}</li>
-</ul>
+  </ul>
+</div>
 
-<h2>Your History</h2>
+<div class="block">
+  <h2>Your History</h2>
 
-${h.link_to('See all history', h.url_for(controller='history',
-                                         action='index'))}
+  ${h.link_to('See all history', h.url_for(controller='history', action='index'))}
 
-<h3>Expenditures</h3>
+  <h3>Expenditures</h3>
 
-${self.listExpenditures(c.expenditures)}
+  ${self.listExpenditures(c.expenditures)}
 
-<h3>Transfers</h3>
+  <h3>Transfers</h3>
 
-${self.listTransfers(c.transfers)}
+  ${self.listTransfers(c.transfers)}
+</div>
index 0f8bb7876cbc4c5d7496fb9957f47e52f2451d19..50ce3c56771c51e819929afcdc459fb4eb76825b 100644 (file)
@@ -5,7 +5,7 @@ from tw.forms import validators
 
 from bluechips.widgets import *
 
-class NewSpendForm(forms.ListForm):
+class NewSpendForm(forms.TableForm):
     class fields(WidgetsList):
         spender = UserSelect()
         amount = AmountField()
index 69886ada6cdfdc1105c86f4ad6c22809625c7fd7..85f300dbc7f8af384927cd18ef659e5771bfbdeb 100644 (file)
@@ -5,7 +5,7 @@ from tw.forms import validators
 
 from bluechips.widgets import *
 
-class NewTransferForm(forms.ListForm):
+class NewTransferForm(forms.TableForm):
     class fields(WidgetsList):
         debtor = UserSelect()
         creditor = UserSelect()