From 20e21fa3d7060e8fbe9bf6012aada19a2357734d Mon Sep 17 00:00:00 2001 From: eldadfux Date: Sat, 17 Aug 2019 09:08:14 +0300 Subject: [PATCH] Added empty value filter as fallback --- public/scripts/filters.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/scripts/filters.js b/public/scripts/filters.js index 0f89549b16..12ecc02241 100644 --- a/public/scripts/filters.js +++ b/public/scripts/filters.js @@ -76,6 +76,17 @@ window.ls.filter let total = Math.ceil(parseInt($value || 0) / env.PAGING_LIMIT); return (total) ? total : 1; }) + .add('emptyDash', function ($value, env) { + if(!$value) { + return '-'; + } + + if(Array.isArray($value)) { + return $value.length + ' items'; + } + + return $value; + }) .add('humanFileSize', function ($value) { if (!$value) { return 0;