From 77dcdbe776bfd34fbadd643dc752ae68b05f675f Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Tue, 14 Mar 2017 16:07:02 +0100 Subject: [PATCH] Blockchain > Advanced search failed - fix #395 --- www/js/controllers/blockchain-controllers.js | 11 +------- .../js/controllers/blockchain-controllers.js | 2 +- .../es/js/services/blockchain-services.js | 27 +++++++++---------- .../es/templates/blockchain/items_blocks.html | 14 +++++++++- .../blockchain/item_block_empty_lg.html | 12 ++++----- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/www/js/controllers/blockchain-controllers.js b/www/js/controllers/blockchain-controllers.js index 8e427f005..2d4d28818 100644 --- a/www/js/controllers/blockchain-controllers.js +++ b/www/js/controllers/blockchain-controllers.js @@ -277,10 +277,8 @@ function BlockLookupController($scope, $timeout, $focus, $filter, $state, $ancho $scope.smallscreen = UIUtils.screen.isSmall(); - if (!$scope.search.results.length) return; - // Set Motion - if (res.length > 0) { + if (res && res.length) { $scope.motion.show({selector: '.list-blocks .item-block'}); } @@ -412,13 +410,6 @@ function BlockLookupController($scope, $timeout, $focus, $filter, $state, $ancho $scope.doSearch(); }; - $scope.sameDay = function(block, previousBlock) { - if (block.number >= 2438 && block.number <= 2439) { - - console.log("{0} {1} -> {2}".format(block.number, block.medianTime, block.medianTime % (24* 60 * 60))); - } - }; - $scope.showHelpTip = function() { }; diff --git a/www/plugins/es/js/controllers/blockchain-controllers.js b/www/plugins/es/js/controllers/blockchain-controllers.js index 2eba7327b..e381c5808 100644 --- a/www/plugins/es/js/controllers/blockchain-controllers.js +++ b/www/plugins/es/js/controllers/blockchain-controllers.js @@ -122,7 +122,7 @@ function ESBlockLookupController($scope, $state, $controller, $ionicPopover, UIU else { // default sort request.sort = "number:desc"; } - + request.excludeCurrent = true; promise = esBlockchain.block.searchText($scope.currency, $scope.search.text, request); } diff --git a/www/plugins/es/js/services/blockchain-services.js b/www/plugins/es/js/services/blockchain-services.js index f6e528c4e..5958c4ce7 100644 --- a/www/plugins/es/js/services/blockchain-services.js +++ b/www/plugins/es/js/services/blockchain-services.js @@ -33,17 +33,6 @@ angular.module('cesium.es.blockchain.services', ['cesium.services', 'cesium.es.h return new RegExp('^' + regexpContent + '$'); } - function copy(otherNode) { - if (!!this.instance) { - var instance = this.instance; - angular.copy(otherNode, this); - this.instance = instance; - } - else { - angular.copy(otherNode, this); - } - } - exports.node.parseEndPoint = function(endpoint) { var matches = REGEX.ES_CORE_API_ENDPOINT.exec(endpoint); if (!matches) return; @@ -100,7 +89,7 @@ angular.module('cesium.es.blockchain.services', ['cesium.services', 'cesium.es.h delete request.skipData; request.from = request.from || 0; request.size = request.size || CONSTANTS.DEFAULT_SEARCH_SIZE; - request._source = request._source || FIELDS.COMMONS; + request._source = options._source || FIELDS.COMMONS; if (options._source && options._source == '*') { delete request._source; } @@ -112,10 +101,16 @@ angular.module('cesium.es.blockchain.services', ['cesium.services', 'cesium.es.h }; exports.block.searchText = function(currency, text, options) { - var request = options || {}; + if (options && angular.isUndefined(options.excludeCurrent)) { + options.excludeCurrent = true; + } + var request = options ? angular.copy(options) : {}; + delete request.excludeCurrent; + delete request.fillAvatar; + delete request.skipData; request.from = request.from || 0; request.size = request.size || CONSTANTS.DEFAULT_SEARCH_SIZE; - request._source = request._source || FIELDS.COMMONS; + request._source = options._source || FIELDS.COMMONS.join(','); if (options._source && options._source == '*') { delete request._source; } @@ -124,7 +119,9 @@ angular.module('cesium.es.blockchain.services', ['cesium.services', 'cesium.es.h request.text=text||''; return exports.raw.block.searchText(request) - .then(exports.raw.block.processSearchResult); + .then(function(res) { + return exports.raw.block.processSearchResult(res, options); + }); }; return exports; diff --git a/www/plugins/es/templates/blockchain/items_blocks.html b/www/plugins/es/templates/blockchain/items_blocks.html index 8cfa50f7e..7fceae146 100644 --- a/www/plugins/es/templates/blockchain/items_blocks.html +++ b/www/plugins/es/templates/blockchain/items_blocks.html @@ -1,6 +1,18 @@ -<div class="item row row-header hidden-xs hidden-sm" ng-if="expertMode"> +<div class="item row row-header done in hidden-xs hidden-sm" ng-if=":rebind:!expertMode"> + <!-- compact --> + <a class="button button-text button-small ink" + ng-class="{'button-text-positive': compactMode, 'button-text-stable': !compactMode}" + ng-click="toggleCompactMode()" > + <i class="icon ion-navicon"></i> + <b class="ion-arrow-down-b" style="position: absolute; top: -2px; left: 4px; font-size: 8px;"></b> + <b class="ion-arrow-up-b" style="position: absolute; top: 10px; left: 4px; font-size: 8px;"></b> + <span>{{'BLOCKCHAIN.LOOKUP.BTN_COMPACT'|translate}}</span> + </a> +</div> + +<div class="item row row-header done in hidden-xs hidden-sm" ng-if=":rebind:expertMode"> <!-- compact --> <a class="pull-left gray button button-text button-small no-margin no-padding" diff --git a/www/templates/blockchain/item_block_empty_lg.html b/www/templates/blockchain/item_block_empty_lg.html index 0301fa178..eb232ff94 100644 --- a/www/templates/blockchain/item_block_empty_lg.html +++ b/www/templates/blockchain/item_block_empty_lg.html @@ -1,15 +1,15 @@ <a name="block-{{::block.number}}"></a> -<ion-item id="block-{{::block.number}}" +<div id="block-{{::block.number}}" ng-if="!block.hide" class="item item-block item-icon-left item-block-empty" - ng-class="{'compacted': block.compacted && compactMode, ionItemClass: true}" + ng-class=":rebind:{'compacted': compactMode, ionItemClass: true}" ng-click="selectBlock(block)" > - <div class="row no-padding" ng-if="!block.compacted || !compactMode"> + <div class="row no-padding" ng-if=":rebind:!compactMode"> <div class="col"> - <h3 ng-class="{'gray': block.compacted, 'dark': !block.compacted}"> + <h3 class="gray"> <i class="ion-clock"></i> - {{block.medianTime|formatDate}} + {{:rebind:block.medianTime|formatDate}} </h3> </div> @@ -31,4 +31,4 @@ </div> </div> -</ion-item> +</div> -- GitLab