Skip to content

Commit

Permalink
made the current dropdown selection active
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmichels committed May 4, 2020
1 parent 1c720d5 commit 82b6139
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions electron/src/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ <h3 class="card-title text-center text-white">Configuration</h3>
Queue Accept Timing
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a onclick="setAccept(this)" class="dropdown-item">Wait for last second</a>
<a onclick="setAccept(this)" class="dropdown-item">Accept immediately</a>
<a id="wait-item" onclick="setAccept(this)" class="dropdown-item">Wait for last second</a>
<a id="asap-item" onclick="setAccept(this)" class="dropdown-item">Accept immediately</a>
</div>
</div>
<hr>
Expand Down
14 changes: 9 additions & 5 deletions electron/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ $(document).ready(function(){
});

setAccept = (event) => {
console.log($(event).html());
// console.log($(event).html());
let text = $(event).html();
if(text==='Wait for last second'){
accept_timing='wait';
$('#wait-item').addClass('active');
$('#asap-item').removeClass('active');
}
else if(text==='Accept immediately'){
accept_timing='asap';
$('#wait-item').removeClass('active');
$('#asap-item').addClass('active');
}
}

Expand All @@ -38,15 +42,15 @@ readConfig = () => {

if(id){
$('#pushed-id-field').val(id);
$('#pushed-id-field-label').addClass('active');
}
if(interval_time){
$('#interval-field').val(interval_time);
$('#interval-field-label').addClass('active');
}
if(accept_timing==='asap'){
$('#default-option').html('Queue Accept timing (Set to accept ASAP)');
$('#default-option').attr('value','asap');
$('#asap-item').addClass('active');
}
else if(accept_timing==='wait'){
$('$wait-item').addClass('active');
}
}

Expand Down

0 comments on commit 82b6139

Please sign in to comment.