From 6e962b3e648f8a7c78a93e857ee45a5c3a008617 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Mon, 30 Nov 2009 19:47:36 +0100 Subject: [PATCH] Show 'No items' in empty agenda and task lists. --- kronolith/js/kronolith.js | 22 +++++++++++++++++++--- kronolith/templates/index/agenda.inc | 5 +++++ kronolith/templates/index/tasks.inc | 5 +++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index d8f657e84..1b41f2491 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -519,7 +519,8 @@ KronolithCore = { // Remove old rows. Maybe we should only rebuild the calendars if // necessary. tbody = $('kronolithViewAgendaBody').childElements().each(function(row) { - if (row.identify() != 'kronolithAgendaTemplate') { + if (row.identify() != 'kronolithAgendaTemplate' && + row.identify() != 'kronolithAgendaNoItems') { row.remove(); } }); @@ -1147,7 +1148,16 @@ KronolithCore = { this._insertEvent(event, date, view); }, this); - if (view == 'year') { + switch (view) { + case 'agenda': + if ($('kronolithViewAgendaBody').select('tr').length > 2) { + $('kronolithAgendaNoItems').hide(); + } else { + $('kronolithAgendaNoItems').show(); + } + break; + + case 'year': td = $('kronolithYear' + date); td.className = ''; if (title) { @@ -1719,6 +1729,12 @@ KronolithCore = { this._insertTask(task); }, this); }, this); + + if ($('kronolithViewTasksBody').select('tr').length > 3) { + $('kronolithTasksNoItems').hide(); + } else { + $('kronolithTasksNoItems').show(); + } }, /** @@ -1767,7 +1783,7 @@ KronolithCore = { { var rows = $('kronolithViewTasksBody').select('tr'); // The first row is the add task row, the second a template, ignoring. - for (var i = 2; i < rows.length; i++) { + for (var i = 3; i < rows.length; i++) { var rowTasklist = rows[i].retrieve('tasklist'); var rowTaskId = rows[i].retrieve('taskid'); var rowTask = this.tcache.inject(null, function(acc, list) { diff --git a/kronolith/templates/index/agenda.inc b/kronolith/templates/index/agenda.inc index 3ff126d31..82aee47c4 100644 --- a/kronolith/templates/index/agenda.inc +++ b/kronolith/templates/index/agenda.inc @@ -15,6 +15,11 @@ + + + + + diff --git a/kronolith/templates/index/tasks.inc b/kronolith/templates/index/tasks.inc index 40ccdbf1a..b78e77c82 100644 --- a/kronolith/templates/index/tasks.inc +++ b/kronolith/templates/index/tasks.inc @@ -21,6 +21,11 @@
+ + + + +
-- 2.11.0