26ce628525205a33a64ecf555c7172848fea8f24
[myslice.git] / plugins / hazelnut / hazelnut.py
1 from unfold.plugin import Plugin
2
3 class Hazelnut (Plugin):
4
5     # set checkboxes if a final column with checkboxes is desired
6     # pass columns as the initial set of columns
7     #   if None then this is taken from the query's fields
8     def __init__ (self, query, checkboxes=False, columns=None, **settings):
9         Plugin.__init__ (self, **settings)
10         self.query=query
11         self.checkboxes=checkboxes
12         if columns is not None:
13             self.columns=columns
14         else:
15             self.columns=self.query.fields
16
17     def template_file (self):
18         return "hazelnut.html"
19
20     def template_env (self, request):
21         env={}
22         env.update(self.__dict__)
23         env['columns']=self.columns
24         return env
25
26     def requirements (self):
27         reqs = {
28             'js_files' : [ "js/hazelnut.js", 
29                            "js/manifold.js", "js/manifold-query.js", 
30                            "js/dataTables.js", "js/DT_bootstrap.js", "js/with-datatables.js",
31                            "js/spin.presets.js", "js/spin.min.js", "js/jquery.spin.js", 
32                            "js/unfold-helper.js",
33                            ] ,
34             'css_files': [ "css/hazelnut.css" , 
35                            "css/demo_table.css", "css/demo_table_jui.css", 
36 #                           "css/jquery-ui.css",
37                            ],
38             }
39         return reqs
40
41     # the list of things passed to the js plugin
42     def json_settings_list (self): return ['plugin_uuid','query_uuid','checkboxes']