Backport commit r48254, committed by Nathan Gray. Always include date sub-template, and just disable it when not needed.

Fixes date widgets not validated.
This commit is contained in:
Hadi Nategh 2014-08-26 13:41:48 +00:00
parent 2acbdb84d6
commit 280ae16008
2 changed files with 14 additions and 3 deletions

View File

@ -115,22 +115,33 @@ app.classes.infolog = AppJS.extend(
}, },
/** /**
* Enable or disable the date filter
* *
* If the filter is set to something that needs dates, we enable the
* header_left template. Otherwise, it is disabled.
*/ */
filter_change: function() filter_change: function()
{ {
var filter = this.et2.getWidgetById('filter'); var filter = this.et2.getWidgetById('filter');
var nm = this.et2.getWidgetById('nm'); var nm = this.et2.getWidgetById('nm');
var dates = this.et2.getWidgetById('infolog.index.dates');
if(nm && filter) if(nm && filter)
{ {
switch(filter.getValue()) switch(filter.getValue())
{ {
case 'bydate': case 'bydate':
case 'duedate': case 'duedate':
nm.set_header_left('infolog.index.dates');
if (filter && dates)
{
dates.set_disabled(false);
}
break; break;
default: default:
nm.set_header_left(); if (dates)
{
dates.set_disabled(true);
}
break; break;
} }
} }

View File

@ -163,7 +163,7 @@
<template id="header_right"/> <template id="header_right"/>
</row> </row>
<row> <row>
<nextmatch id="nm" template="infolog.index.rows" span="all"/> <nextmatch id="nm" template="infolog.index.rows" header_left="infolog.index.dates" span="all"/>
</row> </row>
<row> <row>
<hbox class=" "> <hbox class=" ">