Author: croberts
Date: 2011-08-10 20:32:16 +0000 (Wed, 10 Aug 2011)
New Revision: 4917
Modified:
trunk/cumin/python/cumin/grid/tags.py
trunk/cumin/python/cumin/grid/tags.strings
Log:
More adjustments to the tagging forms. Now truncating the display of multiple input nodes
or tags and using the MTMSelect widget for all of the "large select box"
operations.
Modified: trunk/cumin/python/cumin/grid/tags.py
===================================================================
--- trunk/cumin/python/cumin/grid/tags.py 2011-08-10 15:42:25 UTC (rev 4916)
+++ trunk/cumin/python/cumin/grid/tags.py 2011-08-10 20:32:16 UTC (rev 4917)
@@ -497,7 +497,8 @@
def __init__(self, app, name):
item_parameter = SymbolParameter(app, "tag")
super(EditNodeTagsForm.TagsList, self).__init__(app, name, item_parameter)
- self._tmpl = WidgetTemplate(self, "double_filtered_select_html")
+ #self._tmpl = WidgetTemplate(self, "double_filtered_select_html")
+ self._tmpl = WidgetTemplate(self, "filtered_select_html")
self.update_enabled = False
@@ -510,8 +511,14 @@
items = self.do_get_items(session)
tags_string = ""
+ given_node = self.form.node_name.input.param.get(session)
+ selected_tags = self.app.wallaby.get_tag_names(given_node)
+
for i, tag in enumerate(items):
- tags_string = tags_string + "<option id='" + str(i) +
"'>" + tag.title + "</option>\n"
+ selected = ""
+ if(selected_tags and tag.title in selected_tags):
+ selected = " selected='selected' "
+ tags_string = tags_string + "<option id='" + str(i) +
"'" + selected + ">" + tag.title +
"</option>\n"
return tags_string
@@ -541,7 +548,7 @@
return items
def render_title(self, session):
- return "Update tags:"
+ return "Update tags"
class NodeName(StringField):
def __init__(self, app, name):
@@ -572,7 +579,15 @@
def get(self,session):
value = self.input.get(session)
+ if not value or value == "":
+ value = "No tagss currently selected"
return value
+
+ def render_inputs(self, session, *args):
+ value = self.input.get(session)
+ if(len(value) > 50):
+ value = value[:50] + "..." #indicate truncated value
+ return value
class DisabledInput(StringInput):
pass
@@ -660,10 +675,18 @@
def get(self,session):
value = self.input.get(session)
+
if not value or value == "":
value = "No nodes currently selected"
+
return value
+ def render_inputs(self, session, *args):
+ value = self.input.get(session)
+ if(len(value) > 50):
+ value = value[:50] + "..." #indicate truncated value
+ return value
+
def render_title(self, session):
return "Current nodes:"
Modified: trunk/cumin/python/cumin/grid/tags.strings
===================================================================
--- trunk/cumin/python/cumin/grid/tags.strings 2011-08-10 15:42:25 UTC (rev 4916)
+++ trunk/cumin/python/cumin/grid/tags.strings 2011-08-10 20:32:16 UTC (rev 4917)
@@ -145,9 +145,6 @@
-
-
-
[TagsList.double_filtered_select_html]
<script type="text/javascript">
//<![CDATA[
Show replies by date