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'])
.config(function(slidesProvider) {
.config([
'slidesProvider',
function(slidesProvider) {
slidesProvider.registerSlide('assignments/assignment', {
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.
// Add it to the coresponding get_requirements method of the ProjectorElement
// class.
var id = $scope.element.id;
Assignment.find(id);
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
.state('assignments', {
url: '/assignments',
@ -74,7 +76,8 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
}
]
});
})
}
])
// Service for generic assignment form (create and update)
.factory('AssignmentForm', [

View File

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

View File

@ -6,7 +6,8 @@
angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
// Provider to register slides in a .config() statement.
.provider('slides', function() {
.provider('slides', [
function() {
var slidesMap = {};
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', {
template: 'static/templates/core/slide_customslide.html',
});
@ -50,9 +54,14 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
slidesProvider.registerSlide('core/message', {
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() {
$scope.$watch(function () {
return Projector.lastModified(1);
@ -69,7 +78,8 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
$scope.scale = 100 + 20 * Projector.get(1).scale;
});
});
})
}
])
.controller('SlideCustomSlideCtrl', [
'$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
$urlRouterProvider.otherwise('/');
$locationProvider.html5Mode(true);
})
}
])
.config(function($httpProvider) {
.config([
'$httpProvider',
function($httpProvider) {
// Combine the django csrf system with the angular csrf system
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
})
}
])
.config(function(uiSelectConfig) {
.config([
'uiSelectConfig',
function(uiSelectConfig) {
uiSelectConfig.theme = 'bootstrap';
})
}
])
.config(function($stateProvider, $urlMatcherFactoryProvider) {
.config([
'$stateProvider',
'$urlMatcherFactoryProvider',
function($stateProvider, $urlMatcherFactoryProvider) {
// Make the trailing slash optional
$urlMatcherFactoryProvider.strictMode(false);
@ -171,9 +184,13 @@ angular.module('OpenSlidesApp.core.site', [
state.url = state.url || defaultUrl;
return parent(state);
});
})
}
])
.config(function($stateProvider, $locationProvider) {
.config([
'$stateProvider',
'$locationProvider',
function($stateProvider, $locationProvider) {
// Core urls
$stateProvider
.state('dashboard', {
@ -269,11 +286,14 @@ angular.module('OpenSlidesApp.core.site', [
});
$locationProvider.html5Mode(true);
})
}
])
// Helper to add ui.router states at runtime.
// Needed for the django url_patterns.
.provider('runtimeStates', function($stateProvider) {
.provider('runtimeStates', [
'$stateProvider',
function($stateProvider) {
this.$get = function($q, $timeout, $state) {
return {
addState: function(name, state) {
@ -281,10 +301,14 @@ angular.module('OpenSlidesApp.core.site', [
}
};
};
})
}
])
// Load the django url patterns
.run(function(runtimeStates, $http) {
.run([
'runtimeStates',
'$http',
function(runtimeStates, $http) {
$http.get('/core/url_patterns/').then(function(data) {
for (var pattern in data.data) {
runtimeStates.addState(pattern, {
@ -296,7 +320,8 @@ angular.module('OpenSlidesApp.core.site', [
});
}
});
})
}
])
// angular formly config options
.run([
@ -321,7 +346,10 @@ angular.module('OpenSlidesApp.core.site', [
// html-tag os-form-field to generate generic from 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) {
return {
string: 'text',
@ -354,9 +382,10 @@ angular.module('OpenSlidesApp.core.site', [
}
}
};
})
}
])
.controller("MainMenuCtrl", [
.controller('MainMenuCtrl', [
'$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.selectedLanguage = filterFilter($scope.languages, {selected: true});
// controller to switch app language
@ -372,7 +406,8 @@ angular.module('OpenSlidesApp.core.site', [
$scope.languages = Languages.setCurrentLanguage(lang);
$scope.selectedLanguage = filterFilter($scope.languages, {selected: true});
};
})
}
])
// Projector Sidebar Controller
.controller('ProjectorSidebarCtrl', [
@ -398,7 +433,11 @@ angular.module('OpenSlidesApp.core.site', [
])
// Config Controller
.controller('ConfigCtrl', function($scope, Config, configOption) {
.controller('ConfigCtrl', [
'$scope',
'Config',
'configOption',
function($scope, Config, configOption) {
Config.bindAll({}, $scope, 'configs');
$scope.configGroups = configOption.data.config_groups;
@ -407,7 +446,8 @@ angular.module('OpenSlidesApp.core.site', [
Config.get(key).value = value;
Config.save(key);
};
})
}
])
// Provide generic customslide form fields for create and update view
@ -744,7 +784,10 @@ angular.module('OpenSlidesApp.core.site', [
])
// Tag Controller
.controller('TagListCtrl', function($scope, Tag) {
.controller('TagListCtrl', [
'$scope',
'Tag',
function($scope, Tag) {
Tag.bindAll({}, $scope, 'tags');
// 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');
})
}
])
.controller('TagCreateCtrl', function($scope, $state, Tag) {
.controller('TagCreateCtrl', [
'$scope',
'$state',
'Tag',
function($scope, $state, Tag) {
$scope.tag = {};
$scope.save = function (tag) {
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.save = function (tag) {
Tag.save(tag).then(
@ -795,7 +854,8 @@ angular.module('OpenSlidesApp.core.site', [
}
);
};
})
}
])
// counter of new (unread) chat messages
.value('NewChatMessages', [])
@ -846,7 +906,9 @@ angular.module('OpenSlidesApp.core.site', [
}
])
.directive('osFocusMe', function ($timeout) {
.directive('osFocusMe', [
'$timeout',
function ($timeout) {
return {
link: function (scope, element, attrs, model) {
$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
.state('mediafiles', {
url: '/mediafiles',
@ -54,9 +56,16 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
'@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');
// setup table sorting
@ -80,7 +89,8 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
}
);
};
})
}
])
.controller('MediafileCreateCtrl', [
'$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({
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'])
.config(function(slidesProvider) {
.config([
'slidesProvider',
function(slidesProvider) {
slidesProvider.registerSlide('motions/motion', {
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.
// Add it to the coresponding get_requirements method of the ProjectorElement
// class.
@ -18,6 +25,7 @@ angular.module('OpenSlidesApp.motions.projector', ['OpenSlidesApp.motions'])
Motion.find(id);
User.findAll();
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
.state('motions', {
url: '/motions',
@ -132,7 +134,8 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
'@motions.category': {}
}
});
})
}
])
// Service for generic motion form (create and update)
.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');
// setup table sorting
@ -892,13 +898,23 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
$scope.delete = function (category) {
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');
})
}
])
.controller('CategoryCreateCtrl', function($scope, $state, Category) {
.controller('CategoryCreateCtrl', [
'$scope',
'$state',
'Category',
function($scope, $state, Category) {
$scope.category = {};
$scope.save = function (category) {
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.save = function (category) {
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';
return DS.defineResource({
name: name,
@ -126,14 +130,22 @@ angular.module('OpenSlidesApp.users', [])
},
},
});
}])
}
])
.factory('Group', ['DS', function(DS) {
.factory('Group', [
'DS',
function(DS) {
return DS.defineResource({
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'])
.config(function(slidesProvider) {
.config([
'slidesProvider',
function(slidesProvider) {
slidesProvider.registerSlide('users/user', {
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.
// Add it to the coresponding get_requirements method of the ProjectorElement
// class.
var id = $scope.element.id;
User.find(id);
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
.state('users', {
url: '/users',
@ -131,7 +133,8 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
});
}]
});
})
}
])
.run([
'operator',