Skip to content

Commit

Permalink
Merge pull request #121 from MakerDAO/112-switch-quote-base-currency
Browse files Browse the repository at this point in the history
Icon button enabling switching of quote and base currency
  • Loading branch information
jorisbontje committed May 20, 2016
2 parents 9c99b5c + 28b341a commit ea2d009
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions frontend/client/style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,9 @@ h1 img { margin-left: -1.2rem }
section { float: right; width: 48% }
section:first-of-type { float: left }
}

#spnSwitchCurrencies {
margin: 0px 10px;
vertical-align: middle;
cursor: pointer;
}
8 changes: 4 additions & 4 deletions frontend/client/templates/currencyselector.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<template name="currencySelector">
<p>
Quote Currency:
<select {{b "options: currencies, value: quoteCurrency, change: quoteChange"}}></select>
<select id="sltQuoteCurrency" {{b "options: currencies, value: quoteCurrency, change: quoteChange"}}></select>
<span class="text-danger" {{b "text: quoteHelper"}}></span>
</p>
<p>
<span id="spnSwitchCurrencies" class="glyphicon glyphicon-refresh" aria-hidden="true"></span>

Base Currency:
<select {{b "options: currencies, value: baseCurrency, change: baseChange"}}></select>
<select id="sltBaseCurrency" {{b "options: currencies, value: baseCurrency, change: baseChange"}}></select>
<span class="text-danger" {{b "text: baseHelper"}}></span>
</p>
</template>
9 changes: 9 additions & 0 deletions frontend/client/templates/currencyselector.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,12 @@ Template.currencySelector.viewmodel({
})
}
})

Template.currencySelector.events({
'click #spnSwitchCurrencies': function () {
var quoteCurrency = Session.get('quoteCurrency')
var baseCurrency = Session.get('baseCurrency')
Session.set('quoteCurrency', baseCurrency)
Session.set('baseCurrency', quoteCurrency)
}
})

0 comments on commit ea2d009

Please sign in to comment.