<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>${self.title()}</title>
${h.stylesheet_link('/css/main.css')}
+ ${h.stylesheet_link('/js/jquery.date_input.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>
- % endfor
- </ul>
- % endif
- <div id="nav">
- <ul>
- <li>${h.link_to('Dashboard', h.url_for(controller='status',
- action='index'))}</li>
- <li>${h.link_to('Expense', h.url_for(controller='spend',
- action='index'))}</li>
- <li>${h.link_to('Transfer', h.url_for(controller='transfer',
- action='index'))}</li>
- <li>${h.link_to('History', h.url_for(controller='history',
- action='index'))}</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>
+ <td>
+ <a href="${h.url_for(controller='user', action='index', id=None)}">
+ <img src="/icons/user.png" alt="">
+ <span>User</span>
+ </a>
+ </td>
+ </tr>
+ </table>
</div>
+ % for message in h.flash.pop_messages():
+ <div class="flash">${message | n}</div>
+ % endfor
<div id="content">
${next.body()}
</div>
+ ${h.javascript_link('/js/jquery-1.3.2.js')}
+ ${h.javascript_link('/js/jquery.date_input.js')}
+ ${h.javascript_link('/js/admin.js')}
</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>
+ <table class="list">
<tr>
- <th>Date</th>
- <th>Spender</th>
- <th>Description</th>
- <th>Amount</th>
+ <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:
- <tr>
- <td>${e.date}</td>
- <td>${e.spender.name}</td>
- <td>${e.description}</td>
- <td>$${h.round_currency(e.amount)}</td>
- </tr>
+ <%
+ 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>
+ </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 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>$${h.round_currency(t.amount)}</td>
- </tr>
+ <%
+ 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>
+ </table>
+</%def>
+
+<%def name="expenditureIcon()">
+←<span class="dollarsign">→
+</%def>
+
+<%def name="transferIcon()">
+<span class="dollarsign">$</span>→<span class="dollarsign">$</span>
</%def>