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, checkboxes=False, columns=None, **settings):
9 Plugin.__init__ (self, **settings)
11 self.checkboxes=checkboxes
12 if columns is not None:
15 self.columns=self.query.fields
17 def template_file (self):
18 return "hazelnut.html"
20 def template_env (self, request):
22 env.update(self.__dict__)
23 env['columns']=self.columns
26 def requirements (self):
28 'js_files' : [ "js/hazelnut.js",
29 "js/manifold.js", "js/manifold-query.js",
30 "js/dataTables.js", "js/with-datatables.js",
31 "js/spin.presets.js", "js/spin.min.js", "js/jquery.spin.js",
32 "js/unfold-helper.js",
34 'css_files': [ "css/hazelnut.css" ,
35 "css/demo_table.css", "css/demo_table_jui.css", "css/jquery-ui.css",
40 # the list of things passed to the js plugin
41 def json_settings_list (self): return ['plugin_uuid','query_uuid','checkboxes']