Skip to content

Commit

Permalink
Select elements by class instead of id.
Browse files Browse the repository at this point in the history
  • Loading branch information
yskhoo committed Mar 12, 2014
1 parent 6cd28ad commit 7973609
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
5 changes: 2 additions & 3 deletions controllers/coinbase_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@ var getCoinbaseAccessToken = function (user) {

exports.getExchangeRates = function(params, cb) {
request.get({ url: BASE_URI + "/currencies/exchange_rates" }, function (error, response, rates) {
>>>>>>> a50f8f7059c6d347c99ffd27e33ac035d59b66d4
cb(error, rates);
});
};

// @Todo: Figure this out.
// TODO: Figure this out.
exports.sendMoney = function(params, cb) {
var accessToken = getCoinbaseAccessToken(params.user);
if (!accessToken) {
cb(new Error('No Coinbase access token provided.'));
}
};

// @Todo: Figure this out.
// TODO: Figure this out.
exports.getBalance = function(params, cb) {
var accessToken = getCoinbaseAccessToken(params.user);
if (!accessToken) {
Expand Down
1 change: 1 addition & 0 deletions controllers/new_transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ exports.getNewTransaction = function(req, res, next) {
}

res.render('new_transaction', {
controllerJs: 'new_transaction',
title: 'New Transaction',
balance_amount: balance_amount,
balance_currency: balance_currency,
Expand Down
2 changes: 1 addition & 1 deletion public/css/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ body {
// New Transaction
// -------------------------

#amount {
.form-control.amount {
margin-top: 15px;
}

Expand Down
11 changes: 6 additions & 5 deletions public/js/new_transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cf.apps.new_transaction = function() {
};

cf.apps.new_transaction.prototype.initializeForm = function() {
var $transactionRecipient = $('#transactionRecipient');
var $transactionRecipient = $('.transactionRecipient');
if ($transactionRecipient.length) {
var names = new Bloodhound({
datumTokenizer: function(d) {
Expand All @@ -31,14 +31,15 @@ cf.apps.new_transaction.prototype.initializeForm = function() {

$(".currency-btns label").on('click', function(event) {
var $target = $(event.target);
var $amount = $('#amount');
var $currencyLabel = $('#currencyLabel');
var $amount = $('.amount');
var $currencyLabel = $('.currencyLabel');

// TODO: Check if valid currency format
if ($target.is("#optionBTC:not(.active)")) {
// TODO: If you click fast enough, the conversion will be incorrect
if ($target.is(".optionBTC:not(.active)")) {
$currencyLabel.html('<i class="fa fa-btc"></i>');
$amount.val(usdToBtc($amount.val()));
} else if ($target.is("#optionUSD:not(.active)")) {
} else if ($target.is(".optionUSD:not(.active)")) {
$currencyLabel.html('<i class="fa fa-usd"></i>');
$amount.val(btcToUsd($amount.val()));
}
Expand Down
10 changes: 5 additions & 5 deletions views/new_transaction.jade
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ block content
i.fa.fa-user
.col-xs-8
.example-numbers
input#transactionRecipient.form-control(class='typeahead', type='text', autofocus=true, autocomplete='off', spellcheck='false', dir='auto')
input.form-control.transactionRecipient(class='typeahead', type='text', autofocus=true, autocomplete='off', spellcheck='false', dir='auto')
.form-group
label#currencyLabel(class='col-xs-2 control-label', for='amount')
label.currencyLabel(class='col-xs-2 control-label', for='amount')
i.fa.fa-btc
.col-xs-8
.btn-group.btn-group-justified.currency-btns(data-toggle='buttons')
label.btn.btn-primary.active#optionBTC
label.btn.btn-primary.optionBTC.active
input(type='radio')
i.fa.fa-btc
label.btn.btn-primary#optionUSD
label.btn.btn-primary.optionUSD
input(type='radio')
i.fa.fa-usd
input.form-control(type='text', name='amount', id='amount')
input.form-control.amount(type='text', name='amount')
.form-group
label(class='col-xs-2 control-label', for='message')
i.fa.fa-comment
Expand Down

0 comments on commit 7973609

Please sign in to comment.