cleanup
authorsylvain.thenault@logilab.fr
Mon, 19 Jan 2009 19:23:47 +0100
changeset 443 3c0e9c1d645d
parent 442 b1cf7611f8b3
child 444 c6f20e605b84
cleanup
web/views/treeview.py
--- a/web/views/treeview.py	Mon Jan 19 18:50:18 2009 +0100
+++ b/web/views/treeview.py	Mon Jan 19 19:23:47 2009 +0100
@@ -9,8 +9,9 @@
 class TreeView(EntityView):
     id = 'treeview'
     accepts = ('Any',)
-    fstree = False
     itemvid = 'treeitemview'
+    css_classes = 'treeview widget'
+    title = _('tree view')
     
     def call(self, subvid=None):
         if subvid is None and 'subvid' in self.req.form:
@@ -19,17 +20,14 @@
             subvid = 'oneline'
         self.req.add_css('jquery.treeview.css')
         self.req.add_js(('cubicweb.ajax.js', 'jquery.treeview.js', 'cubicweb.widgets.js'))
-        css_classes = 'treeview widget'
-        if self.fstree:
-            css_classes += ' filetree'
         # XXX noautoload is a quick hack to avoid treeview to be rebuilt
         #     after a json query and avoid double toggling bugs.
         #     Need to find a way to do that cleanly.
         if 'noautoload' in self.req.form:
-            self.w(u'<ul class="%s" cubicweb:wdgtype="TreeView">' % css_classes)
+            self.w(u'<ul class="%s" cubicweb:wdgtype="TreeView">' % self.css_classes)
         else:
             self.w(u'<ul class="%s" cubicweb:loadtype="auto" cubicweb:wdgtype="TreeView">'
-                   % css_classes)
+                   % self.css_classes)
         for rowidx in xrange(len(self.rset)):
             self.wview(self.itemvid, self.rset, row=rowidx, col=0,
                        vid=subvid, parentvid=self.id)
@@ -40,14 +38,15 @@
     """specific version of the treeview to display file trees
     """
     id = 'filetree'
-    fstree = True
+    css_classes = 'treeview widget filetree'
+    title = _('file tree view')
 
     def call(self, subvid=None):
         super(FileTreeView, self).call(subvid='filetree-oneline')
 
 
 
-class FileItemInnerView(OneLineView):
+class FileItemInnerView(EntityView):
     """inner view used by the TreeItemView instead of oneline view
 
     This view adds an enclosing <span> with some specific CSS classes