forget about jquery-ui altogether, use bootstrap for consistency
[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/dataTables.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/dataTables.bootstrap.css",
36                            ],
37             }
38         return reqs
39
40     # the list of things passed to the js plugin
41     def json_settings_list (self): return ['plugin_uuid','query_uuid','checkboxes']