This is what victory looks like! FlattenerFilterDialog
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 30 Mar 2012 05:27:53 +0000 (01:27 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 30 Mar 2012 05:27:53 +0000 (01:27 -0400)
commit12f8f3859a4cff44373fd75f9e3b63b291ab2c2d
tree875ec6f5e606cfef9f80a450843dcdde4e6845a6
parent9bfd10d62b4f4bbb22e0d580af4d666fb17e62c2
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 <th> and
</th>, 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 <lebbeous@esilibrary.com>
Open-ILS/src/templates/conify/flattener_test.tt2
Open-ILS/web/js/dojo/openils/widget/FlattenerFilterDialog.js [new file with mode: 0644]
Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js
Open-ILS/web/js/dojo/openils/widget/PCrudFilterDialog.js
Open-ILS/web/js/dojo/openils/widget/_GridHelperColumns.js