From 12f8f3859a4cff44373fd75f9e3b63b291ab2c2d Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Fri, 30 Mar 2012 01:27:53 -0400 Subject: [PATCH] This is what victory looks like! FlattenerFilterDialog Heh, ok, it's not total victory. FlattenerFilterDialog works (it's a small subclass of PCrudFilterDialog), and it cooperates with FlattenerGrid. That's the good news. But the way it works is sometimes less than ideal due to design under-think. Imagine core class acp, and you have a map for the flattener with these columns, because these are the things you want to see in the grid: { "barcode": "barcode", "shelving_loc": "location.name", "shelving_loc_owning_lib": "location.owning_lib.shortname" } The FlattenerFilterDialog figures out the terminal fields for each of those paths, which are acp.barcode, acpl.name, and aou.shortname. It naturally gives you the appropriate AutoWidget for each of those things. Which is a TextBox. In every case. Because all of those are text field. See the problem? They do /work/, but as a user you probably want to get an org unit dropdown instead of being expected to type "BR1" or "ARL-ATH" or whatever. So I guess the way to make this better is to give an option in the FlattenerGrid per-column (which will pass this option onto FlattenerFilterDialog) that tells us how many steps /from/ the end to stop when we're looking for a field to inform our choice of AutoWidget? So instead of [acp.]location.owning_lib.shortname = aou.shortname, if we stop at one step from the end we get acpl.owning_lib instead, which would give us a much more appropriate autowidget. yeah. that'll be the solution Also, as a bonus, you can now leave out the header name between and , and it will be filled in from the IDL. This is surprisingly often not what you really want, but it's a better reasonable default than the raw field name. Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/src/templates/conify/flattener_test.tt2 | 20 +-- .../dojo/openils/widget/FlattenerFilterDialog.js | 56 +++++++ .../web/js/dojo/openils/widget/FlattenerGrid.js | 164 +++++++++++++++++++-- .../js/dojo/openils/widget/PCrudFilterDialog.js | 122 +++++++++------ .../js/dojo/openils/widget/_GridHelperColumns.js | 2 - 5 files changed, 289 insertions(+), 75 deletions(-) create mode 100644 Open-ILS/web/js/dojo/openils/widget/FlattenerFilterDialog.js diff --git a/Open-ILS/src/templates/conify/flattener_test.tt2 b/Open-ILS/src/templates/conify/flattener_test.tt2 index 1011e44511..e6788f96fa 100644 --- a/Open-ILS/src/templates/conify/flattener_test.tt2 +++ b/Open-ILS/src/templates/conify/flattener_test.tt2 @@ -1,10 +1,6 @@ [% WRAPPER base.tt2 %] [% ctx.page_title = 'Flattener Test' %]