Author: justi9
Date: 2007-10-13 15:06:31 -0400 (Sat, 13 Oct 2007)
New Revision: 1048
Modified:
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
Log:
Use a child template instead of a widget to render the context nav
links.
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-10-13 18:57:52 UTC (rev 1047)
+++ mgmt/cumin/python/cumin/page.py 2007-10-13 19:06:31 UTC (rev 1048)
@@ -20,8 +20,7 @@
self.modal = Attribute(app, "modal")
self.add_attribute(self.modal)
- self.citem = self.ContextItem(app, "citem")
- self.add_child(self.citem)
+ self.frame_tmpl = Template(self, "frame_html")
self.main = MainFrame(app, "main")
self.add_child(self.main)
@@ -81,9 +80,6 @@
frame = frame.show_exchange(session, exchange)
return self.set_current_frame(session, frame)
- def render_title(self, session, object):
- return "Cumin"
-
def render_class(self, session, object):
return self.modal.get(session) and "modal"
@@ -93,21 +89,19 @@
def get_frames(self, session):
return self.frames.get(session)
- def render_context_items(self, session, object):
+ def render_frames(self, session, object):
writer = Writer()
for frame in self.get_frames(session):
- writer.write(self.citem.render(session, frame))
+ self.frame_tmpl.render(session, frame, writer)
return writer.to_string()
- # XXX use a child template instead
- class ContextItem(Widget):
- def render_href(self, session, frame):
- return frame.render_href(session, frame.get_object(session))
+ def render_frame_href(self, session, frame):
+ return frame.render_href(session, frame.get_object(session))
- def render_content(self, session, frame):
- return frame.render_title(session, frame.get_object(session))
+ def render_frame_title(self, session, frame):
+ return frame.render_title(session, frame.get_object(session))
class MainFrame(CuminFrame):
def __init__(self, app, name):
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-13 18:57:52 UTC (rev 1047)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-13 19:06:31 UTC (rev 1048)
@@ -372,7 +372,7 @@
<li>Hi, <strong>nsantos</strong></li>
<li><a class="action" href="">Log
Out</a></li>
</ul>
- <ul id="context">{context_items}</ul>
+ <ul id="context">{frames}</ul>
</div>
<div id="body">{content}</div>
<div id="foot">
@@ -380,8 +380,8 @@
</body>
</html>
-[ContextItem.html]
-<li><a href="{href}">{content}</a></li>
+[CuminPage.frame_html]
+<li><a href="{frame_href}">{frame_title}</a></li>
[MainView.html]
<div class="oblock">