Supports the enable attribute for all AutoConnectElements

pull/69/head^2
Hieromon Ikasamo 6 years ago
parent 5dab5f65de
commit 27c4a0a1be
  1. 1
      README.md
  2. 54
      src/AutoConnectElementBasisImpl.h

@ -103,6 +103,7 @@ Full documentation is available on https://Hieromon.github.io/AutoConnect, some
- Supports **AutoConnectElement::as<T\>** function to easily coding for conversion from an AutoConnectElement to an actual type. - Supports **AutoConnectElement::as<T\>** function to easily coding for conversion from an AutoConnectElement to an actual type.
- Supports new element type **AutoConnectFile** and built-in file uploader. - Supports new element type **AutoConnectFile** and built-in file uploader.
- Supports a **format attribute** with the AutoConnectText element. - Supports a **format attribute** with the AutoConnectText element.
- Supports a **AutoConnectSelect::selected** attribute.
- Fixed blank page responds with Configure new. - Fixed blank page responds with Configure new.
- Changed menu labels placement in source files structure. - Changed menu labels placement in source files structure.

@ -181,21 +181,23 @@ void AutoConnectRadioBasis::empty(const size_t reserve) {
const String AutoConnectRadioBasis::toHTML(void) const { const String AutoConnectRadioBasis::toHTML(void) const {
String html = String(""); String html = String("");
if (label.length()) { if (enable) {
html = label; if (label.length()) {
if (order == AC_Vertical) html = label;
html += String(F("<br>")); if (order == AC_Vertical)
} html += String(F("<br>"));
uint8_t n = 0; }
for (const String value : _values) { uint8_t n = 0;
n++; for (const String value : _values) {
String id = name + "_" + String(n); n++;
html += String(F("<input type=\"radio\" name=\"")) + name + String(F("\" id=\"")) + id + String(F("\" value=\"")) + value + String("\""); String id = name + "_" + String(n);
if (n == checked) html += String(F("<input type=\"radio\" name=\"")) + name + String(F("\" id=\"")) + id + String(F("\" value=\"")) + value + String("\"");
html += String(F(" checked")); if (n == checked)
html += String(F("><label for=\"")) + id + String("\">") + value + String(F("</label>")); html += String(F(" checked"));
if (order == AC_Vertical) html += String(F("><label for=\"")) + id + String("\">") + value + String(F("</label>"));
html += String(F("<br>")); if (order == AC_Vertical)
html += String(F("<br>"));
}
} }
return html; return html;
} }
@ -245,17 +247,19 @@ void AutoConnectSelectBasis::select(const String& value) {
const String AutoConnectSelectBasis::toHTML(void) const { const String AutoConnectSelectBasis::toHTML(void) const {
String html = String(""); String html = String("");
if (label.length()) if (enable) {
html = String(F("<label for=\"")) + name + String("\">") + label + String(F("</label>")); if (label.length())
html += String(F("<select name=\"")) + name + String(F("\" id=\"")) + name + String("\">"); html = String(F("<label for=\"")) + name + String("\">") + label + String(F("</label>"));
uint8_t n = 1; html += String(F("<select name=\"")) + name + String(F("\" id=\"")) + name + String("\">");
for (const String option : _options) { uint8_t n = 1;
html += String(F("<option value=\"")) + option + "\""; for (const String option : _options) {
if (n++ == selected) html += String(F("<option value=\"")) + option + "\"";
html += String(F(" selected")); if (n++ == selected)
html += ">" + option + String(F("</option>")); html += String(F(" selected"));
html += ">" + option + String(F("</option>"));
}
html += String(F("</select>"));
} }
html += String(F("</select>"));
return html; return html;
} }

Loading…
Cancel
Save