From 7ba0cdaf53ae9e2c9af7f5f02c4d9bd7ac30c924 Mon Sep 17 00:00:00 2001 From: Scott Date: Sun, 29 Jan 2017 21:15:07 +1100 Subject: [PATCH] Converts enabled-exchanges to a component --- web/app/app.js | 47 ++++---- .../enabled-exchanges/enabled-exchanges.html | 30 +++++ .../enabled-exchanges/enabled-exchanges.js | 29 +++++ web/app/index.html | 106 +++++++++--------- web/app/views/home/home.html | 100 ++++++----------- web/app/views/home/home.js | 33 +----- 6 files changed, 179 insertions(+), 166 deletions(-) create mode 100644 web/app/components/enabled-exchanges/enabled-exchanges.html create mode 100644 web/app/components/enabled-exchanges/enabled-exchanges.js diff --git a/web/app/app.js b/web/app/app.js index f108a0b3..e0d3e438 100644 --- a/web/app/app.js +++ b/web/app/app.js @@ -2,28 +2,29 @@ // Declare app level module which depends on views, and components angular.module('myApp', [ - 'ngRoute', - 'ui-notification', - 'myApp.home', - 'myApp.wallets', - 'myApp.settings', - 'myApp.version', - 'myApp.buy', - 'myApp.sell', - 'myApp.stringUtils' + 'ngRoute', + 'ui-notification', + 'myApp.home', + 'myApp.wallets', + 'myApp.settings', + 'myApp.version', + 'myApp.buy', + 'myApp.sell', + 'myApp.enabledExchanges', + 'myApp.stringUtils' ]). -config(['$locationProvider', '$routeProvider' ,'NotificationProvider', function($locationProvider, $routeProvider, NotificationProvider) { - NotificationProvider.setOptions({ - delay: 5000, - startTop: 60, - startRight: 10, - verticalSpacing: 10, - horizontalSpacing: 20, - positionX: 'right', - positionY: 'top' - }); - - $locationProvider.hashPrefix('!'); +config(['$locationProvider', '$routeProvider', 'NotificationProvider', function($locationProvider, $routeProvider, NotificationProvider) { + NotificationProvider.setOptions({ + delay: 5000, + startTop: 60, + startRight: 10, + verticalSpacing: 10, + horizontalSpacing: 20, + positionX: 'right', + positionY: 'top' + }); - $routeProvider.otherwise({redirectTo: '/'}); -}]); + $locationProvider.hashPrefix('!'); + + $routeProvider.otherwise({ redirectTo: '/' }); +}]); \ No newline at end of file diff --git a/web/app/components/enabled-exchanges/enabled-exchanges.html b/web/app/components/enabled-exchanges/enabled-exchanges.html new file mode 100644 index 00000000..95cb784f --- /dev/null +++ b/web/app/components/enabled-exchanges/enabled-exchanges.html @@ -0,0 +1,30 @@ +
+

All enabled currencies

+
+
+ +
+
+ + + + + + + + + + + +
CurrencyLastVolume
{{value.CryptoCurrency}}{{value.Last}}{{value.Volume}}
+
+
+
+
+
\ No newline at end of file diff --git a/web/app/components/enabled-exchanges/enabled-exchanges.js b/web/app/components/enabled-exchanges/enabled-exchanges.js new file mode 100644 index 00000000..537055b7 --- /dev/null +++ b/web/app/components/enabled-exchanges/enabled-exchanges.js @@ -0,0 +1,29 @@ +angular.module('myApp.enabledExchanges', []).component('enabledexchanges', { + templateUrl: '/components/enabled-exchanges/enabled-exchanges.html', + controller: 'EnabledExchangesController', + controller: function($scope, $http, Notification, $rootScope) { + $scope.selected = {}; + $scope.getDashboardData = function() { + $http({ + method: 'GET', + url: '/data/all-enabled-currencies' + }). + success(function(data, status, headers, config) { + $scope.exchanges = data.data; + $scope.reloadDashboardWithExchangeCurrency($scope.exchanges[0], $scope.exchanges[0].exchangeValues[0]); + Notification.info("Retrieved latest data"); + }). + error(function(data, status, headers, config) { + console.log('error'); + }); + }; + + $scope.reloadDashboardWithExchangeCurrency = function(exchange, value) { + $scope.selected.Exchange = exchange; + $scope.selected.Currency = value; + $rootScope.$emit('CurrencyChanged', $scope.selected); + + }; + $scope.getDashboardData(); + } +}); \ No newline at end of file diff --git a/web/app/index.html b/web/app/index.html index 7f60ea37..1355de75 100644 --- a/web/app/index.html +++ b/web/app/index.html @@ -2,69 +2,75 @@ - + + + + - - - GoCrypto Trader - - - - - - - - + + + GoCrypto Trader + + + + + + + - - - + + + + - - + - -
+
- -

Copyright 2016 GoCrypto Trader

- - - - - - - - - - - - - - + + + + + + + + + + + + + + - + + \ No newline at end of file diff --git a/web/app/views/home/home.html b/web/app/views/home/home.html index 4e70ea33..0c8889d0 100644 --- a/web/app/views/home/home.html +++ b/web/app/views/home/home.html @@ -1,70 +1,40 @@

Dashboard

-
-
-
- -
-

Sell orders

-
-
-

Buy orders

-
-
-
-

Market depth chart

-
-
-

Buy

- -
-
-

Sell

- -
-
-

Wallet quick look

- See current holding of selected currency -
-
-
-

Trade History

-
-
-

My Open Orders

-
-
-
-
-

All enabled currencies

-
-
-
-

- - {{exchange.exchangeName}} - -

+
+
+ +
+

Sell orders

+
+
+

Buy orders

+
+
+
+

Market depth chart

+
+
+

Buy

+ +
+
+

Sell

+ +
+
+

Wallet quick look

+ See current holding of selected currency +
+
+
+

Trade History

+
+
+

My Open Orders

+
+
-
-
- - - - - - - - - - - -
CurrencyLastVolume
{{value.CryptoCurrency}}{{value.Last}}{{value.Volume}}
-
+
+
-
-
- - -
\ No newline at end of file diff --git a/web/app/views/home/home.js b/web/app/views/home/home.js index b6fad045..04978265 100644 --- a/web/app/views/home/home.js +++ b/web/app/views/home/home.js @@ -3,36 +3,13 @@ angular.module('myApp.home', ['ngRoute']) .config(['$routeProvider', function($routeProvider) { - $routeProvider.when('/', { - templateUrl: '/views/home/home.html', - controller: 'HomeController' - }); + $routeProvider.when('/', { + templateUrl: '/views/home/home.html', + controller: 'HomeController' + }); }]) - .controller('HomeController', function ($scope, $http, Notification, $rootScope) { - $scope.selected = {}; - $scope.getDashboardData = function() { - $http({ - method: 'GET', - url: '/data/all-enabled-currencies' - }). - success(function (data, status, headers, config) { - $scope.exchanges = data.data; - $scope.reloadDashboardWithExchangeCurrency($scope.exchanges[0], $scope.exchanges[0].exchangeValues[0]); - Notification.info("Retrieved latest data"); - }). - error(function (data, status, headers, config) { - console.log('error'); - }); - }; +.controller('HomeController', function() { - $scope.reloadDashboardWithExchangeCurrency = function (exchange, value) { - $scope.selected.Exchange = exchange; - $scope.selected.Currency = value; - $rootScope.$emit('CurrencyChanged', $scope.selected); - - }; - - $scope.getDashboardData(); }); \ No newline at end of file