- Add some more analytics events

- Enable business features for personal users on business plans
- Fix a bug in the credit card image view
This commit is contained in:
Joseph Schorr 2013-12-20 22:38:53 -05:00
parent 8bfc0ac48d
commit c20e7dbcf7
10 changed files with 241 additions and 121 deletions

View file

@ -969,6 +969,59 @@ quayApp.filter('visibleLogFilter', function () {
});
quayApp.directive('billingInvoices', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/billing-invoices.html',
replace: false,
transclude: false,
restrict: 'C',
scope: {
'organization': '=organization',
'user': '=user',
'visible': '=visible'
},
controller: function($scope, $element, $sce, Restangular) {
$scope.loading = false;
$scope.invoiceExpanded = {};
$scope.toggleInvoice = function(id) {
$scope.invoiceExpanded[id] = !$scope.invoiceExpanded[id];
};
var update = function() {
var hasValidUser = !!$scope.user;
var hasValidOrg = !!$scope.organization;
var isValid = hasValidUser || hasValidOrg;
if (!$scope.visible || !isValid) {
return;
}
$scope.loading = true;
var url = getRestUrl('user/invoices');
if ($scope.organization) {
url = getRestUrl('organization', $scope.organization.name, 'invoices');
}
var getInvoices = Restangular.one(url);
getInvoices.get().then(function(resp) {
$scope.invoices = resp.invoices;
$scope.loading = false;
});
};
$scope.$watch('organization', update);
$scope.$watch('user', update);
$scope.$watch('visible', update);
}
};
return directiveDefinitionObject;
});
quayApp.directive('logsView', function () {
var directiveDefinitionObject = {
priority: 0,
@ -2112,15 +2165,27 @@ quayApp.run(['$location', '$rootScope', 'Restangular', 'UserService', 'PlanServi
// Check if we need to redirect based on a previously chosen plan.
PlanService.handleNotedPlan();
var changeTab = function(activeTab) {
var changeTab = function(activeTab, opt_timeout) {
var checkCount = 0;
$timeout(function() {
if (checkCount > 5) { return; }
checkCount++;
$('a[data-toggle="tab"]').each(function(index) {
var tabName = this.getAttribute('data-target').substr(1);
if (tabName == activeTab) {
this.click();
if (tabName != activeTab) {
return;
}
if (this.clientWidth == 0) {
changeTab(activeTab, 500);
return;
}
this.click();
});
});
}, opt_timeout);
};
var resetDefaultTab = function() {