From b296018cbb77cba15109540e5eee16d15cbdd7cb Mon Sep 17 00:00:00 2001
From: Simon Cozens <simon@simon-cozens.org>
Date: Mon, 12 Feb 2007 20:57:14 +0000
Subject: [PATCH] Ajaxify the calendar. Closes #5.

git-svn-id: http://svn.simon-cozens.org/memories/trunk@30 041978f6-d955-411f-a9d7-1d8545c9c3c7
---
 templates/calendar | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/templates/calendar b/templates/calendar
index c71bf82..68403a8 100644
--- a/templates/calendar
+++ b/templates/calendar
@@ -1,4 +1,10 @@
+<div id="calendar">
 <div align="center" style="border: 1px solid black; background: #eee">
+<script>
+  function redo_self(arg) {
+    new Ajax.Updater("calendar","[%base%]/calendar?view_cal="+arg, { method: "get" })
+  }
+</script>
 [% IF request.action == "view" %]
     [% SET shot = photo.shot %]
 [% END %]
@@ -9,12 +15,12 @@
 [% SET calendar = request.calendar(date.ymd) %]
 <table class="calendar">
     <tr>
-        <th> <a href="[%base%]/[%request.path%]?view_cal=[%prev.ymd%]">&laquo; </a></th>
+        <th> <a href="javascript:redo_self('[%prev.ymd%]')">&laquo; </a></th>
         <th colspan="5"> 
             [% date.strftime("%Y-%m") %] 
         </th>
         <th> [% IF next %]
-            <a href="[%base%]/[%request.path%]?view_cal=[%next.ymd%]">&raquo; </a>
+            <a href="javascript:redo_self('[%next.ymd%]')">&raquo; </a>
             [% END %]
         </th>
     </tr>
@@ -41,3 +47,4 @@
 [% END %]
 </table>
 </div>
+</div>
-- 
2.39.5