Commit 80a160103db15017c996d0bb406b6553abda7b00
- Diff rendering mode:
- inline
- side by side
|   | |||
| 22 | 22 | ||
| 23 | 23 | map.connect('books', '/books', controller="book", action="index") | |
| 24 | 24 | map.connect('book', '/book/{id}', controller="book", action="show") | |
| 25 | map.connect('copy', '/copy/{id}', controller="book", action="show_copy") | ||
| 25 | 26 | map.connect('checkout_copy', '/copy/{id}/checkout', controller="book", action="checkout") | |
| 26 | 27 | map.connect('checkin_copy', '/copy/{id}/checkin', controller="book", action="checkin") | |
| 27 | 28 | map.resource('user', 'users') |
|   | |||
| 22 | 22 | abort(404) | |
| 23 | 23 | c.users = [(user.user_id, user.name) for user in model.User.query()] | |
| 24 | 24 | return render("books/show.mako") | |
| 25 | def show_copy(self, id): | ||
| 26 | c.copy = model.Copy.query().get(id) | ||
| 27 | if c.copy is None: | ||
| 28 | abort(404) | ||
| 29 | c.users = [(user.user_id, user.name) for user in model.User.query()] | ||
| 30 | return render("books/show_copy.mako") | ||
| 25 | 31 | def checkout(self, id): | |
| 26 | 32 | copy = model.Copy.query().get(id) | |
| 27 | 33 | if copy is None: |
|   | |||
| 15 | 15 | <table border="0" cellspacing="5" cellpadding="5"> | |
| 16 | 16 | <tr><th>Copy ID</th><th>Acquired On</th><th>Condition</th><th>Checked Out?</th><th>Checked Out To</th><th>Due Date</th><th>Actions</th></tr> | |
| 17 | 17 | % for copy in c.item.copies: | |
| 18 | <tr><td>${copy.copy_id}</td><td>${copy.acquired_date}</td><td>${copy.condition_notes}</td><td>${copy.is_out()}</td><td>${copy.current_loan().user.name if copy.is_out() else u""}</td><td>${copy.current_loan().due_date if copy.is_out() else u""}</td><td> | ||
| 18 | <tr><td>${copy.copy_id}</td><td>${copy.acquired_date}</td><td>${copy.condition_notes}</td><td>${copy.is_out()}</td><td>${copy.current_loan().user.name if copy.is_out() else u""}</td><td>${copy.current_loan().due_date if copy.is_out() else u""}</td><td>${h.link_to("Details", url("copy", id=copy.copy_id))} — | ||
| 19 | 19 | % if copy.is_out(): | |
| 20 | 20 | ${h.form(url('checkin_copy', id=copy.copy_id))} | |
| 21 | 21 | ${h.submit("checkin", "Checkin")} |
|   | |||
| 1 | <%inherit file="/layout.mako"/> | ||
| 2 | <%def name="pagetitle()"> | ||
| 3 | Item: "${c.copy.item.title}", copy ID ${c.copy.copy_id} | ||
| 4 | </%def> | ||
| 5 | <p>${h.link_to("All Items", url("books"))} — ${h.link_to("General view of this item", url("book", id=c.copy.item.item_id))}</p> | ||
| 6 | <table border="0" cellspacing="5" cellpadding="5"> | ||
| 7 | <tr><td>Item ID</td><td>${c.copy.item.item_id}</td></tr> | ||
| 8 | <tr><td>Title</td><td>${c.copy.item.title}</td></tr> | ||
| 9 | <tr><td>Author</td><td>${c.copy.item.author}</td></tr> | ||
| 10 | <tr><td>EAN</td><td>${c.copy.item.ean}</td></tr> | ||
| 11 | <tr><td>Publication Date</td><td>${c.copy.item.pub_date}</td></tr> | ||
| 12 | <tr><td>Kind</td><td>${c.copy.item.kind}</td></tr> | ||
| 13 | </table> | ||
| 14 | <table border="0" cellspacing="5" cellpadding="5"> | ||
| 15 | <tr><td>Copy ID</td><td>${c.copy.copy_id}</td></tr> | ||
| 16 | <tr><td>Acquired On</td><td>${c.copy.acquired_date}</td></tr> | ||
| 17 | <tr><td>Condition</td><td>${c.copy.condition_notes}</td></tr> | ||
| 18 | </table> | ||
| 19 | |||
| 20 | <p>Loans | ||
| 21 | <table border="0" cellspacing="5" cellpadding="5"> | ||
| 22 | <tr><th>User's Name</th><th>User's Address</th><th>Checkout Date</th><th>Due Date</th><th>Returned</th></tr> | ||
| 23 | % for loan in c.copy.loans: | ||
| 24 | <tr><td>${loan.user.name}</td><td>${loan.user.address}</td><td>${loan.checked_out}</td><td>${loan.due_date}</td><td>${loan.returned}</td></tr> | ||
| 25 | % endfor | ||
| 26 | </table> | ||
| 27 | </p> |

