refactoring

This commit is contained in:
Maxim Devaev 2023-10-26 08:41:27 +03:00
parent 7bb5531100
commit e2ac3412db
3 changed files with 30 additions and 35 deletions

View File

@ -369,22 +369,22 @@
</td> </td>
</tr> </tr>
<tr class="feature-disabled" id="v3-usb-breaker"> <tr class="feature-disabled" id="v3-usb-breaker">
<td>Connect main USB to Server:</td> <td>Connect main USB to Server:</td>
<td align="right"> <td align="right">
<div class="switch-box"> <div class="switch-box">
<input class="gpio-switch" disabled type="checkbox" id="gpio-switch-__v3_usb_breaker__" data-channel="__v3_usb_breaker__" data-confirm-off="Turning off this switch will disconnect the main USB&lt;br&gt;from the server. Are you sure you want to continue?"> <input class="gpio-switch" disabled type="checkbox" id="gpio-switch-__v3_usb_breaker__" data-channel="__v3_usb_breaker__" data-confirm-off="Turning off this switch will disconnect the main USB&lt;br&gt;from the server. Are you sure you want to continue?">
<label for="gpio-switch-__v3_usb_breaker__"><span class="switch-inner"></span><span class="switch"></span></label> <label for="gpio-switch-__v3_usb_breaker__"><span class="switch-inner"></span><span class="switch"></span></label>
</div> </div>
</td> </td>
</tr> </tr>
<tr class="feature-disabled" id="v4-locator"> <tr class="feature-disabled" id="v4-locator">
<td>Enable locator LED:</td> <td>Enable locator LED:</td>
<td align="right"> <td align="right">
<div class="switch-box"> <div class="switch-box">
<input class="gpio-switch" disabled type="checkbox" id="gpio-switch-__v4_locator__" data-channel="__v4_locator__"> <input class="gpio-switch" disabled type="checkbox" id="gpio-switch-__v4_locator__" data-channel="__v4_locator__" data-confirm-off="">
<label for="gpio-switch-__v4_locator__"><span class="switch-inner"></span><span class="switch"></span></label> <label for="gpio-switch-__v4_locator__"><span class="switch-inner"></span><span class="switch"></span></label>
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Ask page close confirmation:</td> <td>Ask page close confirmation:</td>

View File

@ -108,25 +108,10 @@ li(id="system-dropdown" class="right")
tr tr
+menu_switch_notable("hid-mute-switch", "Mute HID input events", true, false) +menu_switch_notable("hid-mute-switch", "Mute HID input events", true, false)
tr(id="v3-usb-breaker" class="feature-disabled") tr(id="v3-usb-breaker" class="feature-disabled")
td Connect main USB to Server: +menu_switch_notable_gpio("__v3_usb_breaker__", "Connect main USB to Server",
td(align="right") "Turning off this switch will disconnect the main USB<br>from the server. Are you sure you want to continue?")
div(class="switch-box")
-let msg = "Turning off this switch will disconnect the main USB<br>from the server."
-msg += " Are you sure you want to continue?"
input(disabled type="checkbox" id="gpio-switch-__v3_usb_breaker__" class="gpio-switch"
data-channel="__v3_usb_breaker__" data-confirm-off=msg)
label(for="gpio-switch-__v3_usb_breaker__")
span(class="switch-inner")
span(class="switch")
tr(id="v4-locator" class="feature-disabled") tr(id="v4-locator" class="feature-disabled")
td Enable locator LED: +menu_switch_notable_gpio("__v4_locator__", "Enable locator LED")
td(align="right")
div(class="switch-box")
input(disabled type="checkbox" id="gpio-switch-__v4_locator__" class="gpio-switch"
data-channel="__v4_locator__")
label(for="gpio-switch-__v4_locator__")
span(class="switch-inner")
span(class="switch")
tr tr
+menu_switch_notable("page-close-ask-switch", "Ask page close confirmation", true, true) +menu_switch_notable("page-close-ask-switch", "Ask page close confirmation", true, true)
hr hr

View File

@ -13,9 +13,19 @@ mixin menu_message(icon, short, classes="")
sup(style="line-height:1") sup(style="line-height:1")
block block
mixin menu_switch_notable(id, title, enabled, checked, classes="") mixin menu_switch_notable_gpio(channel, title, confirm_off="")
td(class=`${classes}`) #{title}: td #{title}:
td(class=`${classes}` align="right") td(align="right")
div(class="switch-box")
input(disabled type="checkbox" id=`gpio-switch-${channel}` class="gpio-switch"
data-channel=channel data-confirm-off=confirm_off)
label(for=`gpio-switch-${channel}`)
span(class="switch-inner")
span(class="switch")
mixin menu_switch_notable(id, title, enabled, checked)
td #{title}:
td(align="right")
div(class="switch-box") div(class="switch-box")
input(checked=checked disabled=!enabled type="checkbox" id=id) input(checked=checked disabled=!enabled type="checkbox" id=id)
label(for=id) label(for=id)