815170ec719705fc897270bcdfa2e23ca380a616
[myslice.git] / plugins / simplelist.py
1 from engine.plugin import Plugin
2
3 class SimpleList (Plugin) :
4
5     # it would make sense to *not* define any constructor here and let Plugin kick in
6     # however it feels nicer this way as we document the settings used in our own template
7     # plus it's less confusing for any subclass if they can be sure which constructor to call
8     def __init__ (self, list=[], with_datatables=False, **settings):
9         Plugin.__init__ (self, **settings)
10         self.list=list
11         self.with_datatables = with_datatables
12
13     # SimpleList is useless per se anyways
14     def template_file (self): return "simplelist.html"
15
16     def requirements (self):
17         reqs = { 'js_files' : [ "js/simplelist.js", "js/plugin.js", "js/query.js",
18                                 "js/manifold-pubsub.js", "js/manifold-async.js", ] ,
19                  'css_files': [ "css/simplelist.css" ],
20                  }
21         if self.with_datatables:
22             reqs['js_files'].append ("datatables/js/dataTables.js")
23             reqs['js_files'].append ("js/with-datatables.js")
24         return reqs
25 # for tests
26 #                 'js_chunks' : "/* a javascript chunk */",       
27 #                 'css_chunks': "/* a css style */ ",
28     
29     def json_settings_list (self): return ['plugin_uuid', 'query','query_uuid','key','value']
30