Skip to content

Commit

Permalink
active nav bar enhanced
Browse files Browse the repository at this point in the history
  • Loading branch information
prsnca committed Jun 11, 2014
1 parent b581270 commit 2a7784c
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion committeeVotes/templates/committeeVotes/bills.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h2 title="שם ההצעה">
{% for b in bills %}

<tr>
<td><a href="{% url 'detail' b.id %}">{{ b.name }}</a></td>
<td><a href="{% url 'bill' b.id %}">{{ b.name }}</a></td>
</tr>
{% endfor %}
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h3>
</thead>
{% for b in bills %}
<tr>
<td><a href="{% url 'detail' b.id %}">{{b}}</a></td>
<td><a href="{% url 'bill' b.id %}">{{b}}</a></td>
</tr>
{% endfor %}
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h3>
</thead>
{% for v in votes %}
<tr>
<td><a href="{% url 'detail' v.bill.id %}">{{v.bill}}</a></td>
<td><a href="{% url 'bill' v.bill.id %}">{{v.bill}}</a></td>
<td>{{v.vote}}</td>
</tr>
{% endfor %}
Expand Down
4 changes: 3 additions & 1 deletion committeeVotes/templatetags/custom_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

def active_page(request, view_name):
from django.core.urlresolvers import resolve, Resolver404
print "url: " + resolve(request.path_info).url_name
print "view_name: " + view_name
if not request:
return ""
try:
return "active" if resolve(request.path_info).url_name == view_name else ""
return "active" if resolve(request.path_info).url_name in view_name else ""
except Resolver404:
return ""

Expand Down
4 changes: 2 additions & 2 deletions committeeVotes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def searchMinisters(request):
("name",minister.name)]) for minister in Minister.objects.all()]}
return HttpResponse(json.dumps(ministerSearch), content_type="application/json")

def detail(request, bill_id):
def bill(request, bill_id):
bill = get_object_or_404(Bill, pk=bill_id)
votes = Vote.objects.select_related('minister').filter(bill=bill)
vote_types = VoteType.objects.all().order_by('id')
Expand All @@ -51,7 +51,7 @@ def detail(request, bill_id):
context = {'bill': bill,
'votes_by_type': sorted(votes_by_type.iteritems()),
'unknown_ministers': non_voting_ministers}
return render(request, 'committeeVotes/detail.html', context)
return render(request, 'committeeVotes/bill.html', context)

def minister_details(request, minister_id):
minister = get_object_or_404(Minister,pk=minister_id)
Expand Down
2 changes: 1 addition & 1 deletion openCommittee/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

url(r'^$', views.index, name='index'),
url(r'^bills/$', views.bills, name='bills'),
url(r'^bills/(?P<bill_id>\d+)/$', views.detail, name='detail'),
url(r'^bills/(?P<bill_id>\d+)/$', views.bill, name='bill'),

url(r'^minister/$', views.ministers, name='ministers'),
url(r'^minister/(?P<minister_id>\d+)/$', views.minister_details, name='minister'),
Expand Down

0 comments on commit 2a7784c

Please sign in to comment.