Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
28 changes: 12 additions & 16 deletions src/javascript/binary/pages/bet/bet_price.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ var BetPrice = function() {
e.preventDefault();
}
var target = $(e.target);
var button = target.parents('a[class^="spread"]');
that.spread.disable(button);
that.hide_buy_buttons();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just want to verify that whether this is called on click of purchase button or before sending request?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is called on click of purchase since the ajax request is in the buy_bet function.

var form = $(e.target).parents('form');
that.buy_bet(form);
return false;
Expand All @@ -111,6 +110,9 @@ var BetPrice = function() {
timeout : timeout,
success : function (resp, resp_status, jqXHR) { that.on_buy_bet_success(form, resp, resp_status, jqXHR); },
error : function (jqXHR, resp_status, exp) { that.on_buy_bet_error(form, jqXHR, resp_status, exp); },
complete: function () {
that.order_form.show_buy_button();
}
}));
$('.price_box').fadeTo(200, 0.6);
},
Expand Down Expand Up @@ -140,7 +142,6 @@ var BetPrice = function() {
}
$('.price_box').fadeTo(0, 1);
BetPrice.order_form.enable_buy_buttons();
this.display_buy_buttons();
},
on_buy_bet_error: function (form, jqXHR, resp_status, exp) {
var details = '' + exp;
Expand All @@ -155,7 +156,6 @@ var BetPrice = function() {
this.display_buy_error('<div style="width: ' + width + 'px;"><h3>Error</h3><p>' + details + ' </p></div>', 1);
$('.price_box').fadeTo(0, 1);
BetPrice.order_form.enable_buy_buttons();
this.display_buy_buttons();
},
buy_response_container: function () {
if (!_buy_response_container) {
Expand Down Expand Up @@ -207,10 +207,6 @@ var BetPrice = function() {

return new_value;
},
disable: function(target) {
var that = this;
target.unbind('click');
},
on_sell: function(form) {
var that = this;
$('button.close_position').on('click', function (e) {
Expand Down Expand Up @@ -274,7 +270,7 @@ var BetPrice = function() {
}
},
paint_it: function(value, target) {
var color = value > 0 ? 'profit' : 'loss';
var color = parseInt(value) > 0 ? 'profit' : 'loss';
$(target).removeClass().addClass(color);
},
stream: function(channel) {
Expand Down Expand Up @@ -511,10 +507,6 @@ var BetPrice = function() {
this.deregister();
this.order_form.hide_buy_button();
},
display_buy_buttons: function() {
this.on_buy();
this.order_form.show_buy_button();
},
show_loading: function() {
var image_link = page.settings.get('image_link');
var loading_html = '<p id="loading-price">'+text.localize('loading...')+'<br /><img src="'+image_link['hourglass']+'" /></p>';
Expand Down Expand Up @@ -582,16 +574,20 @@ var BetPrice = function() {
return (display_id && display_id.val() == id);
},
hide_buy_button: function() {
return $('button[name^="btn_buybet"]').parent().hide();
$('button[name^="btn_buybet"]').parent().hide();
$('a[class^="spread_"]').hide();
},
show_buy_button: function() {
return $('button[name^="btn_buybet"]').parent().show();
$('button[name^="btn_buybet"]').parent().show();
$('a[class^="spread_"]').show();
},
disable_buy_buttons: function() {
$('button[name^="btn_buybet"]').attr('disabled','disabled');
// unbind click event for spread since it is not a button
$('a[class^="spread_"]').unbind('click');
},
enable_buy_buttons: function() {
$('a[id^="spread"]').removeAttr('disabled');
// nothing to enable for spreads since it is not a button
$('button[name^="btn_buybet"]').removeAttr('disabled');
},
update_from_stream: function(stream) {
Expand Down
2 changes: 1 addition & 1 deletion src/templates/toolkit/bet/explanation.html.tt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
flash.staysinout = static_url.copy.append("flash/betguide-staysinout.swf")
flash.endsinout = static_url.copy.append("flash/betguide-endsinout.swf")
flash.updown = static_url.copy.append("flash/betguide-updown.swf")
image.spreads = [ request.url_for('images/pages/get-started/spreadbet-long.png'),request.url_for('images/pages/get-started/spreadbet-long.png') ]
image.spreads = [ request.url_for('images/pages/get-started/spreadbet-long.png'),request.url_for('images/pages/get-started/spreadbet-short.png') ]
%]

<div class='grd-grid-12 grd-parent'>
Expand Down