From f82559b52528f2c9591c4777b4a39d888dbc37e0 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 4 Jun 2014 19:29:35 +0000 Subject: [PATCH] Fix details filter not doing anything unless you close the tab --- timesheet/inc/class.timesheet_ui.inc.php | 14 +++++--------- timesheet/js/app.js | 19 +++++++++++++++++++ timesheet/templates/default/index.xet | 4 ++-- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php index 27df2db4da..09bf710393 100644 --- a/timesheet/inc/class.timesheet_ui.inc.php +++ b/timesheet/inc/class.timesheet_ui.inc.php @@ -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', diff --git a/timesheet/js/app.js b/timesheet/js/app.js index fbe14690ce..5292738419 100644 --- a/timesheet/js/app.js +++ b/timesheet/js/app.js @@ -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;")); + } + }, }); diff --git a/timesheet/templates/default/index.xet b/timesheet/templates/default/index.xet index a62dcd0f37..daa0c9b6ea 100644 --- a/timesheet/templates/default/index.xet +++ b/timesheet/templates/default/index.xet @@ -70,8 +70,8 @@ - - + +