From eac6f6fa265c7b8e04808d012aef562d3b15855d Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Thu, 20 Jul 2017 17:52:38 -0400 Subject: [PATCH] LP#1705524: Use the new grid configuration for date format in the bills list The bills list in the patron interface predated any grid date formatting, so we bring it into the modern world. This also enhances the grid autoformatting for dates to support both flattened and dot-pathed item layout. Signed-off-by: Mike Rylander --- Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 | 4 +--- Open-ILS/web/js/ui/default/staff/services/grid.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 index 7d71951570..e0baf9fbee 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bills_list.tt2 @@ -85,9 +85,7 @@ - + diff --git a/Open-ILS/web/js/ui/default/staff/services/grid.js b/Open-ILS/web/js/ui/default/staff/services/grid.js index 3b8ae904b3..0b9963d43a 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -1855,6 +1855,15 @@ angular.module('egGridMod', * Others likely to follow... */ .filter('egGridValueFilter', ['$filter','egCore', function($filter,egCore) { + function traversePath(obj,path) { + var list = path.split('.'); + for (var part in path) { + if (obj[path]) obj = obj[path] + else return undef; + } + return obj; + } + var GVF = function(value, column, item) { switch(column.datatype) { case 'bool': @@ -1876,10 +1885,16 @@ angular.module('egGridMod', ? item[column.dateonlyinterval]() : item[column.dateonlyinterval]; + if (column.dateonlyinterval && !interval) // try it as a dotted path + interval = traversePath(item, column.dateonlyinterval); + var context = angular.isFunction(item[column.datecontext]) ? item[column.datecontext]() : item[column.datecontext]; + if (column.datecontext && !context) // try it as a dotted path + context = traversePath(item, column.datecontext); + var date_filter = column.datefilter || 'egOrgDateInContext'; return $filter(date_filter)(value, column.dateformat, context, interval); -- 2.11.0