Format all JavaScript functions in same syntax.

Required for use minified js code in production mode.
This commit is contained in:
Emanuel Schuetze 2016-01-17 21:16:04 +01:00
parent 0e24d9b632
commit 851252dfe8
12 changed files with 1055 additions and 892 deletions

View File

@ -4,19 +4,26 @@
angular.module('OpenSlidesApp.assignments.projector', ['OpenSlidesApp.assignments']) angular.module('OpenSlidesApp.assignments.projector', ['OpenSlidesApp.assignments'])
.config(function(slidesProvider) { .config([
'slidesProvider',
function(slidesProvider) {
slidesProvider.registerSlide('assignments/assignment', { slidesProvider.registerSlide('assignments/assignment', {
template: 'static/templates/assignments/slide_assignment.html', template: 'static/templates/assignments/slide_assignment.html',
}); });
}) }
])
.controller('SlideAssignmentCtrl', function($scope, Assignment) { .controller('SlideAssignmentCtrl', [
'$scope',
'Assignment',
function($scope, Assignment) {
// Attention! Each object that is used here has to be dealt on server side. // Attention! Each object that is used here has to be dealt on server side.
// Add it to the coresponding get_requirements method of the ProjectorElement // Add it to the coresponding get_requirements method of the ProjectorElement
// class. // class.
var id = $scope.element.id; var id = $scope.element.id;
Assignment.find(id); Assignment.find(id);
Assignment.bindOne(id, $scope, 'assignment'); Assignment.bindOne(id, $scope, 'assignment');
}); }
]);
}()); }());

View File

@ -18,7 +18,9 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
} }
]) ])
.config(function($stateProvider) { .config([
'$stateProvider',
function($stateProvider) {
$stateProvider $stateProvider
.state('assignments', { .state('assignments', {
url: '/assignments', url: '/assignments',
@ -74,7 +76,8 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
} }
] ]
}); });
}) }
])
// Service for generic assignment form (create and update) // Service for generic assignment form (create and update)
.factory('AssignmentForm', [ .factory('AssignmentForm', [

View File

@ -12,7 +12,10 @@ angular.module('OpenSlidesApp.core', [
'ui.tree', 'ui.tree',
]) ])
.config(['DSProvider', 'DSHttpAdapterProvider', function(DSProvider, DSHttpAdapterProvider) { .config([
'DSProvider',
'DSHttpAdapterProvider',
function(DSProvider, DSHttpAdapterProvider) {
// Reloads everything after 5 minutes. // Reloads everything after 5 minutes.
// TODO: * find a way only to reload things that are still needed // TODO: * find a way only to reload things that are still needed
DSProvider.defaults.maxAge = 5 * 60 * 1000; // 5 minutes DSProvider.defaults.maxAge = 5 * 60 * 1000; // 5 minutes
@ -28,7 +31,8 @@ angular.module('OpenSlidesApp.core', [
} }
}; };
DSHttpAdapterProvider.defaults.forceTrailingSlash = true; DSHttpAdapterProvider.defaults.forceTrailingSlash = true;
}]) }
])
.factory('autoupdate', [ .factory('autoupdate', [
'DS', 'DS',
@ -129,7 +133,10 @@ angular.module('OpenSlidesApp.core', [
} }
]) ])
.run(['DS', 'autoupdate', function(DS, autoupdate) { .run([
'DS',
'autoupdate',
function(DS, autoupdate) {
autoupdate.on_message(function(data) { autoupdate.on_message(function(data) {
// TODO: when MODEL.find() is called after this // TODO: when MODEL.find() is called after this
// a new request is fired. This could be a bug in DS // a new request is fired. This could be a bug in DS
@ -145,7 +152,8 @@ angular.module('OpenSlidesApp.core', [
} }
// TODO: handle other statuscodes // TODO: handle other statuscodes
}); });
}]) }
])
.factory('loadGlobalData', [ .factory('loadGlobalData', [
'$rootScope', '$rootScope',
@ -310,12 +318,15 @@ angular.module('OpenSlidesApp.core', [
* be removed. See http://www.js-data.io/docs/dsdefaults#onconflict for * be removed. See http://www.js-data.io/docs/dsdefaults#onconflict for
* more information. * more information.
*/ */
.factory('Projector', ['DS', function(DS) { .factory('Projector', [
'DS',
function(DS) {
return DS.defineResource({ return DS.defineResource({
name: 'core/projector', name: 'core/projector',
onConflict: 'replace', onConflict: 'replace',
}); });
}]) }
])
/* Converts number of seconds into string "hh:mm:ss" or "mm:ss" */ /* Converts number of seconds into string "hh:mm:ss" or "mm:ss" */
.filter('osSecondsToTime', [ .filter('osSecondsToTime', [

View File

@ -6,7 +6,8 @@
angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core']) angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
// Provider to register slides in a .config() statement. // Provider to register slides in a .config() statement.
.provider('slides', function() { .provider('slides', [
function() {
var slidesMap = {}; var slidesMap = {};
this.registerSlide = function(name, config) { this.registerSlide = function(name, config) {
@ -32,9 +33,12 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
} }
}; };
}; };
}) }
])
.config(function(slidesProvider) { .config([
'slidesProvider',
function(slidesProvider) {
slidesProvider.registerSlide('core/customslide', { slidesProvider.registerSlide('core/customslide', {
template: 'static/templates/core/slide_customslide.html', template: 'static/templates/core/slide_customslide.html',
}); });
@ -50,9 +54,14 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
slidesProvider.registerSlide('core/message', { slidesProvider.registerSlide('core/message', {
template: 'static/templates/core/slide_message.html', template: 'static/templates/core/slide_message.html',
}); });
}) }
])
.controller('ProjectorCtrl', function($scope, Projector, slides) { .controller('ProjectorCtrl', [
'$scope',
'Projector',
'slides',
function($scope, Projector, slides) {
Projector.find(1).then(function() { Projector.find(1).then(function() {
$scope.$watch(function () { $scope.$watch(function () {
return Projector.lastModified(1); return Projector.lastModified(1);
@ -69,7 +78,8 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
$scope.scale = 100 + 20 * Projector.get(1).scale; $scope.scale = 100 + 20 * Projector.get(1).scale;
}); });
}); });
}) }
])
.controller('SlideCustomSlideCtrl', [ .controller('SlideCustomSlideCtrl', [
'$scope', '$scope',

View File

@ -84,23 +84,36 @@ angular.module('OpenSlidesApp.core.site', [
} }
]) ])
.config(function($urlRouterProvider, $locationProvider) { .config([
'$urlRouterProvider',
'$locationProvider',
function($urlRouterProvider, $locationProvider) {
// define fallback url and html5Mode // define fallback url and html5Mode
$urlRouterProvider.otherwise('/'); $urlRouterProvider.otherwise('/');
$locationProvider.html5Mode(true); $locationProvider.html5Mode(true);
}) }
])
.config(function($httpProvider) { .config([
'$httpProvider',
function($httpProvider) {
// Combine the django csrf system with the angular csrf system // Combine the django csrf system with the angular csrf system
$httpProvider.defaults.xsrfCookieName = 'csrftoken'; $httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'; $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
}) }
])
.config(function(uiSelectConfig) { .config([
'uiSelectConfig',
function(uiSelectConfig) {
uiSelectConfig.theme = 'bootstrap'; uiSelectConfig.theme = 'bootstrap';
}) }
])
.config(function($stateProvider, $urlMatcherFactoryProvider) { .config([
'$stateProvider',
'$urlMatcherFactoryProvider',
function($stateProvider, $urlMatcherFactoryProvider) {
// Make the trailing slash optional // Make the trailing slash optional
$urlMatcherFactoryProvider.strictMode(false); $urlMatcherFactoryProvider.strictMode(false);
@ -171,9 +184,13 @@ angular.module('OpenSlidesApp.core.site', [
state.url = state.url || defaultUrl; state.url = state.url || defaultUrl;
return parent(state); return parent(state);
}); });
}) }
])
.config(function($stateProvider, $locationProvider) { .config([
'$stateProvider',
'$locationProvider',
function($stateProvider, $locationProvider) {
// Core urls // Core urls
$stateProvider $stateProvider
.state('dashboard', { .state('dashboard', {
@ -269,11 +286,14 @@ angular.module('OpenSlidesApp.core.site', [
}); });
$locationProvider.html5Mode(true); $locationProvider.html5Mode(true);
}) }
])
// Helper to add ui.router states at runtime. // Helper to add ui.router states at runtime.
// Needed for the django url_patterns. // Needed for the django url_patterns.
.provider('runtimeStates', function($stateProvider) { .provider('runtimeStates', [
'$stateProvider',
function($stateProvider) {
this.$get = function($q, $timeout, $state) { this.$get = function($q, $timeout, $state) {
return { return {
addState: function(name, state) { addState: function(name, state) {
@ -281,10 +301,14 @@ angular.module('OpenSlidesApp.core.site', [
} }
}; };
}; };
}) }
])
// Load the django url patterns // Load the django url patterns
.run(function(runtimeStates, $http) { .run([
'runtimeStates',
'$http',
function(runtimeStates, $http) {
$http.get('/core/url_patterns/').then(function(data) { $http.get('/core/url_patterns/').then(function(data) {
for (var pattern in data.data) { for (var pattern in data.data) {
runtimeStates.addState(pattern, { runtimeStates.addState(pattern, {
@ -296,7 +320,8 @@ angular.module('OpenSlidesApp.core.site', [
}); });
} }
}); });
}) }
])
// angular formly config options // angular formly config options
.run([ .run([
@ -321,7 +346,10 @@ angular.module('OpenSlidesApp.core.site', [
// html-tag os-form-field to generate generic from fields // html-tag os-form-field to generate generic from fields
// TODO: make it possible to use other fields then config fields // TODO: make it possible to use other fields then config fields
.directive('osFormField', function($parse, Config) { .directive('osFormField', [
'$parse',
'Config',
function($parse, Config) {
function getHtmlType(type) { function getHtmlType(type) {
return { return {
string: 'text', string: 'text',
@ -354,9 +382,10 @@ angular.module('OpenSlidesApp.core.site', [
} }
} }
}; };
}) }
])
.controller("MainMenuCtrl", [ .controller('MainMenuCtrl', [
'$scope', '$scope',
'mainMenu', 'mainMenu',
function ($scope, mainMenu) { function ($scope, mainMenu) {
@ -364,7 +393,12 @@ angular.module('OpenSlidesApp.core.site', [
} }
]) ])
.controller("LanguageCtrl", function ($scope, gettextCatalog, Languages, filterFilter) { .controller('LanguageCtrl', [
'$scope',
'gettextCatalog',
'Languages',
'filterFilter',
function ($scope, gettextCatalog, Languages, filterFilter) {
$scope.languages = Languages.getLanguages(); $scope.languages = Languages.getLanguages();
$scope.selectedLanguage = filterFilter($scope.languages, {selected: true}); $scope.selectedLanguage = filterFilter($scope.languages, {selected: true});
// controller to switch app language // controller to switch app language
@ -372,7 +406,8 @@ angular.module('OpenSlidesApp.core.site', [
$scope.languages = Languages.setCurrentLanguage(lang); $scope.languages = Languages.setCurrentLanguage(lang);
$scope.selectedLanguage = filterFilter($scope.languages, {selected: true}); $scope.selectedLanguage = filterFilter($scope.languages, {selected: true});
}; };
}) }
])
// Projector Sidebar Controller // Projector Sidebar Controller
.controller('ProjectorSidebarCtrl', [ .controller('ProjectorSidebarCtrl', [
@ -398,7 +433,11 @@ angular.module('OpenSlidesApp.core.site', [
]) ])
// Config Controller // Config Controller
.controller('ConfigCtrl', function($scope, Config, configOption) { .controller('ConfigCtrl', [
'$scope',
'Config',
'configOption',
function($scope, Config, configOption) {
Config.bindAll({}, $scope, 'configs'); Config.bindAll({}, $scope, 'configs');
$scope.configGroups = configOption.data.config_groups; $scope.configGroups = configOption.data.config_groups;
@ -407,7 +446,8 @@ angular.module('OpenSlidesApp.core.site', [
Config.get(key).value = value; Config.get(key).value = value;
Config.save(key); Config.save(key);
}; };
}) }
])
// Provide generic customslide form fields for create and update view // Provide generic customslide form fields for create and update view
@ -744,7 +784,10 @@ angular.module('OpenSlidesApp.core.site', [
]) ])
// Tag Controller // Tag Controller
.controller('TagListCtrl', function($scope, Tag) { .controller('TagListCtrl', [
'$scope',
'Tag',
function($scope, Tag) {
Tag.bindAll({}, $scope, 'tags'); Tag.bindAll({}, $scope, 'tags');
// setup table sorting // setup table sorting
@ -769,13 +812,23 @@ angular.module('OpenSlidesApp.core.site', [
} }
); );
}; };
}) }
])
.controller('TagDetailCtrl', function($scope, Tag, tag) { .controller('TagDetailCtrl', [
'$scope',
'Tag',
'tag',
function($scope, Tag, tag) {
Tag.bindOne(tag.id, $scope, 'tag'); Tag.bindOne(tag.id, $scope, 'tag');
}) }
])
.controller('TagCreateCtrl', function($scope, $state, Tag) { .controller('TagCreateCtrl', [
'$scope',
'$state',
'Tag',
function($scope, $state, Tag) {
$scope.tag = {}; $scope.tag = {};
$scope.save = function (tag) { $scope.save = function (tag) {
Tag.create(tag).then( Tag.create(tag).then(
@ -784,9 +837,15 @@ angular.module('OpenSlidesApp.core.site', [
} }
); );
}; };
}) }
])
.controller('TagUpdateCtrl', function($scope, $state, Tag, tag) { .controller('TagUpdateCtrl', [
'$scope',
'$state',
'Tag',
'tag',
function($scope, $state, Tag, tag) {
$scope.tag = tag; $scope.tag = tag;
$scope.save = function (tag) { $scope.save = function (tag) {
Tag.save(tag).then( Tag.save(tag).then(
@ -795,7 +854,8 @@ angular.module('OpenSlidesApp.core.site', [
} }
); );
}; };
}) }
])
// counter of new (unread) chat messages // counter of new (unread) chat messages
.value('NewChatMessages', []) .value('NewChatMessages', [])
@ -846,7 +906,9 @@ angular.module('OpenSlidesApp.core.site', [
} }
]) ])
.directive('osFocusMe', function ($timeout) { .directive('osFocusMe', [
'$timeout',
function ($timeout) {
return { return {
link: function (scope, element, attrs, model) { link: function (scope, element, attrs, model) {
$timeout(function () { $timeout(function () {
@ -854,6 +916,7 @@ angular.module('OpenSlidesApp.core.site', [
}); });
} }
}; };
}); }
]);
}()); }());

View File

@ -18,7 +18,9 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
} }
]) ])
.config(function($stateProvider) { .config([
'$stateProvider',
function($stateProvider) {
$stateProvider $stateProvider
.state('mediafiles', { .state('mediafiles', {
url: '/mediafiles', url: '/mediafiles',
@ -54,9 +56,16 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
'@mediafiles.mediafile': {} '@mediafiles.mediafile': {}
} }
}); });
}) }
])
.controller('MediafileListCtrl', function($scope, $http, $timeout, Upload, Mediafile) { .controller('MediafileListCtrl', [
'$scope',
'$http',
'$timeout',
'Upload',
'Mediafile',
function($scope, $http, $timeout, Upload, Mediafile) {
Mediafile.bindAll({}, $scope, 'mediafiles'); Mediafile.bindAll({}, $scope, 'mediafiles');
// setup table sorting // setup table sorting
@ -80,7 +89,8 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
} }
); );
}; };
}) }
])
.controller('MediafileCreateCtrl', [ .controller('MediafileCreateCtrl', [
'$scope', '$scope',

View File

@ -298,12 +298,18 @@ angular.module('OpenSlidesApp.motions', ['OpenSlidesApp.users'])
} }
]) ])
.factory('Category', ['DS', function(DS) { .factory('Category', [
'DS',
function(DS) {
return DS.defineResource({ return DS.defineResource({
name: 'motions/category', name: 'motions/category',
}); });
}]) }
])
.run(['Motion', 'Category', function(Motion, Category) {}]);
.run([
'Motion',
'Category',
function(Motion, Category) {}
]);
}()); }());

View File

@ -4,13 +4,20 @@
angular.module('OpenSlidesApp.motions.projector', ['OpenSlidesApp.motions']) angular.module('OpenSlidesApp.motions.projector', ['OpenSlidesApp.motions'])
.config(function(slidesProvider) { .config([
'slidesProvider',
function(slidesProvider) {
slidesProvider.registerSlide('motions/motion', { slidesProvider.registerSlide('motions/motion', {
template: 'static/templates/motions/slide_motion.html', template: 'static/templates/motions/slide_motion.html',
}); });
}) }
])
.controller('SlideMotionCtrl', function($scope, Motion, User) { .controller('SlideMotionCtrl', [
'$scope',
'Motion',
'User',
function($scope, Motion, User) {
// Attention! Each object that is used here has to be dealt on server side. // Attention! Each object that is used here has to be dealt on server side.
// Add it to the coresponding get_requirements method of the ProjectorElement // Add it to the coresponding get_requirements method of the ProjectorElement
// class. // class.
@ -18,6 +25,7 @@ angular.module('OpenSlidesApp.motions.projector', ['OpenSlidesApp.motions'])
Motion.find(id); Motion.find(id);
User.findAll(); User.findAll();
Motion.bindOne(id, $scope, 'motion'); Motion.bindOne(id, $scope, 'motion');
}); }
]);
}()); }());

View File

@ -18,7 +18,9 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
} }
]) ])
.config(function($stateProvider) { .config([
'$stateProvider',
function($stateProvider) {
$stateProvider $stateProvider
.state('motions', { .state('motions', {
url: '/motions', url: '/motions',
@ -132,7 +134,8 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
'@motions.category': {} '@motions.category': {}
} }
}); });
}) }
])
// Service for generic motion form (create and update) // Service for generic motion form (create and update)
.factory('MotionForm', [ .factory('MotionForm', [
@ -874,7 +877,10 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
]) ])
.controller('CategoryListCtrl', function($scope, Category) { .controller('CategoryListCtrl', [
'$scope',
'Category',
function($scope, Category) {
Category.bindAll({}, $scope, 'categories'); Category.bindAll({}, $scope, 'categories');
// setup table sorting // setup table sorting
@ -892,13 +898,23 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
$scope.delete = function (category) { $scope.delete = function (category) {
Category.destroy(category.id); Category.destroy(category.id);
}; };
}) }
])
.controller('CategoryDetailCtrl', function($scope, Category, category) { .controller('CategoryDetailCtrl', [
'$scope',
'Category',
'category',
function($scope, Category, category) {
Category.bindOne(category.id, $scope, 'category'); Category.bindOne(category.id, $scope, 'category');
}) }
])
.controller('CategoryCreateCtrl', function($scope, $state, Category) { .controller('CategoryCreateCtrl', [
'$scope',
'$state',
'Category',
function($scope, $state, Category) {
$scope.category = {}; $scope.category = {};
$scope.save = function (category) { $scope.save = function (category) {
Category.create(category).then( Category.create(category).then(
@ -907,9 +923,15 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
} }
); );
}; };
}) }
])
.controller('CategoryUpdateCtrl', function($scope, $state, Category, category) { .controller('CategoryUpdateCtrl', [
'$scope',
'$state',
'Category',
'category',
function($scope, $state, Category, category) {
$scope.category = category; $scope.category = category;
$scope.save = function (category) { $scope.save = function (category) {
Category.save(category).then( Category.save(category).then(
@ -918,6 +940,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
} }
); );
}; };
}); }
]);
}()); }());

View File

@ -60,7 +60,11 @@ angular.module('OpenSlidesApp.users', [])
} }
]) ])
.factory('User', ['DS', 'Group', 'jsDataModel', function(DS, Group, jsDataModel) { .factory('User', [
'DS',
'Group',
'jsDataModel',
function(DS, Group, jsDataModel) {
var name = 'users/user'; var name = 'users/user';
return DS.defineResource({ return DS.defineResource({
name: name, name: name,
@ -126,14 +130,22 @@ angular.module('OpenSlidesApp.users', [])
}, },
}, },
}); });
}]) }
])
.factory('Group', ['DS', function(DS) { .factory('Group', [
'DS',
function(DS) {
return DS.defineResource({ return DS.defineResource({
name: 'users/group', name: 'users/group',
}); });
}]) }
])
.run(['User', 'Group', function(User, Group) {}]); .run([
'User',
'Group',
function(User, Group) {}
]);
}()); }());

View File

@ -4,19 +4,26 @@
angular.module('OpenSlidesApp.users.projector', ['OpenSlidesApp.users']) angular.module('OpenSlidesApp.users.projector', ['OpenSlidesApp.users'])
.config(function(slidesProvider) { .config([
'slidesProvider',
function(slidesProvider) {
slidesProvider.registerSlide('users/user', { slidesProvider.registerSlide('users/user', {
template: 'static/templates/users/slide_user.html', template: 'static/templates/users/slide_user.html',
}); });
}) }
])
.controller('SlideUserCtrl', function($scope, User) { .controller('SlideUserCtrl', [
'$scope',
'User',
function($scope, User) {
// Attention! Each object that is used here has to be dealt on server side. // Attention! Each object that is used here has to be dealt on server side.
// Add it to the coresponding get_requirements method of the ProjectorElement // Add it to the coresponding get_requirements method of the ProjectorElement
// class. // class.
var id = $scope.element.id; var id = $scope.element.id;
User.find(id); User.find(id);
User.bindOne(id, $scope, 'user'); User.bindOne(id, $scope, 'user');
}); }
]);
}()); }());

View File

@ -18,7 +18,9 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
} }
]) ])
.config(function($stateProvider) { .config([
'$stateProvider',
function($stateProvider) {
$stateProvider $stateProvider
.state('users', { .state('users', {
url: '/users', url: '/users',
@ -131,7 +133,8 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
}); });
}] }]
}); });
}) }
])
.run([ .run([
'operator', 'operator',