AngularJS minify compatible

This commit is contained in:
Josh Matz
2013-04-22 20:58:18 -05:00
parent db53da7110
commit d36a7240bf
4 changed files with 125 additions and 113 deletions

View File

@@ -16,8 +16,8 @@ module.run(function($rootScope) {
});
});
module.controller('SubscribeCtrl', function($scope, FeedService,
CategoryService) {
module.controller('SubscribeCtrl', ['$scope', 'FeedService', 'CategoryService',
function($scope, FeedService, CategoryService) {
$scope.opts = {
backdropFade : true,
@@ -87,10 +87,12 @@ module.controller('SubscribeCtrl', function($scope, FeedService,
CategoryService.add($scope.cat);
$scope.closeCategory();
};
});
}]);
module.controller('CategoryTreeCtrl', function($scope, $timeout, $stateParams,
$window, $location, $state, $route, CategoryService) {
module.controller('CategoryTreeCtrl', ['$scope', '$timeout', '$stateParams', '$window',
'$location', '$state', '$route', 'CategoryService',
function($scope, $timeout, $stateParams,
$window, $location, $state, $route, CategoryService) {
$scope.selectedType = $stateParams._type;
$scope.selectedId = $stateParams._id;
@@ -197,86 +199,89 @@ module.controller('CategoryTreeCtrl', function($scope, $timeout, $stateParams,
$scope.$on('mark', function(event, args) {
mark($scope.CategoryService.subscriptions, args.entry);
});
});
}]);
module.controller('ToolbarCtrl',
function($scope, $http, $state, $stateParams, $route, $location,
SettingsService, EntryService, ProfileService) {
module.controller('ToolbarCtrl', ['$scope', '$http', '$state', '$stateParams',
'$route', '$location', 'SettingsService', 'EntryService', 'ProfileService',
function($scope, $http, $state, $stateParams, $route, $location,
SettingsService, EntryService, ProfileService) {
function totalActiveAjaxRequests() {
return ($http.pendingRequests.length + $.active);
}
function totalActiveAjaxRequests() {
return ($http.pendingRequests.length + $.active);
}
$scope.session = ProfileService.get();
$scope.session = ProfileService.get();
$scope.loading = true;
$scope.$watch(totalActiveAjaxRequests, function() {
$scope.loading = (totalActiveAjaxRequests() !== 0);
});
$scope.loading = true;
$scope.$watch(totalActiveAjaxRequests, function() {
$scope.loading = (totalActiveAjaxRequests() !== 0);
});
$scope.settingsService = SettingsService;
$scope.$watch('settingsService.settings.readingMode', function(
newValue, oldValue) {
if (newValue && oldValue && newValue != oldValue) {
SettingsService.save();
}
});
$scope.$watch('settingsService.settings.readingOrder', function(
newValue, oldValue) {
if (newValue && oldValue && newValue != oldValue) {
SettingsService.save();
}
});
$scope.refresh = function() {
$scope.$emit('emitReload');
};
$scope.markAllAsRead = function() {
$scope.$emit('emitMarkAll', {
type : $stateParams._type,
id : $stateParams._id,
read : true
});
};
$scope.keywords = $stateParams._keywords;
$scope.search = function() {
if ($scope.keywords == $stateParams._keywords) {
$scope.refresh();
} else {
$state.transitionTo('feeds.search', {
_keywords : $scope.keywords
});
}
};
$scope.showButtons = function() {
return !$stateParams._keywords;
};
$scope.toggleOrder = function() {
var settings = $scope.settingsService.settings;
settings.readingOrder = settings.readingOrder == 'asc' ? 'desc'
: 'asc';
};
$scope.toAdmin = function() {
$location.path('admin');
};
$scope.toSettings = function() {
$location.path('settings');
};
$scope.toProfile = function() {
$location.path('profile');
};
$scope.toHelp = function() {
$state.transitionTo('feeds.help');
};
$scope.toDonate = function() {
$state.transitionTo('feeds.help');
};
$scope.settingsService = SettingsService;
$scope.$watch('settingsService.settings.readingMode', function(
newValue, oldValue) {
if (newValue && oldValue && newValue != oldValue) {
SettingsService.save();
}
});
$scope.$watch('settingsService.settings.readingOrder', function(
newValue, oldValue) {
if (newValue && oldValue && newValue != oldValue) {
SettingsService.save();
}
});
$scope.refresh = function() {
$scope.$emit('emitReload');
};
$scope.markAllAsRead = function() {
$scope.$emit('emitMarkAll', {
type : $stateParams._type,
id : $stateParams._id,
read : true
});
};
module.controller('FeedListCtrl', function($scope, $stateParams, $http, $route,
$window, EntryService, SettingsService, FeedService, CategoryService) {
$scope.keywords = $stateParams._keywords;
$scope.search = function() {
if ($scope.keywords == $stateParams._keywords) {
$scope.refresh();
} else {
$state.transitionTo('feeds.search', {
_keywords : $scope.keywords
});
}
};
$scope.showButtons = function() {
return !$stateParams._keywords;
};
$scope.toggleOrder = function() {
var settings = $scope.settingsService.settings;
settings.readingOrder = settings.readingOrder == 'asc' ? 'desc'
: 'asc';
};
$scope.toAdmin = function() {
$location.path('admin');
};
$scope.toSettings = function() {
$location.path('settings');
};
$scope.toProfile = function() {
$location.path('profile');
};
$scope.toHelp = function() {
$state.transitionTo('feeds.help');
};
$scope.toDonate = function() {
$state.transitionTo('feeds.help');
};
}]);
module.controller('FeedListCtrl', ['$scope', '$stateParams', '$http', '$route',
'$window', 'EntryService', 'SettingsService', 'FeedService', 'CategoryService',
function($scope, $stateParams, $http, $route,
$window, EntryService, SettingsService, FeedService, CategoryService) {
$scope.selectedType = $stateParams._type;
$scope.selectedId = $stateParams._id;
@@ -506,9 +511,10 @@ module.controller('FeedListCtrl', function($scope, $stateParams, $http, $route,
$scope.hasMore = true;
$scope.loadMoreEntries();
});
});
}]);
module.controller('ManageUsersCtrl', function($scope, $state, $location,
module.controller('ManageUsersCtrl', ['$scope', '$state', '$location',
function($scope, $state, $location,
AdminUsersService) {
$scope.users = AdminUsersService.getAll();
$scope.selection = [];
@@ -529,9 +535,10 @@ module.controller('ManageUsersCtrl', function($scope, $state, $location,
$scope.back = function() {
$location.path('/admin');
};
});
}]);
module.controller('ManageUserCtrl', function($scope, $state, $stateParams,
module.controller('ManageUserCtrl', ['$scope', '$state', '$stateParams', '$dialog', 'AdminUsersService',
function($scope, $state, $stateParams,
$dialog, AdminUsersService) {
$scope.user = $stateParams._id ? AdminUsersService.get({
id : $stateParams._id
@@ -580,9 +587,10 @@ module.controller('ManageUserCtrl', function($scope, $state, $stateParams,
}
});
};
});
}]);
module.controller('SettingsCtrl', function($scope, $location, SettingsService) {
module.controller('SettingsCtrl', ['$scope', '$location', 'SettingsService',
function($scope, $location, SettingsService) {
$scope.settingsService = SettingsService;
$scope.$watch('settingsService.settings', function(value) {
$scope.settings = angular.copy(value);
@@ -599,9 +607,10 @@ module.controller('SettingsCtrl', function($scope, $location, SettingsService) {
$location.path('/');
});
};
});
}]);
module.controller('ProfileCtrl', function($scope, $location, ProfileService) {
module.controller('ProfileCtrl', ['$scope', '$location', 'ProfileService',
function($scope, $location, ProfileService) {
$scope.user = ProfileService.get();
$scope.cancel = function() {
@@ -621,9 +630,10 @@ module.controller('ProfileCtrl', function($scope, $location, ProfileService) {
});
};
});
}]);
module.controller('ManageSettingsCtrl', function($scope, $location, $state,
module.controller('ManageSettingsCtrl', ['$scope', '$location', '$state',
function($scope, $location, $state,
AdminSettingsService) {
$scope.settings = AdminSettingsService.get();
@@ -640,4 +650,4 @@ module.controller('ManageSettingsCtrl', function($scope, $location, $state,
$scope.toUsers = function() {
$state.transitionTo('admin.userlist');
};
});
}]);