--- /dev/null
+from engine.plugin import Plugin
+
+class StaticList (Plugin) :
+
+ # only deal with our own stuff here and let Plugin handle the rest
+ def __init__ (self, list=[], with_datatables=False, **settings):
+ Plugin.__init__ (self, **settings)
+ self.list=list
+ self.with_datatables = with_datatables
+
+ # SimpleList is useless per se anyways
+ def template_file (self):
+ return "staticlist.html"
+
+ def template_env (self, request):
+ env={}
+ header=getattr(self,'header',None)
+ if header: env['header']=header
+ env['list']=self.list
+ return env
+
+ def requirements (self):
+ reqs = { 'js_files' : [ ] ,
+ 'css_files': [ "css/staticlist.css" ],
+ }
+ if self.with_datatables:
+ reqs['js_files'].append ("datatables/js/dataTables.js")
+ reqs['js_files'].append ("js/with-datatables.js")
+ return reqs
from plugins.verticallayout import VerticalLayout
from plugins.tabs import Tabs
-from plugins.simplelist import SimpleList
-from plugins.slicelist import SliceList
+from plugins.staticlist import StaticList
from plugins.quickfilter import QuickFilter
from plugins.raw import Raw
main_plugin = \
VerticalLayout ( pluginset=pluginset,
title='title for the vertical layout',
- sons = [ SimpleList (pluginset=pluginset,
- title='SimpleList and dataTables',
+ sons = [ StaticList (pluginset=pluginset,
+ title='StaticList - with datatables - starts toggled off',
list=hard_wired_list,
- header='Hard wired',
+ header='Hard wired header',
foo='the value for foo',
with_datatables=True,
toggled=False),
title='a raw plugin',domid='raw1',
togglable=False,
html= 3*lorem_p),
- SliceList(pluginset=pluginset,
- title='a slice list',
- togglable=False,
- list=hard_wired_slice_names),
+ StaticList(pluginset=pluginset,
+ title='a slice list',
+ togglable=False,
+ header="static list but not togglable",
+ list=hard_wired_slice_names),
Raw (pluginset=pluginset,
title='raw title',domid='raw2',
togglable=False,html=lorem) ]),
- SimpleList (pluginset=pluginset,
+ StaticList (pluginset=pluginset,
title='SimpleList with slice names',
list=hard_wired_slice_names,
),
##########
# lacks a/href to /slice/%s
- related_plugin = SliceList (pluginset=pluginset,
- title='SliceList plugin',domid='slicelist1',
- with_datatables='yes',
- list=hard_wired_slice_names,
- header='Slices')
+ related_plugin = StaticList (pluginset=pluginset,
+ title='SliceList plugin',domid='slicelist1',
+ with_datatables='yes',
+ list=hard_wired_slice_names,
+ header='Slices')
# likewise but on the side view
template_env [ 'content_related' ] = related_plugin.render (request)