forked from platypush/platypush
Added auto pilot and stop controls to ZeroBorg web UI
This commit is contained in:
parent
cb44f864cc
commit
75e958bb38
3 changed files with 47 additions and 2 deletions
|
@ -3,7 +3,18 @@
|
|||
width: 25%;
|
||||
}
|
||||
|
||||
.zb-ctrl-btn.selected {
|
||||
color: #78ff00 !important;
|
||||
.zb-ctrl-btn {
|
||||
white-space: normal;
|
||||
height: 6rem;
|
||||
}
|
||||
|
||||
.zb-ctrl-btn.selected {
|
||||
color: #78ff00 !important;
|
||||
}
|
||||
|
||||
.ctrl-bottom-row {
|
||||
margin-top: 20px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,29 @@ $(document).ready(function() {
|
|||
action: 'gpio.zeroborg.stop',
|
||||
});
|
||||
});
|
||||
|
||||
$controlsContainer.on('click touch', '.zb-ctrl-btn[data-action]', function() {
|
||||
console.log('Running ' + $(this).data('action') + ' action');
|
||||
|
||||
if ($(this).data('action') === 'stop') {
|
||||
$controlsContainer.find('.zb-ctrl-btn[data-action=auto]').removeClass('selected');
|
||||
|
||||
execute({
|
||||
type: 'request',
|
||||
action: 'gpio.zeroborg.stop',
|
||||
});
|
||||
} else if ($(this).data('action') === 'auto') {
|
||||
$(this).toggleClass('selected');
|
||||
|
||||
execute({
|
||||
type: 'request',
|
||||
action: 'gpio.zeroborg.drive',
|
||||
args: {
|
||||
direction: 'auto_toggle'
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var init = function() {
|
||||
|
|
|
@ -28,6 +28,17 @@
|
|||
</button>
|
||||
<div class="four columns"> </div>
|
||||
</div>
|
||||
|
||||
<div class="row ctrl-bottom-row">
|
||||
<div class="two columns"> </div>
|
||||
<button data-action="auto" class="zb-ctrl-btn four columns">
|
||||
AUTO PILOT
|
||||
</button>
|
||||
<button data-action="stop" class="zb-ctrl-btn four columns">
|
||||
<i class="fa fa-stop"></i>
|
||||
</button>
|
||||
<div class="two columns"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue