From 9a86898103de2cfc86e5c6d2a0892f81b96ee51d Mon Sep 17 00:00:00 2001 From: Stephan Smola Date: Thu, 15 Dec 2016 11:37:44 +0100 Subject: [PATCH 1/2] Don't let the kids open the doors before it's time! --- .idea/vcs.xml | 6 +++++ webapp/control/Day.js | 9 +++++++- webapp/view/App.view.xml | 50 ++++++++++++++++++++-------------------- 3 files changed, 39 insertions(+), 26 deletions(-) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/webapp/control/Day.js b/webapp/control/Day.js index 8106ac1..0eaefd5 100644 --- a/webapp/control/Day.js +++ b/webapp/control/Day.js @@ -2,6 +2,8 @@ sap.ui.define( ["sap/ui/core/Control"], function(Control) { "use strict"; + + var today = new Date().getDate(); return Control.extend("de.blogspot.openui5.adventcalendar.control.Day", /** @lends de.blogspot.openui5.adventcalendar.control.Day **/ { metadata: { @@ -10,6 +12,10 @@ sap.ui.define( type: "sap.ui.core.CSSColor", defaultValue: "auto" }, + day: { + type: "int", + defaultValue: "25" + }, inactive: { type: "boolean", defaultValue: "false" @@ -35,7 +41,8 @@ sap.ui.define( oRm.writeControlData(oControl); oRm.writeClasses(); oRm.writeStyles(); - if (oControl.getInactive() === true) { + + if (oControl.getInactive() === true || oControl.getProperty("day") > today) { oRm.writeAttribute("data-inactive", oControl.getInactive()); } oRm.writeAttribute("data-bg-color", oControl.getColor()); diff --git a/webapp/view/App.view.xml b/webapp/view/App.view.xml index fcd2be1..7027a55 100644 --- a/webapp/view/App.view.xml +++ b/webapp/view/App.view.xml @@ -11,78 +11,78 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + From e6f759776e3cec87c0ed4d18dcfeb378e0ec2bf9 Mon Sep 17 00:00:00 2001 From: Stephan Smola Date: Thu, 15 Dec 2016 13:38:23 +0100 Subject: [PATCH 2/2] Hide description for inactive boxes --- webapp/control/Day.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/control/Day.js b/webapp/control/Day.js index 0eaefd5..01c509d 100644 --- a/webapp/control/Day.js +++ b/webapp/control/Day.js @@ -46,7 +46,7 @@ sap.ui.define( oRm.writeAttribute("data-inactive", oControl.getInactive()); } oRm.writeAttribute("data-bg-color", oControl.getColor()); - oRm.writeAttribute("data-title", oControl.getTitle()); + oRm.writeAttribute("data-title", oControl.getProperty("day") > today ? "" : oControl.getTitle()); oRm.write(">"); oRm.write("
");