1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-10 16:19:54 +00:00

Feat: validation feedback for queue save

This commit is contained in:
jcorporation 2018-07-22 20:16:31 +01:00
parent 020c266788
commit 24eb8d8ef7
2 changed files with 17 additions and 8 deletions

View File

@ -717,17 +717,18 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="savequeueLabel"><span class="material-icons title-icon">save</span> Save Queue</h5>
<h5 class="modal-title"><span class="material-icons title-icon">save</span> Save Queue</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form>
<form class="needs-validation" id="saveQueueFrm" novalidate>
<div class="row">
<div class="form-group col-md-9">
<label class="control-label" for="playlistname">Playlist Name</label>
<input type="text" class="form-control" id="playlistname"/>
<label class="control-label" for="saveQueueName">Playlist Name</label>
<input type="text" class="form-control" id="saveQueueName"/>
<div class="invalid-feedback">Invalid filename</div>
</div>
</div>
</form>

View File

@ -1550,11 +1550,19 @@ function addStream() {
}
function saveQueue() {
var plName = document.getElementById('playlistname');
if (plName.value != '')
var plName = document.getElementById('saveQueueName');
var valid = plName.value.replace(/\w/g,'');
if (plName.value != '' && valid == '') {
sendAPI({"cmd":"MPD_API_SAVE_QUEUE", "data": {"plist": plName.value}});
plName.value = '';
modalSavequeue.hide();
modalSavequeue.hide();
plName.value = '';
document.getElementById('saveQueueFrm').classList.remove('was-validated');
document.getElementById('saveQueueName').classList.remove('is-invalid');
}
else {
document.getElementById('saveQueueName').classList.add('is-invalid');
document.getElementById('saveQueueFrm').classList.add('was-validated');
}
}
function showNotification(notificationTitle,notificationText,notificationHtml,notificationType) {