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/01/23 02:48:08 UTC
git commit: CB-5881: got multiple version switching to work
Updated Branches:
refs/heads/refactor 0e6564036 -> a534c3eb4
CB-5881: got multiple version switching to work
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/a534c3eb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/tree/a534c3eb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/diff/a534c3eb
Branch: refs/heads/refactor
Commit: a534c3eb4e6a63a886ae4f99c97da86a62a8e748
Parents: 0e65640
Author: Steven Gill <st...@gmail.com>
Authored: Wed Jan 22 17:48:00 2014 -0800
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Jan 22 17:48:00 2014 -0800
----------------------------------------------------------------------
attachments/js/controllers/packageDetails.js | 30 ++++++++++++++++++---
attachments/partials/views/packageDetails.html | 23 ++++++++++++++--
2 files changed, 47 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/a534c3eb/attachments/js/controllers/packageDetails.js
----------------------------------------------------------------------
diff --git a/attachments/js/controllers/packageDetails.js b/attachments/js/controllers/packageDetails.js
index 0329cc1..49cb5b5 100644
--- a/attachments/js/controllers/packageDetails.js
+++ b/attachments/js/controllers/packageDetails.js
@@ -1,18 +1,19 @@
angular.module('registry.controllers').controller('PackageDetailsController', ['$rootScope', '$scope', '$location', '$routeParams', '$http', function($rootScope, $scope, $location, $routeParams, $http)
{
- console.log(marked('im using marked'));
$scope.packageID = $routeParams.id
$scope.description = null;
- $scope.version = null;
+ $scope.versions = null;
$scope.maintainers = null;
$scope.repo = null;
- $scope.issues = null;
+ $scope.issue = null;
$scope.keywords = null;
$scope.readme = null;
$scope.license = null;
$scope.engine = null;
$scope.lastupdated = null;
$scope.downloads = null;
+ $scope.latestVersion = null;
+ $scope.currentVersion = "0.2.6";
$scope.getPackage = function(){
console.log($scope.packageID);
@@ -20,8 +21,14 @@ angular.module('registry.controllers').controller('PackageDetailsController', ['
success(function(data, status, headers, config) {
$scope.data = data;
$scope.description = $scope.data.description;
+ $scope.latestVersion = $scope.data['dist-tags'].latest;
+ $scope.currentVersion = $scope.latestVersion;
+ $scope.issue = $scope.data.versions[$scope.currentVersion].issue;
+ $scope.repo = $scope.data.versions[$scope.currentVersion].repo;
+ $scope.versions = $scope.data.versions;
+ console.log(data);
+ console.log($scope.versions);
$scope.readme = marked($scope.data.readme);
- console.log(data);
}).
error(function(data, status){
if (status === 404){
@@ -32,4 +39,19 @@ angular.module('registry.controllers').controller('PackageDetailsController', ['
}
$scope.getPackage();
+
+ $scope.$watch('currentVersion', function(){
+ if($scope.versions){
+ $scope.readme = marked($scope.versions[$scope.currentVersion].readme);
+ $scope.issue = $scope.data.versions[$scope.currentVersion].issue;
+ $scope.repo = $scope.data.versions[$scope.currentVersion].repo;
+ $scope.description = $scope.data.versions[$scope.currentVersion].description;
+ if($scope.currentVersion === $scope.latestVersion){
+ $scope.packageID = $routeParams.id
+ }else{
+ $scope.packageID = $scope.data.versions[$scope.currentVersion]._id;
+ }
+ }
+ });
+
}]);
http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/a534c3eb/attachments/partials/views/packageDetails.html
----------------------------------------------------------------------
diff --git a/attachments/partials/views/packageDetails.html b/attachments/partials/views/packageDetails.html
index d87794e..36d0d57 100644
--- a/attachments/partials/views/packageDetails.html
+++ b/attachments/partials/views/packageDetails.html
@@ -4,11 +4,30 @@
<div ng-show="description">
<div class="package-label">Description</div>
- <div class="package-title" ng-model="description">{{description}}</div>
+ <div class="package-title">{{description}}</div>
<div class="spacer"></div>
</div>
-<div ng-show="readme">
+<div>
+ <select ng-model="currentVersion" ng-options="key as key for (key, value) in versions">
+ <option value="{{currentVersion}}">{{currentVersion}}</option>
+ </select>
+</div>
+
+
+<div ng-show="repo">
+ <div class="package-label">Repository</div>
+ <div class="package-title"><a href={{repo}}>{{repo}}</a></div>
+ <div class="spacer"></div>
+</div>
+
+<div ng-show="issue">
+ <div class="package-label">Issue tracker</div>
+ <div class="package-title"><a href={{issue}}>{{issue}}</a></div>
+ <div class="spacer"></div>
+</div>
+
+<div ng-show="readme">
<div class="package-readme" ng-bind-html="readme"></div>
</div>