// Register any plugin code. $.fn.spin = function(opts) { this.each(function() { var $this = $(this), spinner = $this.data('spinner'); if (spinner) spinner.stop(); if (opts !== false) { options = { color: $this.css('color') || '#000', lines: 12, // The number of lines to draw length: 7, // The length of each line width: 4, // The line thickness radius: 10, // The radius of the inner circle speed: 1, // Rounds per second trail: 100, // Afterglow percentage shadow: false // Whether to render a shadow }; opts = $.extend(options, opts); spinner = new Spinner(opts).spin(this); $this.data('spinner', spinner); } }); return this; }; // Start the application code itself. quayApp = angular.module('quay', ['restangular', 'angularMoment'], function($provide) { $provide.factory('UserService', ['Restangular', function(Restangular) { var userResponse = { verified: false, anonymous: true, username: null, email: null } var userService = {} userService.load = function() { var userFetch = Restangular.one('user/'); userFetch.get().then(function(loadedUser) { userResponse = loadedUser; }); }; userService.currentUser = function() { return userResponse; } // Load the user the first time. userService.load(); return userService; }]) }). directive('match', function($parse) { return { require: 'ngModel', link: function(scope, elem, attrs, ctrl) { scope.$watch(function() { return $parse(attrs.match)(scope) === ctrl.$modelValue; }, function(currentValue) { ctrl.$setValidity('mismatch', currentValue); }); } }; }). config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $routeProvider. when('/repository/:namespace/:name', {templateUrl: '/static/partials/view-repo.html', controller: RepoCtrl}). when('/repository/:namespace/:name/tag/:tag', {templateUrl: '/static/partials/view-repo.html', controller: RepoCtrl}). when('/repository/:namespace/:name/admin', {templateUrl: '/static/partials/repo-admin.html', controller:RepoAdminCtrl}). when('/repository/', {title: 'Repositories', templateUrl: '/static/partials/repo-list.html', controller: RepoListCtrl}). when('/', {title: 'Quay', templateUrl: '/static/partials/landing.html', controller: LandingCtrl}). otherwise({redirectTo: '/'}); }]). config(function(RestangularProvider) { RestangularProvider.setBaseUrl('/api/'); }); quayApp.run(['$location', '$rootScope', function($location, $rootScope) { $rootScope.$on('$routeChangeSuccess', function (event, current, previous) { if (current.$$route.title) { $rootScope.title = current.$$route.title; } }); }]);