app/assets/javascripts/shoppe/application.coffee in shoppe-0.0.19 vs app/assets/javascripts/shoppe/application.coffee in shoppe-0.0.20

- old
+ new

@@ -46,18 +46,11 @@ # Printables $('a[rel=print]').on 'click', -> window.open($(this).attr('href'), 'despatchnote', 'width=700,height=800') false - - # Order editting - toggleDeliveryFieldsetForOrder = -> - fieldset = $('form.edit_order fieldset.delivery') - if $('form.edit_order input#order_separate_delivery_address').prop('checked') then fieldset.show() else fieldset.hide() - $('form.edit_order input#order_separate_delivery_address').on 'change', toggleDeliveryFieldsetForOrder - toggleDeliveryFieldsetForOrder() - + # Close dialog $('body').on 'click', 'a[rel=closeDialog]', Nifty.Dialog.closeTopDialog # Open AJAX dialogs $('a[rel=dialog]').on 'click', -> @@ -70,18 +63,21 @@ options.url = element.attr('href') Nifty.Dialog.open(options) false # Format money values to 2 decimal places - formatMoneyField = -> - value = $(this).val() - if value.length - $(this).val(parseFloat(value).toFixed(2)) $('div.moneyInput input').each formatMoneyField - $('div.moneyInput input').on('blur', formatMoneyField) + $('body').on('blur', 'div.moneyInput input', formatMoneyField) # +# Format money values to 2 decimal places +# +window.formatMoneyField = -> + value = $(this).val() + $(this).val(parseFloat(value).toFixed(2)) if value.length + +# # Stock Level Adjustment dialog beavior # Nifty.Dialog.addBehavior name: 'stockLevelAdjustments' onLoad: (dialog,options)-> @@ -117,6 +113,7 @@ # # Close dialogs on escape # Mousetrap.bind 'escape', -> Nifty.Dialog.closeTopDialog() - false + false + \ No newline at end of file