Skip to content

Commit

Permalink
Merge pull request acm-uiuc#81 from eparsons/templates
Browse files Browse the repository at this point in the history
Added ability to flag all items as not accounted for
  • Loading branch information
billliu1992 committed Mar 8, 2013
2 parents 4e163d7 + 0fe3fa9 commit 8112699
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/main/tpl/items.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@
<td>{{ item.checked_out_by }}</td>
{% if not item.is_accounted_for %}
<td class="not_accounted_for">
{{ item.last_accounted_for }}
<i class="icon-ok-circle"></i>
</td>
{% else %}
<td class="is_accounted_for">
{% endif %}
{{ item.last_accounted_for }}
<i class="icon-remove-circle"></i>
</td>
{% endif %}
<td>
{% if item.can_checkout %}
Yes
Expand Down Expand Up @@ -71,7 +75,7 @@
<br />
<div id="ResetAccountModalButtons">
<div class="pull-left">
<a href class="btn-warning btn-large">Yes</a>
<a href="/toggleAccounted/" class="btn-warning btn-large">Yes</a>
</div>
<div class="pull-right">
<a href type="button" class="btn-large btn-danger" data-dismiss="modal" aria-hidden="true">Cancel</a>
Expand Down
9 changes: 9 additions & 0 deletions server/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ def items(request):
c = RequestContext(request, {'items' : items})
return render_to_response('items.html', c)

@login_required()
def toggle_accounted_all(request):
items = Item.objects.filter(owner_id = request.user)
for item in items:
item.is_accounted_for = False
item.save()
return redirect('/items/')


@login_required()
def avail_items(request):
if request.method == 'GET':
Expand Down
2 changes: 2 additions & 0 deletions server/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
url(r'^items/$', 'main.views.items'),
url(r'^item/(?P<item_id>\d+)/$', 'main.views.item_info'),
url(r'^checkout/(?P<item_id>\d+)/$', 'main.views.checkout'),
#url(r'^toggleAccounted/(?P<item_id>\d+)$', 'main.views.toggle_accounted'),
url(r'^toggleAccounted/$', 'main.views.toggle_accounted_all'),
url(r'^additem/$','main.views.add_item'),
url(r'^addattr/$','main.views.add_attribute'),
url(r'^additemtype/$','main.views.add_item_type'),
Expand Down

0 comments on commit 8112699

Please sign in to comment.