From 7aac59e2d61f1d442bd6b5af541f39f0035f9459 Mon Sep 17 00:00:00 2001 From: sdjuric Date: Thu, 5 Mar 2015 12:53:02 +0100 Subject: [PATCH 1/3] Extending timesheet to show all date gap and insert more events --- source/javascripts/timesheet.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/javascripts/timesheet.js b/source/javascripts/timesheet.js index d0914c9..9d0d7db 100644 --- a/source/javascripts/timesheet.js +++ b/source/javascripts/timesheet.js @@ -98,6 +98,19 @@ this.data.push({start: beg, end: end, label: lbl, type: cat}); } }; + + /* + extend tabel to inline all possible dates + */ + Timesheet.prototype.extend = function() { + var yearGap = this.year.max - this.year.min + 1; + var yearSection = this.container.childNodes[0].getElementsByTagName("section")[0].offsetWidth; + + this.container.style.height = "auto"; + this.container.style.overflow = "auto"; + this.container.childNodes[0].style.width = yearGap * yearSection; + this.container.childNodes[1].style.overflow = "visible"; + } /** * Timesheet Bubble From 14b92434ba375756ae6a54d75d2c5100eda7ad4f Mon Sep 17 00:00:00 2001 From: kilgaloon Date: Thu, 5 Mar 2015 12:55:22 +0100 Subject: [PATCH 2/3] Final setup to prototype extend --- source/javascripts/timesheet.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/javascripts/timesheet.js b/source/javascripts/timesheet.js index 9d0d7db..e9a0e5f 100644 --- a/source/javascripts/timesheet.js +++ b/source/javascripts/timesheet.js @@ -100,7 +100,9 @@ }; /* - extend tabel to inline all possible dates + extend tabel to inline all possible dates + and enable more events underneath each other + if there are more events in same dates */ Timesheet.prototype.extend = function() { var yearGap = this.year.max - this.year.min + 1; From bfa45d06dab292e259a7df8890eab7f4714e01dd Mon Sep 17 00:00:00 2001 From: kilgaloon Date: Thu, 5 Mar 2015 13:19:07 +0100 Subject: [PATCH 3/3] Optimizing extend method --- source/javascripts/timesheet.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/javascripts/timesheet.js b/source/javascripts/timesheet.js index e9a0e5f..e829780 100644 --- a/source/javascripts/timesheet.js +++ b/source/javascripts/timesheet.js @@ -107,11 +107,13 @@ Timesheet.prototype.extend = function() { var yearGap = this.year.max - this.year.min + 1; var yearSection = this.container.childNodes[0].getElementsByTagName("section")[0].offsetWidth; + var scaleCont = this.container.childNodes[0]; + var dataCont = this.container.childNodes[1]; this.container.style.height = "auto"; this.container.style.overflow = "auto"; - this.container.childNodes[0].style.width = yearGap * yearSection; - this.container.childNodes[1].style.overflow = "visible"; + scaleCont.style.width = yearGap * yearSection; + dataCont.style.overflow = "visible"; } /**