tap/app/assets/javascripts/orders.js.coffee
2014-12-04 17:02:08 +01:00

15 lines
576 B
CoffeeScript

# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
ready = ->
$('.btn-inc').on 'click', ->
input = $(this).parent().parent().find('input').first()
input.val(parseInt(input.val()) + 1)
$('.btn-dec').on 'click', ->
input = $(this).parent().parent().find('input').first()
if input.val() != '0'
input.val(parseInt(input.val()) - 1)
$(document).ready(ready)
$(document).on('page:load', ready)