Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit be412fb

Browse files
Convert tabs to dropdown for Asset Index and Trading Times
1 parent 1a21596 commit be412fb

File tree

5 files changed

+40
-7
lines changed

5 files changed

+40
-7
lines changed

src/javascript/binary/common_functions/frontend.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,17 @@ function detect_hedging($purpose, $hedging) {
558558
});
559559
}
560560

561+
function jqueryuiTabsToDropdown($container) {
562+
var $ddl = $('<select/>');
563+
$container.find('li a').each(function() {
564+
$ddl.append($('<option/>', {text: $(this).text(), value: $(this).attr('href')}));
565+
});
566+
$ddl.change(function() {
567+
$container.find('li a[href="' + $(this).val() + '"]').click();
568+
});
569+
return $ddl;
570+
}
571+
561572
$(function() {
562573
$( "#accordion" ).accordion({
563574
heightStyle: "content",

src/javascript/binary/websocket_pages/resources/asset_index/asset_indexws.ui.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ var AssetIndexUI = (function() {
66
$contents;
77
var activeSymbols,
88
assetIndex,
9-
marketColumns;
9+
marketColumns,
10+
isFramed;
1011

11-
var init = function() {
12+
var init = function(config) {
1213
if (japanese_client()) {
1314
if (!TradePage.is_trading_page()) {
1415
window.location.href = page.url.url_for('resources');
@@ -21,6 +22,8 @@ var AssetIndexUI = (function() {
2122

2223
Content.populate();
2324
showLoadingImage($container);
25+
26+
isFramed = (config && config.framed);
2427
if (!assetIndex) AssetIndexData.sendRequest(!activeSymbols);
2528
};
2629

@@ -50,6 +53,11 @@ var AssetIndexUI = (function() {
5053
.append($contents.children());
5154

5255
$container.tabs('destroy').tabs();
56+
57+
if (isFramed) {
58+
$container.find('ul').hide();
59+
$('<div/>', {class: 'center-text'}).append(jqueryuiTabsToDropdown($container)).prependTo($container);
60+
}
5361
};
5462

5563
var getSubmarketTable = function(assetItem, symbolInfo) {

src/javascript/binary/websocket_pages/resources/market_times/market_timesws.ui.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ var MarketTimesUI = (function() {
55
$container;
66
var columns,
77
activeSymbols,
8-
tradingTimes;
8+
tradingTimes,
9+
isFramed;
910

10-
var init = function() {
11+
var init = function(config) {
1112
$date = $('#trading-date');
1213
$container = $('#trading-times');
1314
columns = ['Asset', 'Opens', 'Closes', 'Settles', 'UpcomingEvents'];
@@ -16,6 +17,8 @@ var MarketTimesUI = (function() {
1617

1718
Content.populate();
1819
showLoadingImage($container);
20+
21+
isFramed = (config && config.framed);
1922
if (!tradingTimes) MarketTimesData.sendRequest('today', !activeSymbols);
2023

2124
$date.val(moment.utc(new Date()).format('YYYY-MM-DD'));
@@ -61,6 +64,11 @@ var MarketTimesUI = (function() {
6164
.append($contents.children());
6265

6366
$container.tabs('destroy').tabs();
67+
68+
if (isFramed) {
69+
$container.find('ul').hide();
70+
$('<div/>', {class: 'center-text'}).append(jqueryuiTabsToDropdown($container)).prependTo($container);
71+
}
6472
};
6573

6674
var createMarketTables = function(market, isJapanTrading) {

src/javascript/binary/websocket_pages/trade/analysis.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ var TradingAnalysis = (function() {
8080
BinarySocket.send({'ticks_history': underlying, 'end': 'latest', 'count': tick + '', 'req_id': 1});
8181
break;
8282
case 'tab_asset_index':
83-
AssetIndexUI.init();
83+
AssetIndexUI.init({framed: true});
84+
$('#tab_asset_index-content h1').hide();
8485
break;
8586
case 'tab_trading_times':
86-
MarketTimesUI.init();
87+
MarketTimesUI.init({framed: true});
88+
$('#tab_trading_times-content h1').hide();
8789
break;
8890
default:
8991
var url = currentLink.getAttribute('href') ;

src/sass/static/trade.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,18 @@
185185
}
186186
#spot_container {
187187
#spot {
188-
line-height: 28px;
188+
line-height: 20px;
189+
display: inline-block;
189190
white-space: nowrap;
190191
padding: 3px;
191192
border-radius: $BORDER_RADIUS;
192193
&.error {
193194
font-style: italic;
194195
}
195196
}
197+
#trading_worm_chart {
198+
display: inline-block;
199+
}
196200
}
197201
}
198202
}

0 commit comments

Comments
 (0)