From 58de1a231b67fb37706061f5d5afbf150ac1f5c5 Mon Sep 17 00:00:00 2001 From: wvengen Date: Tue, 10 Dec 2013 13:30:15 +0100 Subject: [PATCH] update price during editing as well --- app/views/articles/_form.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/articles/_form.html.haml b/app/views/articles/_form.html.haml index 2ffd3f0a..a5c04bc8 100644 --- a/app/views/articles/_form.html.haml +++ b/app/views/articles/_form.html.haml @@ -46,12 +46,12 @@ :javascript var form = $('form.edit_article, form.new_article'); - $('#article_price, #article_tax, #article_deposit', form).on('change', function() { + $('#article_price, #article_tax, #article_deposit', form).on('change keyup', function() { var price = parseFloat($('#article_price', form).val()); var tax = parseFloat($('#article_tax', form).val()); var deposit = parseFloat($('#article_deposit', form).val()); // Article#gross_price and Article#fc_price var gross_price = (price + deposit) * (tax / 100 + 1); var fc_price = gross_price * (#{FoodsoftConfig[:price_markup].to_f} / 100 + 1); - $('#fc_price').html(I18n.l("currency", fc_price)); + $('#fc_price').html($.isNumeric(fc_price) ? I18n.l("currency", fc_price) : '…'); });