diff --git a/www/js/controllers/blockchain-controllers.js b/www/js/controllers/blockchain-controllers.js index 95a09c85e55a746ec1b028bdbcb2e655886e03af..9974631e264f7a9c30d41d92f5d622bdff086f65 100644 --- a/www/js/controllers/blockchain-controllers.js +++ b/www/js/controllers/blockchain-controllers.js @@ -332,7 +332,7 @@ function BlockLookupController($scope, $timeout, $focus, $filter, $state, $ancho UIUtils.ink({ selector: '#block-'+block.number }); - }, 100); + }); }; $scope.wsBlock.on(function(json) { @@ -347,12 +347,14 @@ function BlockLookupController($scope, $timeout, $focus, $filter, $state, $ancho $scope.search.results = $scope.search.results || []; if (!$scope.search.results.length) { - // Prepare the new block, then add it to result + console.debug('[ES] [blockchain] new block #{0} received (by websocket)'.format(block.number)); + // add it to result + $scope.search.total++; + $scope.search.results.push(block); + + // Prepare the new block, then show it $scope.doPrepareResult([block]) .then(function() { - console.debug('[ES] [blockchain] new block #{0} received (by websocket)'.format(block.number)); - $scope.search.total++; - $scope.search.results.push(block); return showBlock(block); }); } @@ -364,22 +366,24 @@ function BlockLookupController($scope, $timeout, $focus, $filter, $state, $ancho if (existingBlock) { if (existingBlock.hash != block.hash) { console.debug('[ES] [blockchain] block #{0} updated (by websocket)'.format(block.number)); - // Prepare the new block, and refresh the previous latest block (could be compacted) - $scope.doPrepareResult([block, $scope.search.results[0]]) + // Replace existing content + angular.copy(block, existingBlock); + // Prepare the new block, then show it + $scope.doPrepareResult([block, $scope.search.results[1]]) .then(function() { - angular.copy(block, existingBlock); return showBlock(existingBlock); }); } } else { console.debug('[ES] [blockchain] new block #{0} received (by websocket)'.format(block.number)); - // Prepare the new block, and refresh the previous latest block (could be compacted) - $scope.doPrepareResult([block, $scope.search.results[0]]) + // Insert at index 0 + $scope.search.total++; + $scope.search.results.splice(0, 0, block); + + // Prepare the new block, then show it + $scope.doPrepareResult([block, $scope.search.results[1]]) .then(function() { - // Insert at index 0 - $scope.search.total++; - $scope.search.results.splice(0, 0, block); return showBlock(block); }); } diff --git a/www/js/controllers/settings-controllers.js b/www/js/controllers/settings-controllers.js index 38178382d13179e79ba9516e934fddf67c60de26..ae54eec881be0d331f1d9668322a50dfe2815e2e 100644 --- a/www/js/controllers/settings-controllers.js +++ b/www/js/controllers/settings-controllers.js @@ -201,7 +201,7 @@ function SettingsController($scope, $q, $ionicPopup, $timeout, $translate, csHtt $scope.showActionsPopover = function(event) { if (!$scope.actionsPopover) { - $ionicPopover.fromTemplateUrl('templates/settings/popover_actions.html', { + $ionicPopover.fromTemplateUrl('templates/settings/lookup_popover_actions.html', { scope: $scope }).then(function(popover) { $scope.actionsPopover = popover; diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index 70f9427d9a1c98931d0d46740d4c61e628f3bf6f..b6716baff434081193869c6cc3444956cf440d99 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -60,7 +60,7 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, }); }); - $ionicPopover.fromTemplateUrl('templates/wallet/popover_actions.html', { + $ionicPopover.fromTemplateUrl('templates/wallet/lookup_popover_actions.html', { scope: $scope }).then(function(popover) { $scope.actionsPopover = popover; @@ -532,7 +532,7 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, $scope.showActionsPopover = function(event) { if (!$scope.actionsPopover) { - $ionicPopover.fromTemplateUrl('templates/wallet/popover_actions.html', { + $ionicPopover.fromTemplateUrl('templates/wallet/lookup_popover_actions.html', { scope: $scope }).then(function(popover) { $scope.actionsPopover = popover; diff --git a/www/plugins/es/js/controllers/blockchain-controllers.js b/www/plugins/es/js/controllers/blockchain-controllers.js index f7f3fd9dc0464aeb1a89f59e9179aae046686ef0..dc8ff935704f4cf31fa8b77b12a90d0e895b8a92 100644 --- a/www/plugins/es/js/controllers/blockchain-controllers.js +++ b/www/plugins/es/js/controllers/blockchain-controllers.js @@ -51,7 +51,7 @@ angular.module('cesium.es.blockchain.controllers', ['cesium.es.services']) ; -function ESBlockLookupController($scope, $state, $controller, UIUtils, esBlockchain, $ionicHistory) { +function ESBlockLookupController($scope, $state, $controller, $ionicPopover, UIUtils, esBlockchain, $ionicHistory) { 'ngInject'; // Initialize the super class and extend it. @@ -85,7 +85,10 @@ function ESBlockLookupController($scope, $state, $controller, UIUtils, esBlockch }; $scope.doSearchLast = function() { + $scope.hideActionsPopover(); + $scope.search.type = 'last'; + $scope.search.sort = undefined; $scope.doSearch(); $ionicHistory.nextViewOptions({ @@ -177,6 +180,32 @@ function ESBlockLookupController($scope, $state, $controller, UIUtils, esBlockch $scope.showHelpTip = function() { }; + + /* -- popups -- */ + + $scope.showActionsPopover = function(event) { + if (!$scope.actionsPopover) { + $ionicPopover.fromTemplateUrl('plugins/es/templates/blockchain/lookup_popover_actions.html', { + scope: $scope + }).then(function(popover) { + $scope.actionsPopover = popover; + //Cleanup the popover when we're done with it! + $scope.$on('$destroy', function() { + $scope.actionsPopover.remove(); + }); + $scope.actionsPopover.show(event); + }); + } + else { + $scope.actionsPopover.show(event); + } + }; + + $scope.hideActionsPopover = function() { + if ($scope.actionsPopover) { + $scope.actionsPopover.hide(); + } + }; } function ESNetworkViewExtendController($scope, PluginService, csSettings) { diff --git a/www/plugins/es/js/controllers/message-controllers.js b/www/plugins/es/js/controllers/message-controllers.js index b83b7f0c7299e4127b00eb2408bdfe35494ed561..4e512248eb87cfb9cdc7c0f5030c3c80919e1f76 100644 --- a/www/plugins/es/js/controllers/message-controllers.js +++ b/www/plugins/es/js/controllers/message-controllers.js @@ -209,7 +209,7 @@ function ESMessageListController($scope, $rootScope, $state, $timeout, $translat $scope.showActionsPopover = function(event) { if (!$scope.actionsPopover) { - $ionicPopover.fromTemplateUrl('plugins/es/templates/message/popover_actions.html', { + $ionicPopover.fromTemplateUrl('plugins/es/templates/message/lookup_popover_actions.html', { scope: $scope }).then(function(popover) { $scope.actionsPopover = popover; diff --git a/www/plugins/es/templates/blockchain/items_blocks.html b/www/plugins/es/templates/blockchain/items_blocks.html index 9456a19ffd53f9d3f87134fe9ee2a18ca9093912..8cfa50f7e94b0b5e198873cb1014c6b1ddd9dbd1 100644 --- a/www/plugins/es/templates/blockchain/items_blocks.html +++ b/www/plugins/es/templates/blockchain/items_blocks.html @@ -30,11 +30,19 @@ </a> </div> -<div class="padding gray" ng-if="!search.loading && !search.results.length" translate> +<div class="padding gray" ng-if=":rebind:!search.loading && !search.results.length" translate> COMMON.SEARCH_NO_RESULT </div> -<!-- blocks --> -<ng-repeat ng-repeat="block in search.results" - ng-include="!block.empty ? 'templates/blockchain/item_block_lg.html' : 'templates/blockchain/item_block_empty_lg.html'"> -</ng-repeat> +<!-- blocks (large view) --> +<ng-if ng-if=":rebind:!smallscreen"> + <ng-repeat ng-repeat="block in :rebind:search.results track by block.number" + ng-include="!block.empty ? 'templates/blockchain/item_block_lg.html' : 'templates/blockchain/item_block_empty_lg.html'"> + </ng-repeat> +</ng-if> +<!-- blocks (small screens) --> +<ng-if ng-if=":rebind:smallscreen"> + <ng-repeat ng-repeat="block in :rebind:search.results track by block.number" + ng-include="'templates/blockchain/item_block.html'"> + </ng-repeat> +</ng-if> diff --git a/www/plugins/es/templates/blockchain/lookup.html b/www/plugins/es/templates/blockchain/lookup.html index 287044b64cbea30bb11d0987bfed568d93da3193..e9df93b22503735957f1678dc32979d4132624f6 100644 --- a/www/plugins/es/templates/blockchain/lookup.html +++ b/www/plugins/es/templates/blockchain/lookup.html @@ -3,6 +3,23 @@ <span translate>BLOCKCHAIN.LOOKUP.TITLE</span> </ion-nav-title> + <ion-nav-buttons side="secondary"> + + <button class="button button-icon button-clear icon ion-navicon visible-xs visible-sm" + ng-click="toggleCompactMode()"> + <b class="icon-secondary" + ng-class="{'ion-arrow-down-b': !compactMode, 'ion-arrow-up-b': compactMode}" + style="top: -12px; left: 11px; font-size: 10px;"></b> + <b class="icon-secondary" + ng-class="{'ion-arrow-up-b': !compactMode,'ion-arrow-down-b': compactMode}" + style="top: 12px; left: 11px; font-size: 10px;"></b> + </button> + + <button class="button button-icon button-clear icon ion-android-more-vertical visible-xs visible-sm" ng-click="showActionsPopover($event)"> + </button> + + </ion-nav-buttons> + <ion-content class="padding no-padding-xs" scroll="true"> <ng-include src="'plugins/es/templates/blockchain/lookup_form.html'"></ng-include> </ion-content> diff --git a/www/plugins/es/templates/blockchain/lookup_popover_actions.html b/www/plugins/es/templates/blockchain/lookup_popover_actions.html index f2a4ae56262d003023646df410289c48635f8470..82872b7547dd931c0f0d34b1b7d3484de8fe3326 100644 --- a/www/plugins/es/templates/blockchain/lookup_popover_actions.html +++ b/www/plugins/es/templates/blockchain/lookup_popover_actions.html @@ -5,14 +5,15 @@ <ion-content scroll="false"> <div class="list item-text-wrap"> - <a class="item item-icon-left item-icon-right ink" - ng-click="toggleSearchType('XXX')"> - <i class="icon ion-android-people"></i> - {{'BLOCKCHAIN.LOOKUP.XXX' | translate}} - <i class="icon ion-ios-checkmark-empty" ng-show="search.type=='XXX'"></i> + <!-- last blocks --> + <a ng-if="enableFilter" + class="item item-icon-left item-icon-right ink" + ng-click="doSearchLast()"> + <i class="icon ion-clock"></i> + {{'BLOCKCHAIN.LOOKUP.BTN_LAST' | translate}} + <i class="icon ion-ios-checkmark-empty" ng-show="search.type=='last'"></i> </a> - </div> </ion-content> </ion-popover-view>