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..f7e95ca3a --- /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()); + }; + } +}()); diff --git a/static/js/pages/repo-view.js b/static/js/pages/repo-view.js index f6056a019..1353f5b85 100644 --- a/static/js/pages/repo-view.js +++ b/static/js/pages/repo-view.js @@ -7,10 +7,10 @@ 'newLayout': true, 'title': '{{ namespace }}/{{ name }}', 'description': 'Repository {{ namespace }}/{{ name }}' - }) + }); }]); - 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,6 +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; // 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 @@ +