Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipes - Rebecca - Ada Trader #34

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clean up comments and console logs
rbergena committed Dec 17, 2017
commit 4345a2574088be732485bb74890f505eb644be77
9 changes: 1 addition & 8 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -17,9 +17,6 @@ import OpenOrder from './models/open_order';
import OpenOrderView from './views/open_order_view';
import OpenOrderListView from './views/open_order_list_view';




const quoteData = [
{
symbol: 'HUMOR',
@@ -39,7 +36,6 @@ const quoteData = [
},
];

// const quoteList = new QuoteList();
const openOrderList = new OpenOrderList();

let quoteTemplate;
@@ -48,7 +44,7 @@ let orderTemplate;

$(document).ready(function() {
let bus = {};
// need to import backbone

bus = _.extend(bus, Backbone.Events);
quoteTemplate = _.template($('#quote-template').html());
orderTemplate = _.template($('#order-template').html());
@@ -73,7 +69,6 @@ $(document).ready(function() {
const tradelistView = new TradeListView({
el: '#trades-container',
bus: bus,
// model: quotes,
template: tradeTemplate,
});

@@ -87,7 +82,5 @@ $(document).ready(function() {

quoteListView.render();

// wave 3
// any time the stock "changes" change event on model
simulator.start();
});
6 changes: 1 addition & 5 deletions src/views/quote_view.js
Original file line number Diff line number Diff line change
@@ -4,18 +4,15 @@ import Quote from '../models/quote';
const QuoteView = Backbone.View.extend({

initialize(params) {
// use #quote-template
this.template = params.template;
this.bus = params.bus;
// any time the stock "changes" change event on model
this.listenTo(this.model, 'change', this.render);
},
events: {
'click button.btn-buy': 'buyQuote',
'click button.btn-sell': 'sellQuote',
},
buyQuote() {
// this.bus.trigger('selected_task', this.model);

let tradeObject = {
price: this.model.get('price'),
@@ -37,9 +34,8 @@ const QuoteView = Backbone.View.extend({
},
render() {
let quote = this.model;
this.bus.trigger('quote_change', quote);
// trigger quote_change event which quotelist view will listen for
// this.bus.trigger('quote_change');
this.bus.trigger('quote_change', quote);
console.log(this.model);
const compiledTemplate = this.template(this.model.toJSON());
this.$el.html(compiledTemplate);