mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-04 02:48:13 +10:00
Portal home: single Status card; rename params placement API
- Merge initial status and guidance into one wm-card (Status) on Home. - Add .wm-home-summary styling for the primary status line. - Replace legacy setParamsPage with setParametersEmbeddedInWifi (matches _paramsInWifi / SPA Setup vs WiFi placement); remove setParamsPage. - Update README, handlers comment, and advanced-options tests.
This commit is contained in:
@@ -32,7 +32,7 @@ This fork currently includes the following architectural improvements:
|
||||
- **Capability-driven UI flags** in bootstrap/API payloads so features like info, update, erase, and action visibility can be controlled by backend state.
|
||||
- **SPA-native feedback UX** using in-DOM dialog/toast behavior rather than page-based action flows.
|
||||
- **Request-scoped shell rendering**: the root portal page is built for each `GET /` from `WM_ROOT_SHELL_TEMPLATE` using a fresh placeholder registry. Shell inputs are only `%PAGE_TITLE%`, `%STYLES%`, `%BOOTSTRAP_JSON%`, and `%PORTAL_APP_JS%` — filled in `WiFiManagerHandlers` from WiFiManager state and embedded assets (not from a server-wide template registry).
|
||||
- **Customization via WiFiManager APIs** (`setTitle`, `setShowInfo`, `setParamsPage`, bootstrap-facing flags, etc.), not by exposing placeholder-registry mutation to consumers.
|
||||
- **Customization via WiFiManager APIs** (`setTitle`, `setShowInfo`, `setParametersEmbeddedInWifi`, bootstrap-facing flags, etc.), not by exposing placeholder-registry mutation to consumers.
|
||||
- A clearer separation between:
|
||||
- shell rendering (handlers + SPA bootstrap)
|
||||
- JSON API responses
|
||||
|
||||
@@ -470,8 +470,15 @@ class WiFiManager
|
||||
// set the webapp title, default WiFiManager
|
||||
void setTitle(String title);
|
||||
|
||||
// add params to its own menu page and remove from wifi, NOT TO BE COMBINED WITH setMenu!
|
||||
void setParamsPage(bool enable);
|
||||
/**
|
||||
* Where custom parameters (`WiFiManagerParameter`) appear in the portal SPA (one placement only).
|
||||
*
|
||||
* - true (default): parameters render on the WiFi route (`#/wifi`) together with SSID/password.
|
||||
* - false: parameters render only on the Setup route (`#/setup`); they are not duplicated on WiFi.
|
||||
*
|
||||
* Bootstrap exposes the same flag as `features.paramsInWifi`.
|
||||
*/
|
||||
void setParametersEmbeddedInWifi(boolean embedded);
|
||||
|
||||
// get last connection result, including autoconnect and portal credential-save attempts
|
||||
uint8_t getLastConxResult();
|
||||
@@ -707,7 +714,7 @@ class WiFiManager
|
||||
boolean _apClientCheck = false; // keep cp alive if ap have station
|
||||
boolean _webClientCheck = true; // keep cp alive if web have client
|
||||
boolean _scanDispOptions = false; // show percentage in scans not icons
|
||||
boolean _paramsInWifi = true; // show custom parameters on wifi page
|
||||
boolean _paramsInWifi = true; // if false, custom params only on #/setup (see setParametersEmbeddedInWifi)
|
||||
boolean _showInfo = true; // show Info in portal SPA
|
||||
boolean _showInfoErase = true; // info page erase button
|
||||
boolean _showInfoUpdate = true; // info page update button
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#endif
|
||||
|
||||
// Portal UI customization is driven by WiFiManager state and helpers such as setTitle(), setShowInfo(),
|
||||
// setParamsPage(), setShowInfoUpdate(), etc., surfaced through bootstrap/API JSON — not by mutating template
|
||||
// setParametersEmbeddedInWifi(), setShowInfoUpdate(), etc., surfaced through bootstrap/API JSON — not by mutating template
|
||||
// placeholder registries.
|
||||
|
||||
// -----------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -79,6 +79,7 @@ const char CSS_STYLE[] PROGMEM = "<style>"
|
||||
".wm-card-title{font-size:1rem;margin:0 0 12px;padding-bottom:10px;border-bottom:1px solid var(--wm-border);"
|
||||
"color:var(--wm-text)}"
|
||||
".wm-lead{margin:0 0 8px;font-size:.95rem;color:var(--wm-muted);line-height:1.5}"
|
||||
".wm-home-summary{margin:0 0 14px;font-size:1rem;font-weight:600;line-height:1.45;color:var(--wm-text)}"
|
||||
/* Callout / status */
|
||||
".wm-callout{padding:12px 14px;border-radius:var(--wm-radius-sm);border:1px solid var(--wm-border);"
|
||||
"background:rgba(14,165,233,.06);margin-bottom:16px}"
|
||||
|
||||
@@ -140,12 +140,12 @@ function viewHome(){
|
||||
html+="<header class='wm-hero'><h1 class='wm-hero-title'>"+t+"</h1>";
|
||||
if(sub)html+="<p class='wm-hero-sub'>"+sub+"</p>";
|
||||
html+="</header>";
|
||||
html+="<div class='wm-card'><h2 class='wm-card-title'>Status</h2>";
|
||||
if(boot.initialStatus){
|
||||
html+="<div class='wm-callout wm-callout--info'><p class='wm-status'>"+esc(boot.initialStatus)+"</p></div>";
|
||||
html+="<p class='wm-home-summary'>"+esc(boot.initialStatus)+"</p>";
|
||||
}
|
||||
html+="<div class='wm-card'><h2 class='wm-card-title'>Get started</h2>";
|
||||
html+="<p class='wm-lead'>Use <strong>WiFi</strong> to scan networks and connect. Open <strong>Info</strong> for addresses and firmware actions";
|
||||
html+=".</p></div>";
|
||||
html+="<p class='wm-lead'>Use <strong>WiFi</strong> to scan networks and connect. Open <strong>Info</strong> for addresses and firmware actions.</p>";
|
||||
html+="</div>";
|
||||
html+=deviceActionsHtml();
|
||||
setView(html);
|
||||
}
|
||||
|
||||
@@ -2182,13 +2182,8 @@ void WiFiManager::setTitle(String title){
|
||||
_title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set params as separate page not in wifi
|
||||
* NOT COMPATIBLE WITH setMenu!
|
||||
* @param enable If true, params appear on separate page
|
||||
*/
|
||||
void WiFiManager::setParamsPage(bool enable){
|
||||
_paramsInWifi = !enable;
|
||||
void WiFiManager::setParametersEmbeddedInWifi(boolean embedded) {
|
||||
_paramsInWifi = embedded;
|
||||
}
|
||||
|
||||
// GETTERS
|
||||
|
||||
@@ -50,8 +50,8 @@ void test_ui_display_options() {
|
||||
wm.setShowInfoErase(false);
|
||||
wm.setShowInfoUpdate(true);
|
||||
wm.setShowInfoUpdate(false);
|
||||
wm.setParamsPage(true);
|
||||
wm.setParamsPage(false);
|
||||
wm.setParametersEmbeddedInWifi(true);
|
||||
wm.setParametersEmbeddedInWifi(false);
|
||||
|
||||
// All setters executed without crash
|
||||
TEST_ASSERT_TRUE_MESSAGE(true, "UI display options executed without crash");
|
||||
|
||||
Reference in New Issue
Block a user