diff --git a/Arduino/CanGrow/include/Webserver/Common.h b/Arduino/CanGrow/include/Webserver/Common.h index 74935a2..05a3a72 100644 --- a/Arduino/CanGrow/include/Webserver/Common.h +++ b/Arduino/CanGrow/include/Webserver/Common.h @@ -30,6 +30,10 @@ #include "Common_HTML.h" +/* + * TestHeaderFooter - checks if the given var from the webserver processor + * is actual a template variable from header or footer. + */ bool TestHeaderFooter(const String& var) { #ifdef DEBUG Serial.print(":: [Webserver:Page:root:proc:hf] var: "); @@ -37,20 +41,40 @@ bool TestHeaderFooter(const String& var) { #endif if( - (var == "HEADER") || - (var == "FOOTER") || - (var == "CGVER") || - (var == "CGBUILD") || - (var == "GROWNAME") || - (var == "CANGROW_CSS") || - (var == "NEED_RESTART")) { + (var == "HEADER") || + (var == "FOOTER") || + (var == "CGVER") || + (var == "CGBUILD") || + (var == "GROWNAME") || + (var == "CANGROW_CSS") || + (var == "NEED_RESTART") || + (var == "ACTIVE_NAV_GROW") || + (var == "ACTIVE_NAV_SYSTEM") || + (var == "ACTIVE_NAV_WIFI") || + (var == "ACTIVE_NAV_HELP") || + (var == "PLACEHOLDER")) { return true; } else { return false; } } -String AddHeaderFooter(const String& var) { + +/* + * AddHeaderFooter - processor for header and footer template variables + * + * String& var: + * the string we receive from the processor is the actual + * variable name we replace here. + * byte activeNav: + * contains the number representing which page is active + * 1 - grow settings + * 2 - system settings + * 3 - wifi settings + * 4 - help page + */ +String AddHeaderFooter(const String& var, byte activeNav = 0) { + String activeNav_ClassName = "activeNav"; if(var == "HEADER") { return String(Header_HTML); } else if(var == "FOOTER") { @@ -63,12 +87,21 @@ String AddHeaderFooter(const String& var) { return String(config.grow.growName); } else if(var == "CANGROW_CSS") { return String(File_cangrow_CSS); + } else if((var == "ACTIVE_NAV_GROW") && (activeNav == 1)) { + return activeNav_ClassName; + } else if((var == "ACTIVE_NAV_SYSTEM") && (activeNav == 2)) { + return activeNav_ClassName; + } else if((var == "ACTIVE_NAV_WIFI") && (activeNav == 3)) { + return activeNav_ClassName; + } else if((var == "ACTIVE_NAV_HELP") && (activeNav == 4)) { + return activeNav_ClassName; } else if(var == "NEED_RESTART") { if(needRestart == true) { return String(Common_HTML_NEED_RESTART); } else { return String(); } + } else { return String(); } diff --git a/Arduino/CanGrow/include/Webserver/File_cangrow_CSS.h b/Arduino/CanGrow/include/Webserver/File_cangrow_CSS.h index fe75a7e..7355efe 100644 --- a/Arduino/CanGrow/include/Webserver/File_cangrow_CSS.h +++ b/Arduino/CanGrow/include/Webserver/File_cangrow_CSS.h @@ -137,7 +137,7 @@ a:active { } .subnav li { - /*background: #026b45;*/ + background: #262B27; list-style: none; border-radius: 3px; margin-bottom: 3px; @@ -163,7 +163,7 @@ a:active { padding: 5px 10px; } -.nav li a:hover, .subnav li a:hover, .activeMenu, .button:link:hover, .button:visited:hover, input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover { +.nav li a:hover, .subnav li a:hover, .activeNav, .button:link:hover, .button:visited:hover, input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover { background: #04AA6D; color: #fff; border-radius: 3px; @@ -174,11 +174,11 @@ a:active { color: #cae0d0; } -.activeMenu { +.activeNav { background: #444; } -.MenuTime { +.navTime { background: #292929; } diff --git a/Arduino/CanGrow/include/Webserver/Header.h b/Arduino/CanGrow/include/Webserver/Header.h index 3636124..8b39888 100644 --- a/Arduino/CanGrow/include/Webserver/Header.h +++ b/Arduino/CanGrow/include/Webserver/Header.h @@ -40,11 +40,11 @@ const char* Header_HTML PROGMEM = R"(