Skip to content
Browse files

Add some simple navigation

  • Loading branch information...
1 parent 0e48c83 commit 9c23f28260f3f6e395ec02ce821440d965f23cbf @meldra committed Aug 8, 2012
Showing with 14 additions and 1 deletion.
  1. +1 −0 brain/templates/index.html
  2. +1 −0 brain/templates/search.html
  3. +12 −1 brain/views.py
View
1 brain/templates/index.html
@@ -70,6 +70,7 @@
</head>
<body>
<a href="https://github.com/meldra/waswherewhen"><img style="position: absolute; top: 0; right: 0; border: 0; width:85px; height:85px;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
+{{navigation|safe}}
{% if dayCal %}
{{dayCal|safe}}
{% endif %}
View
1 brain/templates/search.html
@@ -70,6 +70,7 @@
</head>
<body>
<a href="https://github.com/meldra/waswherewhen"><img style="position: absolute; top: 0; right: 0; border: 0; width:85px; height:85px;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
+{{navigation|safe}}
<form>
{{search.as_table}}
<input type="submit" value="Find whereis records for this person" />
View
13 brain/views.py
@@ -455,6 +455,13 @@ def syncmbox():
return True
+def getnavigation(year=0, month=0):
+ if month == 0:
+ today = date.today()
+ month = today.month
+
+ return '<div><a href="/search">Search</a> - Calendars: <a href="/%s">Year</a> | <a href="/%s/%s">Month</a></div>' % (str(year), str(year), str(month))
+
def index(request, year=0, month=0, day=0):
now = datetime.now()
@@ -471,7 +478,6 @@ def index(request, year=0, month=0, day=0):
if month > 0 and month <= 12 and year > 0:
days = calendar.monthrange(year, month)
-
if days and day > 0 and day <= days[1]:
dayCal = singleday(year, month, day)
elif month > 0 and month <=12:
@@ -487,6 +493,8 @@ def index(request, year=0, month=0, day=0):
nextyear = now.year+1
prevyear = now.year-1
+ navigation = getnavigation(year, month)
+
return render_to_response('brain/templates/index.html', locals())
class EmailChoices(forms.Form):
@@ -561,4 +569,7 @@ def search(request):
except:
results = ''
+ now = date.today()
+ navigation = getnavigation(now.strftime('%Y'), now.strftime('%m'))
+
return render_to_response('search.html', locals())

0 comments on commit 9c23f28

Please sign in to comment.
Something went wrong with that request. Please try again.