You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2014/04/16 02:31:15 UTC

[11/11] git commit: CB-6283: fixed download sorting

CB-6283: fixed download sorting


Project: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/commit/6ee90197
Tree: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/tree/6ee90197
Diff: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/diff/6ee90197

Branch: refs/heads/master
Commit: 6ee901970d2978ddc18c0ea61bc7128ae57ad17d
Parents: 55da27c
Author: Steven Gill <st...@gmail.com>
Authored: Tue Apr 15 17:30:44 2014 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Tue Apr 15 17:30:44 2014 -0700

----------------------------------------------------------------------
 attachments/js/controllers/packageDetails.js    |  3 ++-
 attachments/js/controllers/viewAll.js           | 11 +++++++----
 attachments/js/directives/pluginlist.js         |  2 --
 attachments/js/directives/topbar.js             | 10 +++++++++-
 attachments/partials/directives/pluginlist.html |  6 +++---
 5 files changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/6ee90197/attachments/js/controllers/packageDetails.js
----------------------------------------------------------------------
diff --git a/attachments/js/controllers/packageDetails.js b/attachments/js/controllers/packageDetails.js
index 0af56a1..5466c91 100644
--- a/attachments/js/controllers/packageDetails.js
+++ b/attachments/js/controllers/packageDetails.js
@@ -13,7 +13,7 @@ angular.module('registry.controllers').controller('PackageDetailsController', ['
     $scope.lastupdated = null;
     $scope.downloads = null;
     $scope.latestVersion = null;
-    $scope.currentVersion = "0.2.6";
+    $scope.currentVersion = null;
     $scope.platforms = null;
     $scope.keywords = null;
 
@@ -51,6 +51,7 @@ angular.module('registry.controllers').controller('PackageDetailsController', ['
                     // console.log(data); 
                     // console.log($scope.versions);
                     $scope.readme = marked($scope.data.readme);
+                    $scope.englishdoc = marked($scope.data.versions[$scope.currentVersion].englishdoc);
                 }).
                 error(function(data, status){
                     if (status === 404){

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/6ee90197/attachments/js/controllers/viewAll.js
----------------------------------------------------------------------
diff --git a/attachments/js/controllers/viewAll.js b/attachments/js/controllers/viewAll.js
index c7b81a4..827854d 100644
--- a/attachments/js/controllers/viewAll.js
+++ b/attachments/js/controllers/viewAll.js
@@ -5,12 +5,15 @@ angular.module('registry.controllers').controller('ViewAllController', ['$rootSc
     $scope.getPlugins = function(){
         $http({method: 'GET', url:('/api/_all_docs?include_docs=true&skip=3')}).
                 success(function(data, status, headers, config) {
-                    console.log(data);
                     $scope.plugins = data.rows;
                     $scope.loading = false;
-                    // console.log($scope.plugins);
-                    // console.log($scope.plugins[0].doc.description);
-                    // console.log($scope.plugins[0].doc['dist-tags'].latest);
+                    $scope.plugins.forEach(function(element, index, array){
+                        if(!($scope.downloads[element.id])){
+                            array[index].downloads = 0;
+                        }else{
+                            array[index].downloads = $scope.downloads[element.id];
+                        }
+                    });
                 }).
                 error(function(data, status){
                     if (status === 404){

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/6ee90197/attachments/js/directives/pluginlist.js
----------------------------------------------------------------------
diff --git a/attachments/js/directives/pluginlist.js b/attachments/js/directives/pluginlist.js
index 6731d39..d961606 100644
--- a/attachments/js/directives/pluginlist.js
+++ b/attachments/js/directives/pluginlist.js
@@ -4,7 +4,6 @@ angular.module('registry.controllers').directive('pluginlist', function () {
         templateUrl: '/partials/directives/pluginlist.html',
         controller:['$scope', '$rootScope', 'Downloads', function($scope, $rootScope, Downloads){
             Downloads.getDownloads().then(function(obj){
-                console.log(obj);
                 $scope.downloads = obj.data;
                 $scope.downloadsArray = obj.arrData;
             });
@@ -13,7 +12,6 @@ angular.module('registry.controllers').directive('pluginlist', function () {
 	        $scope.orderValue = 'key';
 
 	        $scope.setOrderBy = function setOrderBy (value) {
-                console.log(value);
 		        $scope.orderValue = value;
 		        $scope.reverse = !$scope.reverse;
 	        };

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/6ee90197/attachments/js/directives/topbar.js
----------------------------------------------------------------------
diff --git a/attachments/js/directives/topbar.js b/attachments/js/directives/topbar.js
index 9f1c1dc..3d35ae3 100644
--- a/attachments/js/directives/topbar.js
+++ b/attachments/js/directives/topbar.js
@@ -21,8 +21,16 @@ angular.module('registry.controllers').directive('topbar', ['$http', '$location'
                             $http.get('/_list/search/search?startkey='+JSON.stringify(term)+'&endkey='+JSON.stringify(term+'ZZZZZZZZZZZZZZ')+'&limit=25').
                                 success(function(data, status, headers, config){
                                     $scope.plugins = data.rows;
+                                    $scope.plugins.forEach(function(element, index, array){
+                                        if(!($scope.downloads[element.key])){
+                                            array[index].downloads = 0;
+                                        }else{
+                                            array[index].downloads = $scope.downloads[element.key];
+                                        }
+                                    });
+
                                     //todo: save this in session storage instead of object?
-                                    searchResults[term] = data.rows;
+                                    searchResults[term] = $scope.plugins;
                                 }).
                                 error(function(data,status){
                                     console.log(data);

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/6ee90197/attachments/partials/directives/pluginlist.html
----------------------------------------------------------------------
diff --git a/attachments/partials/directives/pluginlist.html b/attachments/partials/directives/pluginlist.html
index 4599805..c45394c 100644
--- a/attachments/partials/directives/pluginlist.html
+++ b/attachments/partials/directives/pluginlist.html
@@ -9,8 +9,8 @@
             Version
         </div>
         <div class="column-2--hand center invisible--hand visible--lap">
-            <a ng-click="setOrderBy('downloads[key]')">Downloads</a>
-            <span ng-show="orderValue == 'downloads[plugin.key]' "><i ng-show="reverse" class="icon-up-dir"></i><i ng-hide="reverse" class="icon-down-dir"></i></span>
+            <a ng-click="setOrderBy('downloads')">Downloads</a>
+            <span ng-show="orderValue == 'downloads' "><i ng-show="reverse" class="icon-up-dir"></i><i ng-hide="reverse" class="icon-down-dir"></i></span>
         </div>
     </div>
     <div ng-repeat="plugin in plugins | platformFilter: selectedPlatforms() | orderBy:orderValue:reverse" class="row pluginItem">
@@ -22,7 +22,7 @@
             <div class="pluginItemVersion">{{((plugin.value['dist-tags'].latest)||(plugin.doc['dist-tags'].latest))}}</div>
         </div>
         <div class="column-2--hand invisible--hand visible--lap center">
-            <div class="pluginItemDownloads">{{downloads[plugin.key]}}</div>
+            <div class="pluginItemDownloads">{{plugin.downloads}}</div>
         </div>
     </div>
 </div>