Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
Merge pull request #737 from blockchain/coinify-quick-start
Browse files Browse the repository at this point in the history
Coinify quick start
  • Loading branch information
Sjors authored Oct 27, 2016
2 parents 3981275 + 140bf25 commit c0bcd4f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/templates/buy-quick-start.jade
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
ul.uib-dropdown-menu.dropdown-menu.currency-dropdown(role="menu")
li(ng-repeat="currency in currencies"
role="menuitem"
ng-click="changeCurrency({currency: currency});"
ng-click="transaction.btc = null; changeCurrency({currency: currency}); getQuote();"
ng-class="{active: isCurrencySelected(currency)}")
a(ng-click="$event.preventDefault()") {{ currency.code }}
i.ti-arrows-horizontal.mhm.type-h4
Expand All @@ -41,7 +41,7 @@
name="btc"
step="any"
tabindex="1"
ng-change="transaction.fiat = null; getQuote(transaction.btc);"
ng-change="transaction.fiat = null; getQuote();"
ng-model-options="{debounce: 250}"
placeholder="{{placeholder}}")
div.input-group-btn
Expand Down
13 changes: 8 additions & 5 deletions assets/js/directives/buy-quick-start.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,17 @@ function buyQuickStart (currency, buySell, Alerts, $interval) {
startFetchingQuote();
scope.getExchangeRate();
scope.status.waiting = true;
scope.transaction.fiat && buySell.getQuote(scope.transaction.fiat, scope.transaction.currency.code).then(success, error);
scope.transaction.btc && buySell.getQuote(-scope.transaction.btc, 'BTC', scope.transaction.currency.code).then(success, error);
scope.transaction.btc
? buySell.getQuote(-scope.transaction.btc, 'BTC', scope.transaction.currency.code).then(success, error)
: buySell.getQuote(scope.transaction.fiat, scope.transaction.currency.code).then(success, error);
};

const success = (quote) => {
scope.transaction.fiat
? scope.transaction.btc = quote.quoteAmount / 100000000
: scope.transaction.fiat = -quote.quoteAmount / 100;
if (quote.baseCurrency === 'BTC') {
scope.transaction.fiat = -quote.quoteAmount / 100;
} else {
scope.transaction.btc = quote.quoteAmount / 100000000;
}
scope.quote = quote;
scope.status = {};
Alerts.clear();
Expand Down
3 changes: 2 additions & 1 deletion locales/en-human.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,5 +1112,6 @@
"SHOW": "Show",
"HIDE": "Hide",
"EDIT_NAME": "Edit Name",
"NOT_BACKED_BY_RECOVERY": "Not backed up by your Recovery Phrase. Transfer into a wallet to secure funds."
"NOT_BACKED_BY_RECOVERY": "Not backed up by your Recovery Phrase. Transfer into a wallet to secure funds.",
"EXCHANGE_RATE_HELPER": "The rate offered by your region's exchange partner. May include fees."
}

0 comments on commit c0bcd4f

Please sign in to comment.