From 26bf18266266d8a3957875d0b08ecd457d535410 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 9 Sep 2016 23:11:48 -0700 Subject: Fix bug with currency/symbol settings not being selected properly --- public/js/setup.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'public/js/setup.js') diff --git a/public/js/setup.js b/public/js/setup.js index ea3808ea..e96bd00d 100644 --- a/public/js/setup.js +++ b/public/js/setup.js @@ -21,20 +21,20 @@ }); $("#currency option[value='CAD']").attr('selected', 'selected'); $('#currency').change(function() { - var symbol, symbols; - $('#symbol option').remove(); - symbol = $(this).val(); - if (!symbol) { + var currency, symbols; + currency = $(this).val(); + if (!currency) { return; } - symbols = Object.keys(data[symbol]); + $('#symbol option').remove(); + symbols = Object.keys(data[currency]); $.each(symbols, function(i, v) { if (v === 'localbitcoins') { return; } return $('#symbol').append(""); }); - switch ($(this).val()) { + switch (currency) { case 'CAD': return $("#symbol option[value='quadrigacx']").attr('selected', 'selected'); case 'USD': @@ -53,10 +53,11 @@ $('#title').val(data.title); $('#logo').val(data.logo); $('#address').val(data.address); - $("#symbol option[value='" + data.symbol + "']").attr('selected', 'selected'); $('#commission').val(data.commission); $('#unit').val(data.unit); + $("#currency option[value='" + data.currency + "']").attr('selected', 'selected'); $('#currency').change(); + $("#symbol option[value='" + data.symbol + "']").attr('selected', 'selected'); $('#setup').fadeIn(); return $('#title').focus(); }); -- cgit v1.2.3