From 24327f4964b182d7b78374e573b565da8f3f0354 Mon Sep 17 00:00:00 2001 From: Ian Minoso Date: Tue, 20 Sep 2016 15:52:06 -0400 Subject: [PATCH 1/3] Add skeleton experiment for new repo page --- static/js/pages/repo-view.js | 5 +- static/partials/repo-view.html | 172 +++++++++++++++++---------------- 2 files changed, 93 insertions(+), 84 deletions(-) diff --git a/static/js/pages/repo-view.js b/static/js/pages/repo-view.js index f6056a019..542036a01 100644 --- a/static/js/pages/repo-view.js +++ b/static/js/pages/repo-view.js @@ -7,7 +7,7 @@ 'newLayout': true, 'title': '{{ namespace }}/{{ name }}', 'description': 'Repository {{ namespace }}/{{ name }}' - }) + }); }]); function RepoViewCtrl($scope, $routeParams, $location, $timeout, ApiService, UserService, AngularPollChannel, ImageLoaderService) { @@ -61,6 +61,9 @@ $scope.repository = repo; $scope.viewScope.repository = repo; + // Flag for new repo page experiment + $scope.newRepoExperiment = ($scope.repository.is_public && $scope.user.username != $scope.repository.namespace && $scope.publicRepoExperiment) ? true : false; + // Load the remainder of the data async, so we don't block the initial view from // showing. $timeout(function() { diff --git a/static/partials/repo-view.html b/static/partials/repo-view.html index e16ba85ed..cc9bf3b5a 100644 --- a/static/partials/repo-view.html +++ b/static/partials/repo-view.html @@ -2,102 +2,108 @@ resource="repositoryResource" error-message="'Repository not found'">
-
- - - Repositories - - - - - {{ namespace }} / {{ name }} - - + +
- -
-
- - + +
+
+ + + Repositories + - - - + + + {{ namespace }} / {{ name }} + +
- - - +
+
+ + + - - - + + + - - - - + + + - - - -
+ + + -
- -
-
-
+ + + + - -
-
-
+ + + +
- -
-
-
+
+ +
+
+
- -
-
-
+ +
+
+
- -
-
-
+ +
+
+
- -
-
-
-
+ +
+
+
+ + +
+
+
+ + +
+
+
+
+
From 4dd6166d21744ac03d1732cf1c62d59d0b5e23cb Mon Sep 17 00:00:00 2001 From: Ian Minoso Date: Tue, 20 Sep 2016 17:10:09 -0400 Subject: [PATCH 2/3] Add route and page to enable experiment --- static/js/app.js | 3 +++ static/js/pages/public-repo-exp.js | 19 +++++++++++++++++++ static/js/pages/repo-view.js | 5 +++-- static/partials/public-repo-exp.html | 10 ++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 static/js/pages/public-repo-exp.js create mode 100644 static/partials/public-repo-exp.html diff --git a/static/js/app.js b/static/js/app.js index a08e89d70..32626a6fd 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -204,6 +204,9 @@ quayApp.config(['$routeProvider', '$locationProvider', 'pages', function($routeP // Enterprise marketing page .route('/enterprise', 'enterprise') + // Public Repo Experiments + .route('/__exp/publicRepo', 'public-repo-exp') + // Default: Redirect to the landing page .otherwise({redirectTo: '/'}); }]); diff --git a/static/js/pages/public-repo-exp.js b/static/js/pages/public-repo-exp.js new file mode 100644 index 000000000..ddfd11a40 --- /dev/null +++ b/static/js/pages/public-repo-exp.js @@ -0,0 +1,19 @@ +(function() { + /** + * Experiment enable new public repo + */ + angular.module('quayPages').config(['pages', function(pages) { + pages.create('public-repo-exp', 'public-repo-exp.html', ExpCtrl, { + 'newLayout': true + }); + }]); + + function ExpCtrl($scope, CookieService) { + $scope.isEnabled = CookieService.get('quay.public-repo-exp') == 'true'; + + $scope.setEnabled = function(value) { + $scope.isEnabled = value; + CookieService.putPermanent('quay.public-repo-exp', value.toString()); + }; + } +}()); \ No newline at end of file diff --git a/static/js/pages/repo-view.js b/static/js/pages/repo-view.js index 542036a01..1353f5b85 100644 --- a/static/js/pages/repo-view.js +++ b/static/js/pages/repo-view.js @@ -10,7 +10,7 @@ }); }]); - function RepoViewCtrl($scope, $routeParams, $location, $timeout, ApiService, UserService, AngularPollChannel, ImageLoaderService) { + function RepoViewCtrl($scope, $routeParams, $location, $timeout, ApiService, UserService, AngularPollChannel, ImageLoaderService, CookieService) { $scope.namespace = $routeParams.namespace; $scope.name = $routeParams.name; @@ -60,9 +60,10 @@ $scope.repositoryResource = ApiService.getRepoAsResource(params).get(function(repo) { $scope.repository = repo; $scope.viewScope.repository = repo; + $scope.publicRepoExperiment = CookieService.get('quay.public-repo-exp') == 'true'; // Flag for new repo page experiment - $scope.newRepoExperiment = ($scope.repository.is_public && $scope.user.username != $scope.repository.namespace && $scope.publicRepoExperiment) ? true : false; + $scope.newRepoExperiment = $scope.repository.is_public && $scope.user.username != $scope.repository.namespace && $scope.publicRepoExperiment; // Load the remainder of the data async, so we don't block the initial view from // showing. diff --git a/static/partials/public-repo-exp.html b/static/partials/public-repo-exp.html new file mode 100644 index 000000000..6e53f4f24 --- /dev/null +++ b/static/partials/public-repo-exp.html @@ -0,0 +1,10 @@ +
+
+ + Experiment: New Public Repo Page Layout +
+
+ + +
+
From fe05011e306eda4e409b9575f113952a2c4f4aed Mon Sep 17 00:00:00 2001 From: Ian Minoso Date: Tue, 20 Sep 2016 17:27:48 -0400 Subject: [PATCH 3/3] Add the missing newline --- static/js/pages/public-repo-exp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/pages/public-repo-exp.js b/static/js/pages/public-repo-exp.js index ddfd11a40..f7e95ca3a 100644 --- a/static/js/pages/public-repo-exp.js +++ b/static/js/pages/public-repo-exp.js @@ -16,4 +16,4 @@ CookieService.putPermanent('quay.public-repo-exp', value.toString()); }; } -}()); \ No newline at end of file +}());