Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DA5CF100A8 for ; Thu, 13 Mar 2014 00:54:34 +0000 (UTC) Received: (qmail 99438 invoked by uid 500); 13 Mar 2014 00:54:34 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 99393 invoked by uid 500); 13 Mar 2014 00:54:34 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 99386 invoked by uid 99); 13 Mar 2014 00:54:34 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Mar 2014 00:54:34 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EB8A89434A2; Thu, 13 Mar 2014 00:54:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: steven@apache.org To: commits@cordova.apache.org Message-Id: <91b39e3bed2045aba359998cded0af3e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: CB-5130: search is working, added styles to other pages Date: Thu, 13 Mar 2014 00:54:33 +0000 (UTC) Repository: cordova-registry-web Updated Branches: refs/heads/refactor 1c510b0e8 -> 074012f83 CB-5130: search is working, added styles to other pages 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/074012f8 Tree: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/tree/074012f8 Diff: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/diff/074012f8 Branch: refs/heads/refactor Commit: 074012f83c437737fbd94e7d5b30aea2bed25cd1 Parents: 1c510b0 Author: Steven Gill Authored: Wed Mar 12 17:54:21 2014 -0700 Committer: Steven Gill Committed: Wed Mar 12 17:54:21 2014 -0700 ---------------------------------------------------------------------- attachments/css/pages/packageDetails.less | 12 +++- attachments/css/pages/pluginlist.less | 9 +++ attachments/css/pages/search.less | 11 +++ attachments/css/pages/topbar.less | 2 +- attachments/css/pages/viewAll.less | 5 +- attachments/css/styles.css | 30 +++++++- attachments/css/styles.less | 1 + attachments/index.html | 3 +- attachments/js/controllers/home.js | 2 +- attachments/js/controllers/search.js | 37 +--------- attachments/js/directives/pluginlist.js | 13 ++++ attachments/js/directives/topbar.js | 46 ++++++++++-- attachments/js/services.js | 2 +- attachments/partials/directives/pluginlist.html | 25 +++++++ attachments/partials/directives/topbar.html | 4 +- attachments/partials/views/packageDetails.html | 68 +++++++++++------- attachments/partials/views/search.html | 76 +++++--------------- attachments/partials/views/viewAll.html | 27 +------ 18 files changed, 213 insertions(+), 160 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/css/pages/packageDetails.less ---------------------------------------------------------------------- diff --git a/attachments/css/pages/packageDetails.less b/attachments/css/pages/packageDetails.less index 38d7617..ea3abdd 100644 --- a/attachments/css/pages/packageDetails.less +++ b/attachments/css/pages/packageDetails.less @@ -1 +1,11 @@ -/* Package Details styles */ \ No newline at end of file +/* Package Details styles */ + +.space { + padding-top:10px; + padding-bottom:10px; + border-bottom:solid 2px #bfb7b9; +} + +.toprow { + padding-top:10px; +} http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/css/pages/pluginlist.less ---------------------------------------------------------------------- diff --git a/attachments/css/pages/pluginlist.less b/attachments/css/pages/pluginlist.less new file mode 100644 index 0000000..3bcc72f --- /dev/null +++ b/attachments/css/pages/pluginlist.less @@ -0,0 +1,9 @@ +.pluginHeader { + border-bottom:solid 2px black; +} + +.pluginItem { + border-bottom:solid 2px #bfb7b9; + padding-top:10px; + padding-bottom:10px; +} http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/css/pages/search.less ---------------------------------------------------------------------- diff --git a/attachments/css/pages/search.less b/attachments/css/pages/search.less index 572843f..920e2fd 100644 --- a/attachments/css/pages/search.less +++ b/attachments/css/pages/search.less @@ -1 +1,12 @@ /* Search styles */ + +.searchContainer { + padding-left:10px; +} + +.found { + font-size:25px; + padding-top:10px; + padding-bottom:10px; + border-bottom:dotted 2px #bfb7b9 +} http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/css/pages/topbar.less ---------------------------------------------------------------------- diff --git a/attachments/css/pages/topbar.less b/attachments/css/pages/topbar.less index d286bd8..904ab11 100644 --- a/attachments/css/pages/topbar.less +++ b/attachments/css/pages/topbar.less @@ -6,7 +6,7 @@ .topbar-search { height: 35px; - border: 2px solid #4cc2e4; + border: 1px solid #4cc2e4; } .topbar-button { http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/css/pages/viewAll.less ---------------------------------------------------------------------- diff --git a/attachments/css/pages/viewAll.less b/attachments/css/pages/viewAll.less index 49c759b..50274bf 100644 --- a/attachments/css/pages/viewAll.less +++ b/attachments/css/pages/viewAll.less @@ -1 +1,4 @@ -/* View all page styles */ \ No newline at end of file +/* View all page styles */ +.viewContainer { + padding-left:10px; +} http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/css/styles.css ---------------------------------------------------------------------- diff --git a/attachments/css/styles.css b/attachments/css/styles.css index 9182e9e..9785de7 100644 --- a/attachments/css/styles.css +++ b/attachments/css/styles.css @@ -2951,8 +2951,28 @@ div.left { margin-top: 20px; } /* Package Details styles */ +.space { + padding-top: 10px; + padding-bottom: 10px; + border-bottom: solid 2px #bfb7b9; +} +.toprow { + padding-top: 10px; +} /* View all page styles */ +.viewContainer { + padding-left: 10px; +} /* Search styles */ +.searchContainer { + padding-left: 10px; +} +.found { + font-size: 25px; + padding-top: 10px; + padding-bottom: 10px; + border-bottom: dotted 2px #bfb7b9; +} .topbar-row { padding-top: 5px; padding-bottom: 5px; @@ -2960,7 +2980,7 @@ div.left { } .topbar-search { height: 35px; - border: 2px solid #4cc2e4; + border: 1px solid #4cc2e4; } .topbar-button { background-color: #4cc2e4; @@ -2980,3 +3000,11 @@ div.left { font-size: 20px; padding-top: 5px; } +.pluginHeader { + border-bottom: solid 2px black; +} +.pluginItem { + border-bottom: solid 2px #bfb7b9; + padding-top: 10px; + padding-bottom: 10px; +} http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/css/styles.less ---------------------------------------------------------------------- diff --git a/attachments/css/styles.less b/attachments/css/styles.less index dab8b76..103614b 100644 --- a/attachments/css/styles.less +++ b/attachments/css/styles.less @@ -20,3 +20,4 @@ @import "pages/viewAll.less"; @import "pages/search.less"; @import "pages/topbar.less"; +@import "pages/pluginlist.less"; http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/index.html ---------------------------------------------------------------------- diff --git a/attachments/index.html b/attachments/index.html index 80cd27a..5d4b760 100644 --- a/attachments/index.html +++ b/attachments/index.html @@ -78,7 +78,8 @@ - + + http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/js/controllers/home.js ---------------------------------------------------------------------- diff --git a/attachments/js/controllers/home.js b/attachments/js/controllers/home.js index 93a0ae2..94b2ea9 100644 --- a/attachments/js/controllers/home.js +++ b/attachments/js/controllers/home.js @@ -9,7 +9,7 @@ angular.module('registry.controllers').controller('HomeController', ['$rootScope $scope.getMostDownloaded = function() { Downloads.getDownloads().then(function(obj){ - $scope.mostDownloaded = obj.slice(0, 9); + $scope.mostDownloaded = obj.arrData.slice(0, 9); }); }; http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/js/controllers/search.js ---------------------------------------------------------------------- diff --git a/attachments/js/controllers/search.js b/attachments/js/controllers/search.js index 7cb4fd1..87a51c4 100644 --- a/attachments/js/controllers/search.js +++ b/attachments/js/controllers/search.js @@ -1,38 +1,3 @@ -angular.module('registry.controllers').controller('SearchController', ['$rootScope', '$routeParams', '$scope', '$location', '$http', function($rootScope, $routeParams, $scope, $location, $http) { +angular.module('registry.controllers').controller('SearchController', ['$rootScope', function($rootScope) { - var results = []; - var currentSearch, currentTerms; - var searchResults = {}; - $scope.plugins = null; - $scope.searchText = ''; - - $scope.searchPlugins = function() { - //console.log($scope.searchText); - currentSearch = $scope.searchText.toLowerCase(); - currentTerms = currentSearch.trim().split(' '); - console.log(currentTerms); - - currentTerms.forEach(function(term){ - if(!searchResults[term]){ - $http.get('/_list/search/search?startkey='+JSON.stringify(term)+'&endkey='+JSON.stringify(term+'ZZZZZZZZZZZZZZ')+'&limit=25'). - success(function(data, status, headers, config){ - //console.log(data); - $scope.plugins = data.rows; - console.log($scope.plugins); - console.log($scope.plugins[0].value._id); - }). - error(function(data,status){ - console.log(data); - console.log(status); - }) - } - }) - } - - if ($routeParams.search){ - console.log($routeParams.search); - $scope.searchText = $routeParams.search; - $scope.searchPlugins(); - } - }]); http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/js/directives/pluginlist.js ---------------------------------------------------------------------- diff --git a/attachments/js/directives/pluginlist.js b/attachments/js/directives/pluginlist.js new file mode 100644 index 0000000..85bf4dd --- /dev/null +++ b/attachments/js/directives/pluginlist.js @@ -0,0 +1,13 @@ +angular.module('registry.controllers').directive('pluginlist', function () { + return { + restrict: 'E', + templateUrl: '/partials/directives/pluginlist.html', + controller:['$scope', '$rootScope', 'Downloads', function($scope, $rootScope, Downloads){ + Downloads.getDownloads().then(function(obj){ + $scope.downloads = obj.data; + }); + }], + link: function(scope, element, attrs, controller){ + } + }; +}); http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/js/directives/topbar.js ---------------------------------------------------------------------- diff --git a/attachments/js/directives/topbar.js b/attachments/js/directives/topbar.js index 705a550..8c99dbf 100644 --- a/attachments/js/directives/topbar.js +++ b/attachments/js/directives/topbar.js @@ -1,16 +1,47 @@ -angular.module('registry.controllers').directive('topbar', function ($http, $location, $window, $rootScope) { +angular.module('registry.controllers').directive('topbar', function ($http, $location, $window, $rootScope, $routeParams) { return { restrict: 'E', templateUrl: '/partials/directives/topbar.html', controller:['$scope', '$rootScope', function($scope, $rootScope){ - + var currentSearch, currentTerms; + var searchResults = {}; + $scope.plugins = []; + $scope.searchText = ''; + + $scope.search = function(evt) { + if($location.url().indexOf("search") != -1){ + currentSearch = $scope.searchText.toLowerCase(); + currentTerms = currentSearch.trim().split(' '); - $scope.search = function(evt){ - var currentSearch = encodeURIComponent($scope.searchText.toLowerCase()); - $window.location.href = '/#/search?search='+currentSearch; + //todo: add a short timeout to lower number of requests + currentTerms.forEach(function(term){ + if(!searchResults[term]){ + $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; + //todo: save this in session storage instead of object? + searchResults[term] = data.rows; + }). + error(function(data,status){ + console.log(data); + console.log(status); + }) + }else{ + $scope.plugins = searchResults[term]; + } + }) + }else{ + //check to see if user pressed enter or hit submit button + if ((evt.keyCode === 13) || evt.type === "submit" ){ + currentSearch = encodeURIComponent($scope.searchText.toLowerCase()); + //send to search page + $window.location.href = '/#/search?search='+currentSearch; + } + } } + $scope.getTotalPlugins = function(){ //todo: use sessionstorage or turn this into a service to cache results $http({method: 'GET', url:('/api/_all_docs?limit=0')}). @@ -26,6 +57,11 @@ angular.module('registry.controllers').directive('topbar', function ($http, $loc }; $scope.getTotalPlugins(); + + if($routeParams.search){ + $scope.searchText = $routeParams.search; + $scope.search(); + } }], link: function(scope, element, attrs, controller){ } http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/js/services.js ---------------------------------------------------------------------- diff --git a/attachments/js/services.js b/attachments/js/services.js index 2ad33f7..b7cea8c 100644 --- a/attachments/js/services.js +++ b/attachments/js/services.js @@ -30,7 +30,7 @@ service.factory('Downloads', function($http, $window, $q) { return 0; }); //$window.sessionStorage.setItem("Downloads", JSON.stringify(downloads)); - return downloads.arrData; + return downloads; }); } return promise; http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/partials/directives/pluginlist.html ---------------------------------------------------------------------- diff --git a/attachments/partials/directives/pluginlist.html b/attachments/partials/directives/pluginlist.html new file mode 100644 index 0000000..7cfa7a0 --- /dev/null +++ b/attachments/partials/directives/pluginlist.html @@ -0,0 +1,25 @@ +
+
+
+

Plugin ID & description

+
+
+

Version

+
+
+

Downloads

+
+
+
+
+ +
{{((plugin.value.description)||(plugin.doc.description))}}
+
+
+
{{((plugin.value['dist-tags'].latest)||(plugin.doc['dist-tags'].latest))}}
+
+
+
{{downloads[plugin.key]}}
+
+
+
http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/partials/directives/topbar.html ---------------------------------------------------------------------- diff --git a/attachments/partials/directives/topbar.html b/attachments/partials/directives/topbar.html index 8609d9a..ee5fa8e 100644 --- a/attachments/partials/directives/topbar.html +++ b/attachments/partials/directives/topbar.html @@ -1,8 +1,8 @@
-
+
- +
http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/partials/views/packageDetails.html ---------------------------------------------------------------------- diff --git a/attachments/partials/views/packageDetails.html b/attachments/partials/views/packageDetails.html index 36d0d57..19f97a3 100644 --- a/attachments/partials/views/packageDetails.html +++ b/attachments/partials/views/packageDetails.html @@ -1,33 +1,49 @@ -
Plugin ID
-
{{packageID}}
-
- -
-
Description
-
{{description}}
-
-
+
+
+
Plugin ID
+
+ +
-
- -
+
+
+
{{packageID}}
+
+
+
+
Description
+
+
+
{{description}}
+
+
-
-
Repository
- -
-
-
-
Issue tracker
- -
-
-
-
+
+
+
Repository
+
+
+ +
+
+ +
+
+
Issue tracker
+
+
+ +
+
+ +
+
Read Me
+
+
http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/partials/views/search.html ---------------------------------------------------------------------- diff --git a/attachments/partials/views/search.html b/attachments/partials/views/search.html index 1f977b2..d2ba32f 100644 --- a/attachments/partials/views/search.html +++ b/attachments/partials/views/search.html @@ -1,63 +1,19 @@ -
- -
-
- -
-
-
-
- - -
-
-
- -
-
-
- -
{{plugin.value.description}}
-
-
-
{{plugin.value['dist-tags'].latest}}
-
count
-
-
-
-
-
-
-
-

Plugin Name and Description

-
-
-

Version

-
-
-

Downloads

-
-
-
-
-

{{result.name}}

-
{{result.description}}
-
-
-

{{result.version}}

-
-
-

{{result.downloads}}

-
+ +
+
+
+ +
+ + + +
+ http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/074012f8/attachments/partials/views/viewAll.html ---------------------------------------------------------------------- diff --git a/attachments/partials/views/viewAll.html b/attachments/partials/views/viewAll.html index 6471fb3..8e7e654 100644 --- a/attachments/partials/views/viewAll.html +++ b/attachments/partials/views/viewAll.html @@ -1,25 +1,4 @@ -
-
-
-
Plugin ID and Description
-
-
Version
-
Downloads
-
-
-
-
-
-
- -
{{plugin.doc.description}}
-
-
-
{{plugin.doc['dist-tags'].latest}}
-
{{downloads[plugin.id]}}
-
-
-
-
-
+ +
+