]> asedeno.scripts.mit.edu Git - bluechips.git/commitdiff
Change spend controller to use flash messages
authorEvan Broder <broder@mit.edu>
Wed, 16 Jul 2008 05:06:15 +0000 (05:06 +0000)
committerEvan Broder <broder@mit.edu>
Wed, 16 Jul 2008 05:06:15 +0000 (05:06 +0000)
bluechips/controllers/spend.py
bluechips/templates/spend/new.mako [deleted file]

index 64318cf5139c4df770ebf96da8c7634d6436d11c..a775084d4e8c1de57818e0a0d9792a924b381a88 100644 (file)
@@ -28,6 +28,17 @@ class SpendController(BaseController):
         even_split(e)
         meta.Session.commit()
         
-        c.expenditure = e
+        h.flash('Expenditure recorded.')
+        h.flash("""Want to do something unusual?
+
+<ul id="expenditure_options">
+  <li>%s</li>
+  <li>%s</li>
+</ul>""" % (h.link_to('Change the split', h.url_for(controller='spend',
+                                                   action='split',
+                                                   id=e.id)),
+           h.link_to('Spin off a subitem', h.url_for(controller='spend',
+                                                     action='subitem',
+                                                     id=e.id))))
         
-        return render('/spend/new.mako')
+        return h.redirect_to('/')
diff --git a/bluechips/templates/spend/new.mako b/bluechips/templates/spend/new.mako
deleted file mode 100644 (file)
index aec749d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<%inherit file="/base.mako"/>
-
-<%def name="title()">${parent.title()} :: Expenditure Details</%def>
-
-<p>Expenditure logged.</p>
-
-<h2>Want to do something unusual?</h2>
-
-<ul id="expenditure_options">
-  <li>${h.link_to('Change the split', h.url_for(action='split', id=c.expenditure.id))}</li>
-  <li>${h.link_to('Spin off a subitem', h.url_for(action='subitem', id=c.expenditure.id))}</li>
-</ul>