From 79f6e59fbdee1e3de7ed16ffb803de12fb55aba3 Mon Sep 17 00:00:00 2001 From: Martin Czuchra Date: Wed, 5 Feb 2014 11:43:20 +0100 Subject: [PATCH] Fixes filter for (none) in custom fields. The id -1 and the empty string both need to be added as values in the (none)-case, since (none) has to both match work packages with custom fields with an empty value and work packages with no custom field. --- app/assets/javascripts/timelines/TimelineLoader.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/assets/javascripts/timelines/TimelineLoader.js b/app/assets/javascripts/timelines/TimelineLoader.js index 98aff16c94..aa4671c263 100644 --- a/app/assets/javascripts/timelines/TimelineLoader.js +++ b/app/assets/javascripts/timelines/TimelineLoader.js @@ -750,6 +750,15 @@ Timeline.TimelineLoader = (function () { if (custom_fields.hasOwnProperty(field_id)) { var value = custom_fields[field_id]; + + // -1 and the empty string both need to be added in the + // (none)-case, since (none) has to both match work packages + // w/ custom fields w/ an empty value and work packages with + // no custom field. + if (value.length === 1 && value[0] == "-1") { + value.push(""); + } + if (value && value !== "" && value.length > 0) { hash["cf_" + field_id] = value; }