1 from unfold.plugin import Plugin
3 class Hazelnut (Plugin):
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=None, query_all_uuid=None, checkboxes=False, columns=None, datatables_options={}, **settings):
9 Plugin.__init__ (self, **settings)
11 self.query_all_uuid = query_all_uuid
12 self.checkboxes=checkboxes
13 if columns is not None:
16 self.columns=self.query.fields
19 self.datatables_options=datatables_options
21 def template_file (self):
22 return "hazelnut.html"
24 def template_env (self, request):
26 env.update(self.__dict__)
27 env['columns']=self.columns
30 def requirements (self):
32 'js_files' : [ "js/hazelnut.js",
33 "js/manifold.js", "js/manifold-query.js",
34 "js/dataTables.js", "js/dataTables.bootstrap.js", "js/with-datatables.js",
35 "js/spin.presets.js", "js/spin.min.js", "js/jquery.spin.js",
36 "js/unfold-helper.js",
38 'css_files': [ "css/hazelnut.css" ,
39 "css/dataTables.bootstrap.css",
44 # the list of things passed to the js plugin
45 def json_settings_list (self):
46 return ['plugin_uuid', 'domid', 'query_uuid', 'query_all_uuid', 'checkboxes','datatables_options']