Author: eallen
Date: 2011-03-30 14:54:16 +0000 (Wed, 30 Mar 2011)
New Revision: 4673
Modified:
trunk/cumin/python/cumin/grid/negotiator.py
trunk/cumin/python/cumin/grid/pool.strings
trunk/cumin/python/cumin/objectframe.py
trunk/cumin/python/cumin/objectframe.strings
Log:
Don't display the task summary section if there are no visible tasks
Allow a task to be marked as not visible in the page header
Modified: trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- trunk/cumin/python/cumin/grid/negotiator.py 2011-03-29 20:47:56 UTC (rev 4672)
+++ trunk/cumin/python/cumin/grid/negotiator.py 2011-03-30 14:54:16 UTC (rev 4673)
@@ -422,6 +422,8 @@
super(NegotiatorEditDynamicQuota, self).__init__(app, frame)
self.form = EditDynamicQuotaForm(app, self.name, self)
+ # don't show in page summary section
+ self.visible = False
def get_title(self, session):
return ""
Modified: trunk/cumin/python/cumin/grid/pool.strings
===================================================================
--- trunk/cumin/python/cumin/grid/pool.strings 2011-03-29 20:47:56 UTC (rev 4672)
+++ trunk/cumin/python/cumin/grid/pool.strings 2011-03-30 14:54:16 UTC (rev 4673)
@@ -1,12 +1,3 @@
-[PoolView.css]
-div.PoolView div.ObjectViewSummary {
- display: none;
-}
-
-div.PoolView div.ObjectViewSummaryClear {
- margin-top: 1em;
-}
-
[PoolView.error_html]
<div id="{id}" class="{class}">
{heading}
Modified: trunk/cumin/python/cumin/objectframe.py
===================================================================
--- trunk/cumin/python/cumin/objectframe.py 2011-03-29 20:47:56 UTC (rev 4672)
+++ trunk/cumin/python/cumin/objectframe.py 2011-03-30 14:54:16 UTC (rev 4673)
@@ -28,15 +28,6 @@
self.tasks = list()
- self.summary_attributes = list()
-
- #self.add_summary_attribute(cls._qmf_update_time)
-
- def add_summary_attribute(self, attr):
- assert attr not in self.summary_attributes, attr
-
- self.summary_attributes.append(attr)
-
def init(self):
super(ObjectFrame, self).init()
@@ -145,7 +136,8 @@
self.table_tmpl = WidgetTemplate(self, "table_html")
def do_render(self, session):
- if len(self.frame.tasks) > 6:
+ visible_tasks = [x for x in self.frame.tasks if x.visible]
+ if len(visible_tasks) > 6:
writer = Writer()
self.table_tmpl.render(writer, session)
return writer.to_string()
@@ -160,8 +152,9 @@
def render_task_links(self, session, start):
writer = Writer()
- end = min(start + 6, len(self.frame.tasks))
- for task in self.frame.tasks[start:end]:
+ visible_tasks = [x for x in self.frame.tasks if x.visible]
+ end = min(start + 6, len(visible_tasks))
+ for task in visible_tasks[start:end]:
writer.write(self.link.render(session, task))
return writer.to_string()
@@ -176,11 +169,13 @@
def render_content(self, session, task):
return task.get_title(session)
-class SummaryAttributes(ObjectAttributes):
- pass
-
class SummaryTasks(ObjectTasks):
- pass
+ # don't ouput the html container if there will not be any
+ # content since the container has margins
+ def do_render(self, session):
+ visible_tasks = [x for x in self.frame.tasks if x.visible]
+ if len(visible_tasks):
+ return super(SummaryTasks, self).do_render(session)
class ObjectView(Widget):
def __init__(self, app, name, object):
@@ -272,20 +267,14 @@
def __init__(self, app, name, object):
super(ObjectViewSummary, self).__init__(app, name, object)
- attributes = self.Attributes(app, "attributes", self.object)
- self.add_child(attributes)
-
tasks = SummaryTasks(app, "tasks", self.object)
self.add_child(tasks)
def render_wide(self, session):
- if len(self.frame.tasks) > 6:
+ visible_tasks = [x for x in self.frame.tasks if x.visible]
+ if len(visible_tasks) > 6:
return "wide"
- class Attributes(SummaryAttributes):
- def get_attributes(self, session):
- return self.frame.summary_attributes
-
class DetailsAttributes(ObjectAttributes):
pass
@@ -353,6 +342,9 @@
self.frame = frame
self.frame.tasks.append(self)
+ # should this task be listed in the ObjectViewSummary section
+ self.visible = True
+
def init(self):
super(ObjectFrameTask, self).init()
Modified: trunk/cumin/python/cumin/objectframe.strings
===================================================================
--- trunk/cumin/python/cumin/objectframe.strings 2011-03-29 20:47:56 UTC (rev 4672)
+++ trunk/cumin/python/cumin/objectframe.strings 2011-03-30 14:54:16 UTC (rev 4673)
@@ -57,30 +57,11 @@
[ObjectTasksLink.html]
<li><a href="{href}">{content}</a></li>
-[SummaryAttributes.css]
-div.SummaryAttributes {
- width: 20em;
- margin: 0 0 1.5em 0;
- font-size: 0.9em;
-}
-
-div.SummaryAttributes tbody th, div.SummaryAttributes tbody td {
- padding: 0.125em 0;
-}
-
-[SummaryAttributes.html]
-<div id="{id}" class="{class}">
- <table>
- <tbody>{attributes}</tbody>
- </table>
-</div>
-
[SummaryTasks.css]
ul.SummaryTasks {
width: 15em;
- float: right;
list-style: none;
- margin: 0 0 1.5em 0;
+ margin: 0.5em 0 0 0;
}
[ObjectView.css]
@@ -109,7 +90,7 @@
div.ObjectViewSummary {
/* border-top: 1px dotted #ccc; */
- padding: 0.5em 0 0 0;
+ /* padding: 0.5em 0 0 0; */
width: 40em;
font-size: 0.9em;
}
@@ -117,14 +98,17 @@
width: 55em;
}
+div.ObjectViewHeader {
+ margin-bottom: 1em;
+}
+
[ObjectView.html]
<div id="{id}" class="{class}">
-{context}
-
-{heading}
-
-{summary}
-
+ <div class="ObjectViewHeader">
+ {context}
+ {heading}
+ {summary}
+ </div>
{body}
</div>
@@ -138,8 +122,7 @@
[ObjectViewSummary.html]
<div class="{class} {wide}">
{tasks}
- {attributes}
-</div><div class="ObjectViewSummaryClear"
style="clear:both;"></div>
+</div>
[ObjectViewContext.html]
<div class="{class}">{links}</div>