cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [45/53] [abbrv] git commit: Adding basic sorting on the search results ng-repeat directive via orderBy
Date Mon, 07 Apr 2014 21:07:41 GMT
Adding basic sorting on the search results ng-repeat directive via orderBy


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/27c89cf9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/tree/27c89cf9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/diff/27c89cf9

Branch: refs/heads/master
Commit: 27c89cf9c894870d9954bfc6ac92f5bbff2d938a
Parents: 10fd1ac
Author: Josh Bavari <josh@raisemore.com>
Authored: Sun Mar 30 13:56:14 2014 -0500
Committer: Josh Bavari <josh@raisemore.com>
Committed: Sun Mar 30 13:56:14 2014 -0500

----------------------------------------------------------------------
 attachments/js/controllers/search.js            | 8 ++++++++
 attachments/partials/directives/pluginlist.html | 9 ++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/27c89cf9/attachments/js/controllers/search.js
----------------------------------------------------------------------
diff --git a/attachments/js/controllers/search.js b/attachments/js/controllers/search.js
index fd81f56..eef47e4 100644
--- a/attachments/js/controllers/search.js
+++ b/attachments/js/controllers/search.js
@@ -15,6 +15,14 @@ angular.module('registry.controllers').controller('SearchController', ['$rootSco
 
 	$scope.searchTerm = SearchService.getSearch();
 
+	$scope.reverse = null;
+	$scope.orderValue = 'key';
+
+	$scope.setOrderBy = function setOrderBy (value) {
+		$scope.orderValue = value;
+		$scope.reverse = !$scope.reverse;
+	};
+
 	$scope.selectedPlatforms = function() {
 		//send back null if we arent showing filters
 		if(!$scope.showFilters) {

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/27c89cf9/attachments/partials/directives/pluginlist.html
----------------------------------------------------------------------
diff --git a/attachments/partials/directives/pluginlist.html b/attachments/partials/directives/pluginlist.html
index 65af6b6..05ece9a 100644
--- a/attachments/partials/directives/pluginlist.html
+++ b/attachments/partials/directives/pluginlist.html
@@ -1,16 +1,19 @@
 <div ng-show="plugins.length > 0">
     <div class="row pluginHeader">
         <div class="column-9--hand column-8--lap">
-            Plugin ID &amp; description
+            <a ng-click="setOrderBy('key')">Plugin ID &amp; description</a>
+            <span ng-show="orderValue == 'key'"><i ng-show="reverse" class="icon-up-dir"></i><i
ng-hide="reverse" class="icon-down-dir"></i>
+            </span>
         </div>
         <div class="column-3--hand column-2--lap center">
             Version
         </div>
         <div class="column-2--hand center invisible--hand visible--lap">
-            Downloads
+            <a ng-click="setOrderBy('downloads[plugin.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>
         </div>
     </div>
-    <div ng-repeat="plugin in plugins | platformFilter: selectedPlatforms()" class="row
pluginItem">
+    <div ng-repeat="plugin in plugins | platformFilter: selectedPlatforms() | orderBy:orderValue:reverse"
class="row pluginItem">
         <div class="column-9--hand column-8--lap">
             <div><a ng-href="#/package/{{plugin.key}}">{{plugin.key}}</a></div>
             <div class="pluginItemDescription">{{((plugin.value.description)||(plugin.doc.description))}}</div>


Mime
View raw message