6e041c61cdab138453034fe88df54878cae78408
[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.add_to_settings ('list')
12         self.with_datatables = with_datatables
13         self.add_to_settings ('with_datatables')
14
15     # SimpleList is useless per se anyways
16     def title (self) : return "Title for Simple List"
17
18     def template (self): return "simplelist.html"
19
20     def requirements (self):
21         reqs = { 'js_files' : [ "js/simplelist.js" ],
22                  'css_files': [ "css/simplelist.css" ],
23                  }
24         if self.with_datatables:
25             reqs['js_files'].append ("datatables/js/dataTables.js")
26             reqs['js_files'].append ("js/with-datatables.js")
27         print self.classname(),reqs
28         return reqs
29 # for tests
30 #                 'js_chunks' : "/* a javascript chunk */",       
31 #                 'css_chunks': "/* a css style */ ",