From 433a5d301336bc9d402af49b2aceb257f57514bb Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 14 Mar 2013 16:19:50 +0100 Subject: [PATCH] a pass on quickfilter, at least it displays something related to the input 'criterias' the javascript has probably never been tested at that point I would think also it would make sense to read the metadata info --- README | 32 +-- engine/plugin.py | 2 +- plugins/lists/simplelist.js | 4 +- plugins/lists/simplelist.py | 2 +- plugins/lists/staticlist.py | 2 +- plugins/querycode/querycode.py | 1 + plugins/quickfilter/quickfilter.html | 14 +- plugins/quickfilter/quickfilter.js | 322 +++++++++++++-------------- plugins/quickfilter/quickfilter.py | 20 +- trash/dashboard.py | 4 +- trash/pluginview.py | 2 +- 11 files changed, 187 insertions(+), 218 deletions(-) diff --git a/README b/README index f1680239..92724d1f 100644 --- a/README +++ b/README @@ -162,14 +162,10 @@ I've tried to keep track of the version I picked and to have an easy upgrade pat we chose to have all static files (images, but also javascript and stylesheets) in the various proj or app where they belong, under a static/ subdir that has this structure: where-it-belongs/ - static/ img/ css/ js/ -NOTE. in essence any of these files can be moved around (from e.g. one templates/ dir to another) -at any time without any change needed in the code - * filenames / locations you can run the following make targets to have a summary of where things are @@ -178,27 +174,13 @@ at any time without any change needed in the code -- or -- $ make list-all - as far as possible it's great to have things named the same after e.g. say a plugin name - like e.g. - plugins/quickfilter.py - plugins/templates/quickfilter.html - plugins/static/js/quickfilter.js - plugins/static/css/quickfilter.css - - it's sometimes not working though, so here are a few additional conventions - the global layout (for now I needed only one) is named layout-myslice.html - it provides the global layout with one menu stuck on top and 2 divs 3/4 1/4 - - the views that I currently have are all named in templates/view-<>.html - they all extend a layout - they should/could admittedly move where they belong (in auth/slice/engine) - so that they would go with their views.py code, but for now it's impler this way +* plugins + use a naming scheme as simple as possible + like e.g. + plugins/quickfilter/quickfilter.py + plugins/quickfilter/quickfilter.html + plugins/quickfilter/quickfilter.js + plugins/quickfilter/quickfilter.css - and there are 3 'widgets' (login, logout, and topmenu) - these could maybe be best implemented as a plugin now that I have the right model for that - however esp. for the login/logout I'm not quite sure this will remain over time - so for now it's good enough like this -So in summary there's still room for a lot of improvement on this particular topic.. -At the very least topmenu should be made a plugin, and maybe also login/logout diff --git a/engine/plugin.py b/engine/plugin.py index 36d60dfc..8f817a5b 100644 --- a/engine/plugin.py +++ b/engine/plugin.py @@ -16,7 +16,7 @@ from engine.prelude import Prelude # . True : to debug all plugin DEBUG= False -#DEBUG= [ 'SliceList' ] +DEBUG= [ 'QuickFilter' ] # decorator to deflect calls on Plugin to its Prelude through self.page.prelude def to_prelude (method): diff --git a/plugins/lists/simplelist.js b/plugins/lists/simplelist.js index 6fdb4c3f..6ea2a77d 100644 --- a/plugins/lists/simplelist.js +++ b/plugins/lists/simplelist.js @@ -34,7 +34,7 @@ /* passing $this as 2nd arg: callbacks will retrieve $this as e.data */ $.subscribe(channel, $this, update_plugin); if (debug) window.console.log('subscribing to ' + channel); - $this.data('SimpleList', {options: options}); + $this.data('SimpleList', options); } }); }, @@ -82,7 +82,7 @@ else regular_set_message (error); return; } - var options = $plugindiv.data().SimpleList.options; + var options = $plugindiv.data().SimpleList; if (use_datatables) datatables_update_table ($table,$tbody,rows,options.key); else regular_update_table ($table,$tbody,rows,options.key); diff --git a/plugins/lists/simplelist.py b/plugins/lists/simplelist.py index a86d73c2..50cd573d 100644 --- a/plugins/lists/simplelist.py +++ b/plugins/lists/simplelist.py @@ -27,7 +27,7 @@ class SimpleList (Plugin) : 'css_files': [ "css/simplelist.css" ], } if self.with_datatables: - reqs['js_files'].append ("datatables/js/dataTables.js") + reqs['js_files'].append ("js/dataTables.js") reqs['js_files'].append ("js/with-datatables.js") return reqs diff --git a/plugins/lists/staticlist.py b/plugins/lists/staticlist.py index b9c644b6..134917a8 100644 --- a/plugins/lists/staticlist.py +++ b/plugins/lists/staticlist.py @@ -24,6 +24,6 @@ class StaticList (Plugin) : 'css_files': [ "css/staticlist.css" ], } if self.with_datatables: - reqs['js_files'].append ("datatables/js/dataTables.js") + reqs['js_files'].append ("js/dataTables.js") reqs['js_files'].append ("js/with-datatables.js") return reqs diff --git a/plugins/querycode/querycode.py b/plugins/querycode/querycode.py index fc5c163f..4b84548a 100644 --- a/plugins/querycode/querycode.py +++ b/plugins/querycode/querycode.py @@ -31,4 +31,5 @@ class QueryCode (Plugin): def json_settings_list (self): return ['plugin_uuid', 'query','query_uuid'] + # because we have a link to a query it looks like we need a spin, let's make this right def start_with_spin (self): return False diff --git a/plugins/quickfilter/quickfilter.html b/plugins/quickfilter/quickfilter.html index 491cdcb8..e9e8330c 100644 --- a/plugins/quickfilter/quickfilter.html +++ b/plugins/quickfilter/quickfilter.html @@ -1,14 +1,14 @@
- +
- {% for criteria in list %} - - {% endfor %} - + {% for criteria in criterias %} + + {% endfor %} + - {% for criteria in list %} -
{{criteria.key}}Extra fields{{criteria.key}}Extra fields
+ {% for criteria in criterias %} +