rewrite simplelist to use a table (thus datatable-ready) instead of <ul> -- ctd
[myslice.git] / plugins / simplelist.py
1 from engine.plugin import Plugin
2
3 class SimpleList (Plugin) :
4
5     # only deal with our own stuff here and let Plugin handle the rest
6     def __init__ (self, key, value, with_datatables=False, **settings):
7         Plugin.__init__ (self, **settings)
8         self.key=key
9         self.value=value
10         self.with_datatables = with_datatables
11
12     # SimpleList is useless per se anyways
13     def template_file (self): 
14         return "simplelist.html"
15     
16     def template_env (self, request):
17         env={}
18         header=getattr(self,'header',None)
19         if header: env['header']=header
20         return env
21
22     def requirements (self):
23         reqs = { 'js_files' : [ "js/simplelist.js", "js/plugin.js", "js/query.js", "js/onavail.js",
24                                 "js/manifold-pubsub.js", "js/manifold-async.js", "spin/spin.all.js", 
25 ] ,
26                  'css_files': [ "css/simplelist.css" ],
27                  }
28         if self.with_datatables:
29             reqs['js_files'].append ("datatables/js/dataTables.js")
30             reqs['js_files'].append ("js/with-datatables.js")
31         return reqs
32     
33     def json_settings_list (self): return ['plugin_uuid', 'query','query_uuid','key','value']
34