]> asedeno.scripts.mit.edu Git - bluechips.git/blobdiff - bluechips/templates/base.mako
added a 'My Share' column to lists of expenditures
[bluechips.git] / bluechips / templates / base.mako
index 5d4bda53b31f5351ae16683d68366b4bbb0dc40a..49476f16bbb8d8cda609071b3a298b24874e91fb 100644 (file)
     ${h.stylesheet_link('/css/main.css')}
   </head>
   <body>
-    <h1>${self.title()}</h1>
-    <% messages = h.flash.pop_messages() %>
-    % if messages:
-    <ul id="flash-messages">
-    % for message in messages:
-        <li>${message}</li>
+    <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>
+    % for message in h.flash.pop_messages():
+      <div class="flash">${message | n}</div>
     % endfor
-    </ul>
-    % endif
     <div id="content">
       ${next.body()}
     </div>
   </body>
 </html>
 
-<%def name="title()">BlueChips</%def>
+<%def name="title()">BlueChips
+% if c.title != '':
+  :: ${c.title}
+% endif
+</%def>
+
+<%def name="formatUser(user)">
+  % if user == request.environ['user']:
+    <strong>Me</strong>
+  % else:
+    ${user.name}
+  % endif
+</%def>
+
+<%def name="listExpenditures(es)">
+  <table class="list">
+    <tr>
+      <th class="date">Date</th>
+      <th class="user">Spender</th>
+      <th class="description">Description</th>
+      <th class="amount">Amount</th>
+      <th class="share">My Share</th>
+      <th class="editlink"></th>
+    </tr>
+    % for e in es:
+      <%
+        if e.involves(request.environ['user']):
+          klass = 'user-involved'
+        else:
+          klass = 'user-not-involved'
+      %>
+      <tr class="${klass}">
+        <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="share">${e.share(request.environ['user'])}</td>
+        <td class="editlink">${h.link_to('Edit', h.url_for(controller='spend', action='edit', id=e.id))}</td>
+      </tr>
+    % endfor
+  </table>
+</%def>
+
+<%def name="listTransfers(ts)">
+  <table class="list">
+    <tr>
+      <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:
+      <%
+        if t.involves(request.environ['user']):
+          klass = 'user-involved'
+        else:
+          klass = 'user-not-involved'
+      %>
+      <tr class="${klass}">
+        <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>
+</%def>
+
+<%def name="expenditureIcon()">
+&larr;<span class="dollarsign">&rarr;
+</%def>
+
+<%def name="transferIcon()">
+<span class="dollarsign">$</span>&rarr;<span class="dollarsign">$</span>
+</%def>