Skip to content
This repository was archived by the owner on Jun 25, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions js/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,27 @@ WebsocketConn.prototype.init_click_events = function(){
var drop_data = pending_drop;

var delay = $(this).parent().parent().find('input[type="number"]').val();

self.drop(drop_data.slot_num, drop_data.machine_alias, delay);
if(~~delay >= 0){
self.drop(drop_data.slot_num, drop_data.machine_alias, delay);
}
else{
$(this).closest('#drop_modal').find('.form-feedback').html("That's in the past now, you retard.");
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably kick back an error notification to the user.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but I'm not sure how to go about doing that. Is there something obvious I can do? Otherwise I'll just keep looking into it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just do alert("You are a retard");.

});

// Hitting 'enter' on the delay field
$('#drop_delay_form').on('submit', function () {
var drop_data = pending_drop;

var delay = $(this).parent().parent().find('input[type="number"]').val();

self.drop(drop_data.slot_num, drop_data.machine_alias, delay);
});

if(~~delay >= 0){
self.drop(drop_data.slot_num, drop_data.machine_alias, delay);
}
else{
$(this).closest('#drop_modal').find('.form-feedback').html("That's in the past now, you retard.");
}
});

$('#drop_modal input:button[btn-action="cancel_drop"]').on('click', function(){
$('#drop_modal').modal('hide');
Expand Down
2 changes: 2 additions & 0 deletions lib/views/webdrink.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@
</form>
</div>
<div class="modal-footer">
<div class="form-feedback">
</div>
<input type="button" class="btn btn-danger" btn-action="cancel_drop" value="Cancel">
<input type="button" class="btn btn-success" btn-action="submit_drop_delay" value="Drop">
</div>
Expand Down