Add route and page to enable experiment
This commit is contained in:
parent
24327f4964
commit
4dd6166d21
4 changed files with 35 additions and 2 deletions
|
@ -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: '/'});
|
||||
}]);
|
||||
|
|
19
static/js/pages/public-repo-exp.js
Normal file
19
static/js/pages/public-repo-exp.js
Normal file
|
@ -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());
|
||||
};
|
||||
}
|
||||
}());
|
|
@ -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.
|
||||
|
|
10
static/partials/public-repo-exp.html
Normal file
10
static/partials/public-repo-exp.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<div class="page-content">
|
||||
<div class="cor-title">
|
||||
<span class="cor-title-link"></span>
|
||||
<span class="cor-title-content">Experiment: New Public Repo Page Layout</span>
|
||||
</div>
|
||||
<div class="co-main-content-panel">
|
||||
<button class="btn btn-success" ng-if="!isEnabled" ng-click="setEnabled(true)">Enable Experiment</button>
|
||||
<button class="btn btn-failure" ng-if="isEnabled" ng-click="setEnabled(false)">Disable Experiment</button>
|
||||
</div>
|
||||
</div>
|
Reference in a new issue