Fix details filter not doing anything unless you close the tab

This commit is contained in:
Nathan Gray 2014-06-04 19:29:35 +00:00
parent a866eb5ed9
commit f82559b525
3 changed files with 26 additions and 11 deletions

View File

@ -746,7 +746,7 @@ class timesheet_ui extends timesheet_bo
{
$row['class'] .= ' rowNoUndelete ';
}
if ($query['col_filter']['ts_project'] || !$query['filter2'])
if ($query['col_filter']['ts_project'])
{
unset($row['ts_project']); // dont need or want to show it
}
@ -762,14 +762,9 @@ class timesheet_ui extends timesheet_bo
}
}
}
if (!$query['filter2'])
{
unset($row['ts_description']);
}
else
{
$row['titleClass'] = 'timesheet_titleDetails';
}
if(!$row['titleClass']) $row['titleClass'] = 'timesheet_titleDetails';
}
if (!$have_cats || $query['cat_id']) $rows['no_cat_id'] = true;
if ($query['col_filter']['ts_owner']) $rows['ownerClass'] = 'noPrint';
@ -872,6 +867,7 @@ class timesheet_ui extends timesheet_bo
'header_left' => 'timesheet.index.dates',
'header_row' => 'timesheet.index.add',
'filter_onchange' => "app.timesheet.filter_change();",
'filter2_onchange' => "app.timesheet.filter2_change();",
'filter2' => (int)$GLOBALS['egw_info']['user']['preferences'][TIMESHEET_APP]['show_details'],
'row_id' => 'ts_id',
'row_modified' => 'ts_modified',

View File

@ -61,6 +61,7 @@ app.classes.timesheet = AppJS.extend(
if (typeof et2.templates['timesheet.index'] != "undefined")
{
this.filter_change();
this.filter2_change();
}
},
@ -77,4 +78,22 @@ app.classes.timesheet = AppJS.extend(
dates.set_disabled(filter.value !== "custom");
}
},
/**
* show or hide the details of rows by selecting the filter2 option
* either 'all' for details or 'no_description' for no details
*
*/
filter2_change: function()
{
var nm = this.et2.getWidgetById('nm');
var filter2 = this.et2.getWidgetById('filter2');
if (nm && filter2)
{
egw.css("#timesheet-index span.timesheet_titleDetails","font-weight:" + (filter2.getValue() == '1' ? "bold;" : "normal;"));
// Show / hide descriptions
egw.css(".et2_label.ts_description","display:" + (filter2.getValue() == '1' ? "block;" : "none;"));
}
},
});

View File

@ -70,8 +70,8 @@
<date-time id="${row}[ts_start]" readonly="true" options=",8"/>
<vbox options="0,0">
<link id="${row}[ts_link]" no_lang="1"/>
<description id="${row}[ts_title]" no_lang="1" class="$row_cont[titleClass]"/>
<description id="${row}[ts_description]" no_lang="1"/>
<description id="${row}[ts_title]" no_lang="1" class="ts_title $row_cont[titleClass]"/>
<description id="${row}[ts_description]" class="ts_description" no_lang="1"/>
</vbox>
<menulist class="noWrap">
<menupopup type="select-cat" id="${row}[cat_id]" readonly="true"/>