From a3af792af0355f47bc50fe56e9cbe72f55403ce6 Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Mon, 13 Mar 2017 16:39:05 +0100
Subject: [PATCH] - Wot lookup: fix ink on items  - Wot lookup: fix default
 action and URL update - Blockchain: view block raw has bas URL - fix #389

---
 www/js/controllers/wot-controllers.js    | 23 ++++++++++-------
 www/js/services/utils-services.js        |  3 ++-
 www/templates/blockchain/view_block.html |  2 +-
 www/templates/menu.html                  |  4 +--
 www/templates/wot/lookup_form.html       | 32 +++++++++++++++++++-----
 5 files changed, 45 insertions(+), 19 deletions(-)

diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js
index 056119c24..5690ed8df 100644
--- a/www/js/controllers/wot-controllers.js
+++ b/www/js/controllers/wot-controllers.js
@@ -132,13 +132,18 @@ function WotLookupController($scope, $state, $timeout, $focus, $ionicPopover, $i
       }
       else {
         $timeout(function() {
+          // Init phase
+          if (csConfig.initPhase && !state.stateParams.type) {
+            $scope.doGetPending(0, undefined, true/*skipLocationUpdate*/);
+          }
           // get new comers
-          if (!csConfig.initPhase || state.stateParams.type == 'newcomers') {
-            $scope.doGetNewcomers(0, state.stateParams.newcomers);
+          else if (state.stateParams.type == 'newcomers' || (!csConfig.initPhase && !state.stateParams.type)) {
+            $scope.doGetNewcomers(0, undefined, true/*skipLocationUpdate*/);
           }
-          else if (csConfig.initPhase || state.stateParams.type == 'pending') {
-            $scope.doGetPending(0, state.stateParams.pendings);
+          else if (state.stateParams.type == 'pending') {
+            $scope.doGetPending(0, undefined, true/*skipLocationUpdate*/);
           }
+
         }, 100);
       }
       // removeIf(device)
@@ -230,7 +235,7 @@ function WotLookupController($scope, $state, $timeout, $focus, $ionicPopover, $i
     }
   };
 
-  $scope.doGetNewcomers = function(offset, size) {
+  $scope.doGetNewcomers = function(offset, size, skipLocationUpdate) {
     offset = offset || 0;
     size = size || defaultSearchLimit;
     if (size < defaultSearchLimit) size = defaultSearchLimit;
@@ -240,7 +245,7 @@ function WotLookupController($scope, $state, $timeout, $focus, $ionicPopover, $i
     $scope.search.type = 'newcomers';
 
     // Update location href
-    if (!offset) {
+    if (!offset && !skipLocationUpdate) {
       $scope.doRefreshLocationHref();
     }
 
@@ -258,7 +263,7 @@ function WotLookupController($scope, $state, $timeout, $focus, $ionicPopover, $i
       });
   };
 
-  $scope.doGetPending = function(offset, size) {
+  $scope.doGetPending = function(offset, size, skipLocationUpdate) {
     offset = offset || 0;
     size = size || defaultSearchLimit;
     if (size < defaultSearchLimit) size = defaultSearchLimit;
@@ -272,7 +277,7 @@ function WotLookupController($scope, $state, $timeout, $focus, $ionicPopover, $i
       csWot.pending;
 
     // Update location href
-    if (!offset) {
+    if (!offset && !skipLocationUpdate) {
       $scope.doRefreshLocationHref();
     }
 
@@ -449,7 +454,7 @@ function WotLookupController($scope, $state, $timeout, $focus, $ionicPopover, $i
 
     // Motion
     if (res.length > 0 && $scope.motion) {
-      $scope.motion.show({selector: '.lookupForm .item.ink'});
+      $scope.motion.show({selector: '.lookupForm .list .item', ink: true});
     }
   };
 
diff --git a/www/js/services/utils-services.js b/www/js/services/utils-services.js
index c40122818..247a85c0a 100644
--- a/www/js/services/utils-services.js
+++ b/www/js/services/utils-services.js
@@ -552,8 +552,9 @@ angular.module('cesium.utils.services', ['ngResource'])
         options.ink = angular.isDefined(options.ink) ? options.ink : true;
         options.startVelocity = options.startVelocity || (isSmallScreen() ? 1100 : 3000);
         return $timeout(function(){
+
           if (options.ink || options.inkSelector) {
-            ionicMaterialInk.displayEffect({selector: (options.inkSelector || (options.selector + '.ink'))});
+            exports.ink({selector: (options.inkSelector || (options.selector + '.ink'))});
           }
           callback(options);
         }, options.timeout || motionTimeout);
diff --git a/www/templates/blockchain/view_block.html b/www/templates/blockchain/view_block.html
index f3c82e694..efba0084a 100644
--- a/www/templates/blockchain/view_block.html
+++ b/www/templates/blockchain/view_block.html
@@ -51,7 +51,7 @@
 
             <h3>
               <a target="_blank"
-                 ng-href="{{node.node.url}}/blockchain/block/{{formData.number}}">
+                 ng-href="{{node.url}}/blockchain/block/{{formData.number}}">
                 <i class="icon ion-share"></i> {{'BLOCKCHAIN.VIEW.SHOW_RAW'|translate}}
               </a>
             </h3>
diff --git a/www/templates/menu.html b/www/templates/menu.html
index ee74ee318..b05dc3875 100644
--- a/www/templates/menu.html
+++ b/www/templates/menu.html
@@ -104,10 +104,10 @@
         <!-- MAIN Section -->
         <div class="item item-divider"></div>
 
-        <ion-item menu-close class="item item-icon-left" active-link="active" href="#/app/wot">
+        <a menu-close class="item item-icon-left" active-link="active" ui-sref="app.wot_lookup">
           <i class="icon ion-person-stalker"></i>
           <span translate>MENU.WOT</span>
-        </ion-item>
+        </a>
         <a id="helptip-menu-btn-wot"></a>
 
         <!-- Allow extension here -->
diff --git a/www/templates/wot/lookup_form.html b/www/templates/wot/lookup_form.html
index f0c1d0494..ac22429b5 100644
--- a/www/templates/wot/lookup_form.html
+++ b/www/templates/wot/lookup_form.html
@@ -97,11 +97,12 @@
       <span ng-if="search.type=='newcomers'" translate>WOT.LOOKUP.NO_NEWCOMERS</span>
     </div>
 
-    <!-- simple selection -->
+    <!-- simple selection + device -->
+    <!--removeIf(no-device)-->
     <ion-list
-      ng-if="::!allowMultiple"
+      ng-if="!allowMultiple && $root.device.enable"
       class="{{::motion.ionListClass}}"
-      can-swipe="$root.device.enable">
+      can-swipe="true">
 
       <ion-item
         ng-repeat="identity in search.results track by identity.id"
@@ -115,11 +116,30 @@
       </ion-item>
 
     </ion-list>
+    <!--endRemoveIf(no-device)-->
+
+    <!-- simple selection + no device -->
+    <!--removeIf(device)-->
+    <div
+      ng-if="!allowMultiple"
+      class="list {{::motion.ionListClass}}">
+
+      <div
+        ng-repeat="identity in search.results track by identity.id"
+        id="helptip-wot-search-result-{{$index}}"
+        class="item item-border-large item-avatar item-icon-right ink" ng-click="::select(identity)">
+
+        <ng-include src="'templates/wot/identity.html'"></ng-include>
+
+        <i class="icon ion-ios-arrow-right "></i>
+      </div>
+    </div>
+    <!--endRemoveIf(device)-->
 
     <!-- multi selection -->
-    <ion-list
+    <div
       ng-if="::allowMultiple"
-      class="{{::motion.ionListClass}}">
+      class="list {{::motion.ionListClass}}">
 
       <ion-checkbox
         ng-repeat="identity in search.results track by identity.id"
@@ -128,7 +148,7 @@
         ng-click="toggleCheck($index, $event)">
         <ng-include src="'templates/wot/identity.html'"></ng-include>
       </ion-checkbox>
-    </ion-list>
+    </div>
 
     <ion-infinite-scroll
       ng-if="search.hasMore"
-- 
GitLab