Browse Source

made scheduler templates more beautiful, added checks to not add unsupported schedules

rfm69
wysiwyng 6 years ago
parent
commit
86d1817801
3 changed files with 46 additions and 52 deletions
  1. +6
    -2
      code/html/custom.css
  2. +17
    -1
      code/html/custom.js
  3. +23
    -49
      code/html/index.html

+ 6
- 2
code/html/custom.css View File

@ -154,8 +154,6 @@ div.state {
.button-update,
.button-update-password,
.button-add-network,
.button-add-switch-schedule,
.button-add-light-schedule,
.button-rfb-learn,
.button-upgrade-browse,
.button-ha-add,
@ -165,6 +163,12 @@ div.state {
background: rgb(0, 192, 0); /* green */
}
.button-add-switch-schedule,
.button-add-light-schedule {
background: rgb(0, 192, 0); /* green */
display: none;
}
.button-more-network,
.button-more-schedule,
.button-wifi-scan,


+ 17
- 1
code/html/custom.js View File

@ -619,14 +619,21 @@ function addSchedule(event) {
return null;
}
var tabindex = 200 + numSchedules * 10;
var template = $("#" + event.data.schType + "ScheduleTemplate").children();
var template = $("#scheduleTemplate").children();
var line = $(template).clone();
template = $("#" + event.data.schType + "ActionTemplate").children();
var actionLine = template.clone();
$(line).find("#schActionDiv").append(actionLine);
$(line).find("input").each(function() {
$(this).attr("tabindex", tabindex);
tabindex++;
});
$(line).find(".button-del-schedule").on("click", delSchedule);
$(line).find(".button-more-schedule").on("click", moreSchedule);
var ena = $(line).find(":checkbox");
ena.prop("checked", false).iphoneStyle("refresh");
line.appendTo("#schedules");
return line;
}
@ -1093,6 +1100,15 @@ function processData(data) {
return;
}
if ("colorVisible" === key) {
$(".button-add-light-schedule").show();
}
if ("relayVisible" === key) {
$(".button-add-switch-schedule").show();
}
// Enable options
var position = key.indexOf("Visible");
if (position > 0 && position === key.length - 7) {


+ 23
- 49
code/html/index.html View File

@ -1082,7 +1082,7 @@
</div>
<div id="switchScheduleTemplate" class="template">
<div id="scheduleTemplate" class="template">
<div class="pure-g">
@ -1102,64 +1102,38 @@
<input class="pure-u-23-24 pure-u-lg-23-24" name="schWDs" type="text" maxlength="15" tabindex="0" value="1,2,3,4,5,6,7" />
</div>
<div class="pure-u-3-5 pure-u-lg-1-2 hint center">&nbsp;1 for Monday, 2 for Tuesday...</div>
<label class="pure-u-1 pure-u-lg-1-4">Action</label>
<div class="pure-u-1 pure-u-lg-1-5">
<select class="pure-u-1 pure-u-lg-23-24" name="schAction">
<option value="0">Turn OFF</option>
<option value="1">Turn ON</option>
<option value="2">Toggle</option>
</select>
<div id="schActionDiv" class="pure-u-1">
</div>
<select class="pure-u-1 pure-u-lg-1-5 isrelay" name="schSwitch"></select>
<div class="pure-u-0 pure-u-lg-1-5"></div>
<label class="pure-u-1 pure-u-lg-1-4">Enabled</label>
<div class="pure-u-1 pure-u-lg-3-4"><input type="checkbox" name="schEnabled" /></div>
<div class="pure-u-0 pure-u-lg-1-4"></div>
<button class="pure-button button-del-schedule" type="button">Delete schedule</button>
<input type="hidden" name="schType" value="switch">
<button class="pure-button button-del-schedule" type="button">Delete schedule</button>
</div>
</div>
<div id="lightScheduleTemplate" class="template">
<div class="pure-g">
<label class="pure-u-1 pure-u-lg-1-4">When time is</label>
<div class="pure-u-1-4 pure-u-lg-1-5">
<input class="pure-u-2-3" name="schHour" type="number" min="0" step="1" max="23" value="0" />
<div class="pure-u-1-4 hint center">&nbsp;h</div>
</div>
<div class="pure-u-1-4 pure-u-lg-1-5">
<input class="pure-u-2-3" name="schMinute" type="number" min="0" step="1" max="59" value="0" />
<div class="pure-u-1-4 hint center">&nbsp;m</div>
</div>
<div class="pure-u-0 pure-u-lg-1-3"></div>
<label class="pure-u-1 pure-u-lg-1-4">And weekday is one of</label>
<div class="pure-u-2-5 pure-u-lg-1-5">
<input class="pure-u-23-24 pure-u-lg-23-24" name="schWDs" type="text" maxlength="15" tabindex="0" value="1,2,3,4,5,6,7" />
</div>
<div class="pure-u-3-5 pure-u-lg-1-2 hint center">&nbsp;1 for Monday, 2 for Tuesday...</div>
<label class="pure-u-1 pure-u-lg-1-4">Brightness</label>
<div class="pure-u-1 pure-u-lg-1-5">
<input class="pure-u-2-3" name="schAction" type="number" min="0" step="1" max="255" value="0" />
</div>
<select class="pure-u-1 pure-u-lg-1-5 islight" name="schSwitch"></select>
<div class="pure-u-0 pure-u-lg-1-5"></div>
<label class="pure-u-1 pure-u-lg-1-4">Enabled</label>
<div class="pure-u-1 pure-u-lg-3-4"><input type="checkbox" name="schEnabled" /></div>
<div class="pure-u-0 pure-u-lg-1-4"></div>
<button class="pure-button button-del-schedule" type="button">Delete schedule</button>
<input type="hidden" name="schType" value="light">
<div id="switchActionTemplate" class="template">
<label class="pure-u-1 pure-u-lg-1-4">Action</label>
<div class="pure-u-1 pure-u-lg-1-5">
<select class="pure-u-1 pure-u-lg-23-24" name="schAction">
<option value="0">Turn OFF</option>
<option value="1">Turn ON</option>
<option value="2">Toggle</option>
</select>
</div>
<select class="pure-u-1 pure-u-lg-1-5 isrelay" name="schSwitch"></select>
<input type="hidden" name="schType" value="switch">
</div>
<div id="lightActionTemplate" class="template">
<label class="pure-u-1 pure-u-lg-1-4">Brightness</label>
<div class="pure-u-1 pure-u-lg-1-5">
<input class="pure-u-2-3" name="schAction" type="number" min="0" step="1" max="255" value="0" />
</div>
<select class="pure-u-1 pure-u-lg-1-5 islight" name="schSwitch"></select>
<input type="hidden" name="schType" value="light">
</div>
<div id="relayTemplate" class="template">


Loading…
Cancel
Save