diff options
| author | Adam Soltys <[email protected]> | 2016-09-09 23:11:48 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2016-09-09 23:11:48 -0700 |
| commit | 26bf18266266d8a3957875d0b08ecd457d535410 (patch) | |
| tree | 77f3639903b918bfeb4549060745ad9614929cfc | |
| parent | 15323547a93a5c8fdfcbf0154c213985f3d8c3af (diff) | |
| download | coinos-server-26bf18266266d8a3957875d0b08ecd457d535410.tar.gz coinos-server-26bf18266266d8a3957875d0b08ecd457d535410.zip | |
Fix bug with currency/symbol settings not being selected properly
| -rw-r--r-- | public/js/setup.coffee | 12 | ||||
| -rw-r--r-- | public/js/setup.js | 15 |
2 files changed, 15 insertions, 12 deletions
diff --git a/public/js/setup.coffee b/public/js/setup.coffee index 744de8a0..d796c897 100644 --- a/public/js/setup.coffee +++ b/public/js/setup.coffee @@ -15,16 +15,17 @@ $(-> $("#currency option[value='CAD']").attr('selected', 'selected') $('#currency').change(-> + currency = $(this).val() + return unless currency + $('#symbol option').remove() - symbol = $(this).val() - return unless symbol - symbols = Object.keys(data[symbol]) + symbols = Object.keys(data[currency]) $.each(symbols, (i, v) -> return if v == 'localbitcoins' $('#symbol').append("<option value='#{v}'>#{v}</option>") ) - switch $(this).val() + switch currency when 'CAD' $("#symbol option[value='quadrigacx']").attr('selected', 'selected') when 'USD' @@ -39,10 +40,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() $('#title').focus() ) 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("<option value='" + v + "'>" + v + "</option>"); }); - 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(); }); |
