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) {
slidesProvider.registerSlide('assignments/assignment', {
template: 'static/templates/assignments/slide_assignment.html',
});
})
.config([
'slidesProvider',
function(slidesProvider) {
slidesProvider.registerSlide('assignments/assignment', {
template: 'static/templates/assignments/slide_assignment.html',
});
}
])
.controller('SlideAssignmentCtrl', 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');
});
.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,63 +18,66 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
}
])
.config(function($stateProvider) {
$stateProvider
.state('assignments', {
url: '/assignments',
abstract: true,
template: "<ui-view/>",
})
.state('assignments.assignment', {
abstract: true,
template: "<ui-view/>",
})
.state('assignments.assignment.list', {
resolve: {
assignments: function(Assignment) {
return Assignment.findAll();
},
phases: function(Assignment) {
return Assignment.getPhases();
.config([
'$stateProvider',
function($stateProvider) {
$stateProvider
.state('assignments', {
url: '/assignments',
abstract: true,
template: "<ui-view/>",
})
.state('assignments.assignment', {
abstract: true,
template: "<ui-view/>",
})
.state('assignments.assignment.list', {
resolve: {
assignments: function(Assignment) {
return Assignment.findAll();
},
phases: function(Assignment) {
return Assignment.getPhases();
}
}
}
})
.state('assignments.assignment.detail', {
controller: 'AssignmentDetailCtrl',
resolve: {
assignment: function(Assignment, $stateParams) {
return Assignment.find($stateParams.id);
},
users: function(User) {
return User.findAll();
})
.state('assignments.assignment.detail', {
controller: 'AssignmentDetailCtrl',
resolve: {
assignment: function(Assignment, $stateParams) {
return Assignment.find($stateParams.id);
},
users: function(User) {
return User.findAll();
}
}
}
})
// redirects to assignment detail and opens assignment edit form dialog, uses edit url,
// used by ui-sref links from agenda only
// (from assignment controller use AssignmentForm factory instead to open dialog in front
// of current view without redirect)
.state('assignments.assignment.detail.update', {
onEnter: ['$stateParams', '$state', 'ngDialog', 'Assignment',
function($stateParams, $state, ngDialog, Assignment) {
ngDialog.open({
template: 'static/templates/assignments/assignment-form.html',
controller: 'AssignmentUpdateCtrl',
className: 'ngdialog-theme-default wide-form',
closeByEscape: false,
closeByDocument: false,
resolve: {
assignment: function() {return Assignment.find($stateParams.id)}
},
preCloseCallback: function() {
$state.go('assignments.assignment.detail', {assignment: $stateParams.id});
return true;
}
});
}
]
});
})
})
// redirects to assignment detail and opens assignment edit form dialog, uses edit url,
// used by ui-sref links from agenda only
// (from assignment controller use AssignmentForm factory instead to open dialog in front
// of current view without redirect)
.state('assignments.assignment.detail.update', {
onEnter: ['$stateParams', '$state', 'ngDialog', 'Assignment',
function($stateParams, $state, ngDialog, Assignment) {
ngDialog.open({
template: 'static/templates/assignments/assignment-form.html',
controller: 'AssignmentUpdateCtrl',
className: 'ngdialog-theme-default wide-form',
closeByEscape: false,
closeByDocument: false,
resolve: {
assignment: function() {return Assignment.find($stateParams.id)}
},
preCloseCallback: function() {
$state.go('assignments.assignment.detail', {assignment: $stateParams.id});
return true;
}
});
}
]
});
}
])
// Service for generic assignment form (create and update)
.factory('AssignmentForm', [

View File

@ -12,23 +12,27 @@ angular.module('OpenSlidesApp.core', [
'ui.tree',
])
.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
DSProvider.defaults.reapAction = 'none';
DSProvider.defaults.basePath = '/rest';
DSProvider.defaults.afterReap = function(model, items) {
if (items.length > 5) {
model.findAll({}, {bypassCache: true});
} else {
_.forEach(items, function (item) {
model.refresh(item[model.idAttribute]);
});
}
};
DSHttpAdapterProvider.defaults.forceTrailingSlash = true;
}])
.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
DSProvider.defaults.reapAction = 'none';
DSProvider.defaults.basePath = '/rest';
DSProvider.defaults.afterReap = function(model, items) {
if (items.length > 5) {
model.findAll({}, {bypassCache: true});
} else {
_.forEach(items, function (item) {
model.refresh(item[model.idAttribute]);
});
}
};
DSHttpAdapterProvider.defaults.forceTrailingSlash = true;
}
])
.factory('autoupdate', [
'DS',
@ -129,23 +133,27 @@ angular.module('OpenSlidesApp.core', [
}
])
.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
.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
// TODO: Do not send the status code to the client, but make the decission
// on the server side. It is an implementation detail, that tornado
// sends request to wsgi, which should not concern the client.
console.log("Received object: " + data.collection + ", " + data.id);
if (data.status_code == 200) {
DS.inject(data.collection, data.data);
} else if (data.status_code == 404) {
DS.eject(data.collection, data.id);
}
// TODO: handle other statuscodes
});
}])
// TODO: Do not send the status code to the client, but make the decission
// on the server side. It is an implementation detail, that tornado
// sends request to wsgi, which should not concern the client.
console.log("Received object: " + data.collection + ", " + data.id);
if (data.status_code == 200) {
DS.inject(data.collection, data.data);
} else if (data.status_code == 404) {
DS.eject(data.collection, data.id);
}
// 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) {
return DS.defineResource({
name: 'core/projector',
onConflict: 'replace',
});
}])
.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,70 +6,80 @@
angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
// Provider to register slides in a .config() statement.
.provider('slides', function() {
var slidesMap = {};
.provider('slides', [
function() {
var slidesMap = {};
this.registerSlide = function(name, config) {
slidesMap[name] = config;
return this;
};
this.registerSlide = function(name, config) {
slidesMap[name] = config;
return this;
};
this.$get = function($templateRequest, $q) {
var self = this;
return {
getElements: function(projector) {
var elements = [];
var factory = this;
_.forEach(projector.elements, function(element) {
if (element.name in slidesMap) {
element.template = slidesMap[element.name].template;
elements.push(element);
this.$get = function($templateRequest, $q) {
var self = this;
return {
getElements: function(projector) {
var elements = [];
var factory = this;
_.forEach(projector.elements, function(element) {
if (element.name in slidesMap) {
element.template = slidesMap[element.name].template;
elements.push(element);
} else {
console.log("Unknown slide: " + element.name);
}
});
return elements;
}
};
};
}
])
.config([
'slidesProvider',
function(slidesProvider) {
slidesProvider.registerSlide('core/customslide', {
template: 'static/templates/core/slide_customslide.html',
});
slidesProvider.registerSlide('core/clock', {
template: 'static/templates/core/slide_clock.html',
});
slidesProvider.registerSlide('core/countdown', {
template: 'static/templates/core/slide_countdown.html',
});
slidesProvider.registerSlide('core/message', {
template: 'static/templates/core/slide_message.html',
});
}
])
.controller('ProjectorCtrl', [
'$scope',
'Projector',
'slides',
function($scope, Projector, slides) {
Projector.find(1).then(function() {
$scope.$watch(function () {
return Projector.lastModified(1);
}, function () {
$scope.elements = [];
_.forEach(slides.getElements(Projector.get(1)), function(element) {
if (!element.error) {
$scope.elements.push(element);
} else {
console.log("Unknown slide: " + element.name);
console.error("Error for slide " + element.name + ": " + element.error);
}
});
return elements;
}
};
};
})
.config(function(slidesProvider) {
slidesProvider.registerSlide('core/customslide', {
template: 'static/templates/core/slide_customslide.html',
});
slidesProvider.registerSlide('core/clock', {
template: 'static/templates/core/slide_clock.html',
});
slidesProvider.registerSlide('core/countdown', {
template: 'static/templates/core/slide_countdown.html',
});
slidesProvider.registerSlide('core/message', {
template: 'static/templates/core/slide_message.html',
});
})
.controller('ProjectorCtrl', function($scope, Projector, slides) {
Projector.find(1).then(function() {
$scope.$watch(function () {
return Projector.lastModified(1);
}, function () {
$scope.elements = [];
_.forEach(slides.getElements(Projector.get(1)), function(element) {
if (!element.error) {
$scope.elements.push(element);
} else {
console.error("Error for slide " + element.name + ": " + element.error);
}
$scope.scroll = -5 * Projector.get(1).scroll;
$scope.scale = 100 + 20 * Projector.get(1).scale;
});
$scope.scroll = -5 * Projector.get(1).scroll;
$scope.scale = 100 + 20 * Projector.get(1).scale;
});
});
})
}
])
.controller('SlideCustomSlideCtrl', [
'$scope',

View File

@ -84,219 +84,244 @@ angular.module('OpenSlidesApp.core.site', [
}
])
.config(function($urlRouterProvider, $locationProvider) {
// define fallback url and html5Mode
$urlRouterProvider.otherwise('/');
$locationProvider.html5Mode(true);
})
.config([
'$urlRouterProvider',
'$locationProvider',
function($urlRouterProvider, $locationProvider) {
// define fallback url and html5Mode
$urlRouterProvider.otherwise('/');
$locationProvider.html5Mode(true);
}
])
.config(function($httpProvider) {
// Combine the django csrf system with the angular csrf system
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
})
.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) {
uiSelectConfig.theme = 'bootstrap';
})
.config([
'uiSelectConfig',
function(uiSelectConfig) {
uiSelectConfig.theme = 'bootstrap';
}
])
.config(function($stateProvider, $urlMatcherFactoryProvider) {
// Make the trailing slash optional
$urlMatcherFactoryProvider.strictMode(false);
.config([
'$stateProvider',
'$urlMatcherFactoryProvider',
function($stateProvider, $urlMatcherFactoryProvider) {
// Make the trailing slash optional
$urlMatcherFactoryProvider.strictMode(false);
// Use stateProvider.decorator to give default values to our states
$stateProvider.decorator('views', function(state, parent) {
var result = {},
views = parent(state);
// Use stateProvider.decorator to give default values to our states
$stateProvider.decorator('views', function(state, parent) {
var result = {},
views = parent(state);
if (state.abstract || state.data && state.data.extern) {
return views;
}
if (state.abstract || state.data && state.data.extern) {
return views;
}
angular.forEach(views, function(config, name) {
angular.forEach(views, function(config, name) {
// Sets default values for templateUrl
var patterns = state.name.split('.'),
templateUrl,
controller,
defaultControllers = {
create: 'CreateCtrl',
update: 'UpdateCtrl',
list: 'ListCtrl',
detail: 'DetailCtrl',
};
// Sets default values for templateUrl
var patterns = state.name.split('.'),
templateUrl,
controller,
defaultControllers = {
create: 'CreateCtrl',
update: 'UpdateCtrl',
list: 'ListCtrl',
detail: 'DetailCtrl',
};
// templateUrl
if (_.last(patterns).match(/(create|update)/)) {
// When state_patterns is in the form "app.module.create" or
// "app.module.update", use the form template.
templateUrl = 'static/templates/' + patterns[0] + '/' + patterns[1] + '-form.html';
// templateUrl
if (_.last(patterns).match(/(create|update)/)) {
// When state_patterns is in the form "app.module.create" or
// "app.module.update", use the form template.
templateUrl = 'static/templates/' + patterns[0] + '/' + patterns[1] + '-form.html';
} else {
// Replaces the first point through a slash (the app name)
var appName = state.name.replace('.', '/');
// Replaces any folowing points though a -
templateUrl = 'static/templates/' + appName.replace(/\./g, '-') + '.html';
}
config.templateUrl = state.templateUrl || templateUrl;
// controller
if (patterns.length >= 3) {
controller = _.capitalize(patterns[1]) + defaultControllers[_.last(patterns)];
config.controller = state.controller || controller;
}
result[name] = config;
});
return result;
})
.decorator('url', function(state, parent) {
var defaultUrl;
if (state.abstract) {
defaultUrl = '';
} else {
// Replaces the first point through a slash (the app name)
var appName = state.name.replace('.', '/');
// Replaces any folowing points though a -
templateUrl = 'static/templates/' + appName.replace(/\./g, '-') + '.html';
}
config.templateUrl = state.templateUrl || templateUrl;
var patterns = state.name.split('.'),
defaultUrls = {
create: '/new',
update: '/edit',
list: '',
// The id is expected to be an integer, if not, the url has to
// be defined manually
detail: '/{id:int}',
};
// controller
if (patterns.length >= 3) {
controller = _.capitalize(patterns[1]) + defaultControllers[_.last(patterns)];
config.controller = state.controller || controller;
defaultUrl = defaultUrls[_.last(patterns)];
}
result[name] = config;
state.url = state.url || defaultUrl;
return parent(state);
});
return result;
})
}
])
.decorator('url', function(state, parent) {
var defaultUrl;
if (state.abstract) {
defaultUrl = '';
} else {
var patterns = state.name.split('.'),
defaultUrls = {
create: '/new',
update: '/edit',
list: '',
// The id is expected to be an integer, if not, the url has to
// be defined manually
detail: '/{id:int}',
};
defaultUrl = defaultUrls[_.last(patterns)];
}
state.url = state.url || defaultUrl;
return parent(state);
});
})
.config(function($stateProvider, $locationProvider) {
// Core urls
$stateProvider
.state('dashboard', {
url: '/',
templateUrl: 'static/templates/dashboard.html'
})
.state('projector', {
url: '/projector',
data: {extern: true},
onEnter: function($window) {
$window.location.href = this.url;
}
})
.state('core', {
url: '/core',
abstract: true,
template: "<ui-view/>",
})
// legal notice and version
.state('legalnotice', {
url: '/legalnotice',
controller: 'LegalNoticeCtrl',
})
//config
.state('config', {
url: '/config',
controller: 'ConfigCtrl',
resolve: {
configOption: function($http) {
return $http({ 'method': 'OPTIONS', 'url': '/rest/core/config/' });
}
}
})
// customslide
.state('core.customslide', {
url: '/customslide',
abstract: true,
template: "<ui-view/>",
})
.state('core.customslide.detail', {
resolve: {
customslide: function(Customslide, $stateParams) {
return Customslide.find($stateParams.id);
}
}
})
// redirects to customslide detail and opens customslide edit form dialog, uses edit url,
// used by ui-sref links from agenda only
// (from customslide controller use CustomSlideForm factory instead to open dialog in front
// of current view without redirect)
.state('core.customslide.detail.update', {
onEnter: ['$stateParams', '$state', 'ngDialog', 'Customslide',
function($stateParams, $state, ngDialog, Customslide) {
ngDialog.open({
template: 'static/templates/core/customslide-form.html',
controller: 'CustomslideUpdateCtrl',
className: 'ngdialog-theme-default wide-form',
resolve: {
customslide: function() {return Customslide.find($stateParams.id) }
},
preCloseCallback: function() {
$state.go('core.customslide.detail', {customslide: $stateParams.id});
return true;
}
});
}]
})
// tag
.state('core.tag', {
url: '/tag',
abstract: true,
template: "<ui-view/>",
})
.state('core.tag.list', {
resolve: {
tags: function(Tag) {
return Tag.findAll();
}
}
})
.state('core.tag.create', {})
.state('core.tag.detail', {
resolve: {
tag: function(Tag, $stateParams) {
return Tag.find($stateParams.id);
}
}
})
.state('core.tag.detail.update', {
views: {
'@core.tag': {}
}
});
$locationProvider.html5Mode(true);
})
// Helper to add ui.router states at runtime.
// Needed for the django url_patterns.
.provider('runtimeStates', function($stateProvider) {
this.$get = function($q, $timeout, $state) {
return {
addState: function(name, state) {
$stateProvider.state(name, state);
}
};
};
})
// Load the django url patterns
.run(function(runtimeStates, $http) {
$http.get('/core/url_patterns/').then(function(data) {
for (var pattern in data.data) {
runtimeStates.addState(pattern, {
'url': data.data[pattern],
.config([
'$stateProvider',
'$locationProvider',
function($stateProvider, $locationProvider) {
// Core urls
$stateProvider
.state('dashboard', {
url: '/',
templateUrl: 'static/templates/dashboard.html'
})
.state('projector', {
url: '/projector',
data: {extern: true},
onEnter: function($window) {
$window.location.href = this.url;
}
})
.state('core', {
url: '/core',
abstract: true,
template: "<ui-view/>",
})
// legal notice and version
.state('legalnotice', {
url: '/legalnotice',
controller: 'LegalNoticeCtrl',
})
//config
.state('config', {
url: '/config',
controller: 'ConfigCtrl',
resolve: {
configOption: function($http) {
return $http({ 'method': 'OPTIONS', 'url': '/rest/core/config/' });
}
}
})
// customslide
.state('core.customslide', {
url: '/customslide',
abstract: true,
template: "<ui-view/>",
})
.state('core.customslide.detail', {
resolve: {
customslide: function(Customslide, $stateParams) {
return Customslide.find($stateParams.id);
}
}
})
// redirects to customslide detail and opens customslide edit form dialog, uses edit url,
// used by ui-sref links from agenda only
// (from customslide controller use CustomSlideForm factory instead to open dialog in front
// of current view without redirect)
.state('core.customslide.detail.update', {
onEnter: ['$stateParams', '$state', 'ngDialog', 'Customslide',
function($stateParams, $state, ngDialog, Customslide) {
ngDialog.open({
template: 'static/templates/core/customslide-form.html',
controller: 'CustomslideUpdateCtrl',
className: 'ngdialog-theme-default wide-form',
resolve: {
customslide: function() {return Customslide.find($stateParams.id) }
},
preCloseCallback: function() {
$state.go('core.customslide.detail', {customslide: $stateParams.id});
return true;
}
});
}]
})
// tag
.state('core.tag', {
url: '/tag',
abstract: true,
template: "<ui-view/>",
})
.state('core.tag.list', {
resolve: {
tags: function(Tag) {
return Tag.findAll();
}
}
})
.state('core.tag.create', {})
.state('core.tag.detail', {
resolve: {
tag: function(Tag, $stateParams) {
return Tag.find($stateParams.id);
}
}
})
.state('core.tag.detail.update', {
views: {
'@core.tag': {}
}
});
}
});
})
$locationProvider.html5Mode(true);
}
])
// Helper to add ui.router states at runtime.
// Needed for the django url_patterns.
.provider('runtimeStates', [
'$stateProvider',
function($stateProvider) {
this.$get = function($q, $timeout, $state) {
return {
addState: function(name, state) {
$stateProvider.state(name, state);
}
};
};
}
])
// Load the django url patterns
.run([
'runtimeStates',
'$http',
function(runtimeStates, $http) {
$http.get('/core/url_patterns/').then(function(data) {
for (var pattern in data.data) {
runtimeStates.addState(pattern, {
'url': data.data[pattern],
data: {extern: true},
onEnter: function($window) {
$window.location.href = this.url;
}
});
}
});
}
])
// angular formly config options
.run([
@ -321,42 +346,46 @@ 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) {
function getHtmlType(type) {
return {
string: 'text',
text: 'textarea',
integer: 'number',
boolean: 'checkbox',
choice: 'choice',
}[type];
}
return {
restrict: 'E',
scope: true,
templateUrl: '/static/templates/config-form-field.html',
link: function ($scope, iElement, iAttrs, controller, transcludeFn) {
var field = $parse(iAttrs.field)($scope);
var config = Config.get(field.key);
$scope.type = getHtmlType(field.input_type);
if ($scope.type == 'choice') {
$scope.choices = field.choices;
}
$scope.label = field.label;
$scope.key = 'field-' + field.key;
$scope.value = config.value;
$scope.help_text = field.help_text;
$scope.default_value = field.default_value;
$scope.reset = function () {
$scope.value = $scope.default_value;
$scope.save(field.key, $scope.value);
}
.directive('osFormField', [
'$parse',
'Config',
function($parse, Config) {
function getHtmlType(type) {
return {
string: 'text',
text: 'textarea',
integer: 'number',
boolean: 'checkbox',
choice: 'choice',
}[type];
}
};
})
.controller("MainMenuCtrl", [
return {
restrict: 'E',
scope: true,
templateUrl: '/static/templates/config-form-field.html',
link: function ($scope, iElement, iAttrs, controller, transcludeFn) {
var field = $parse(iAttrs.field)($scope);
var config = Config.get(field.key);
$scope.type = getHtmlType(field.input_type);
if ($scope.type == 'choice') {
$scope.choices = field.choices;
}
$scope.label = field.label;
$scope.key = 'field-' + field.key;
$scope.value = config.value;
$scope.help_text = field.help_text;
$scope.default_value = field.default_value;
$scope.reset = function () {
$scope.value = $scope.default_value;
$scope.save(field.key, $scope.value);
}
}
};
}
])
.controller('MainMenuCtrl', [
'$scope',
'mainMenu',
function ($scope, mainMenu) {
@ -364,15 +393,21 @@ angular.module('OpenSlidesApp.core.site', [
}
])
.controller("LanguageCtrl", function ($scope, gettextCatalog, Languages, filterFilter) {
$scope.languages = Languages.getLanguages();
$scope.selectedLanguage = filterFilter($scope.languages, {selected: true});
// controller to switch app language
$scope.switchLanguage = function (lang) {
$scope.languages = Languages.setCurrentLanguage(lang);
.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
$scope.switchLanguage = function (lang) {
$scope.languages = Languages.setCurrentLanguage(lang);
$scope.selectedLanguage = filterFilter($scope.languages, {selected: true});
};
}
])
// Projector Sidebar Controller
.controller('ProjectorSidebarCtrl', [
@ -398,16 +433,21 @@ angular.module('OpenSlidesApp.core.site', [
])
// Config Controller
.controller('ConfigCtrl', function($scope, Config, configOption) {
Config.bindAll({}, $scope, 'configs');
$scope.configGroups = configOption.data.config_groups;
.controller('ConfigCtrl', [
'$scope',
'Config',
'configOption',
function($scope, Config, configOption) {
Config.bindAll({}, $scope, 'configs');
$scope.configGroups = configOption.data.config_groups;
// save changed config value
$scope.save = function(key, value) {
Config.get(key).value = value;
Config.save(key);
};
})
// save changed config value
$scope.save = function(key, value) {
Config.get(key).value = value;
Config.save(key);
};
}
])
// Provide generic customslide form fields for create and update view
@ -744,58 +784,78 @@ angular.module('OpenSlidesApp.core.site', [
])
// Tag Controller
.controller('TagListCtrl', function($scope, Tag) {
Tag.bindAll({}, $scope, 'tags');
.controller('TagListCtrl', [
'$scope',
'Tag',
function($scope, Tag) {
Tag.bindAll({}, $scope, 'tags');
// setup table sorting
$scope.sortColumn = 'name';
$scope.reverse = false;
// function to sort by clicked column
$scope.toggleSort = function ( column ) {
if ( $scope.sortColumn === column ) {
$scope.reverse = !$scope.reverse;
}
$scope.sortColumn = column;
};
// save changed tag
$scope.save = function (tag) {
Tag.save(tag);
};
$scope.delete = function (tag) {
Tag.destroy(tag.id).then(
function(success) {
//TODO: success message
// setup table sorting
$scope.sortColumn = 'name';
$scope.reverse = false;
// function to sort by clicked column
$scope.toggleSort = function ( column ) {
if ( $scope.sortColumn === column ) {
$scope.reverse = !$scope.reverse;
}
);
};
})
$scope.sortColumn = column;
};
.controller('TagDetailCtrl', function($scope, Tag, tag) {
Tag.bindOne(tag.id, $scope, 'tag');
})
// save changed tag
$scope.save = function (tag) {
Tag.save(tag);
};
$scope.delete = function (tag) {
Tag.destroy(tag.id).then(
function(success) {
//TODO: success message
}
);
};
}
])
.controller('TagCreateCtrl', function($scope, $state, Tag) {
$scope.tag = {};
$scope.save = function (tag) {
Tag.create(tag).then(
function(success) {
$state.go('core.tag.list');
}
);
};
})
.controller('TagDetailCtrl', [
'$scope',
'Tag',
'tag',
function($scope, Tag, tag) {
Tag.bindOne(tag.id, $scope, 'tag');
}
])
.controller('TagUpdateCtrl', function($scope, $state, Tag, tag) {
$scope.tag = tag;
$scope.save = function (tag) {
Tag.save(tag).then(
function(success) {
$state.go('core.tag.list');
}
);
};
})
.controller('TagCreateCtrl', [
'$scope',
'$state',
'Tag',
function($scope, $state, Tag) {
$scope.tag = {};
$scope.save = function (tag) {
Tag.create(tag).then(
function(success) {
$state.go('core.tag.list');
}
);
};
}
])
.controller('TagUpdateCtrl', [
'$scope',
'$state',
'Tag',
'tag',
function($scope, $state, Tag, tag) {
$scope.tag = tag;
$scope.save = function (tag) {
Tag.save(tag).then(
function(success) {
$state.go('core.tag.list');
}
);
};
}
])
// counter of new (unread) chat messages
.value('NewChatMessages', [])
@ -846,14 +906,17 @@ angular.module('OpenSlidesApp.core.site', [
}
])
.directive('osFocusMe', function ($timeout) {
return {
link: function (scope, element, attrs, model) {
$timeout(function () {
element[0].focus();
});
}
};
});
.directive('osFocusMe', [
'$timeout',
function ($timeout) {
return {
link: function (scope, element, attrs, model) {
$timeout(function () {
element[0].focus();
});
}
};
}
]);
}());

View File

@ -18,69 +18,79 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
}
])
.config(function($stateProvider) {
$stateProvider
.state('mediafiles', {
url: '/mediafiles',
abstract: true,
template: "<ui-view/>",
})
.state('mediafiles.mediafile', {
abstract: true,
template: "<ui-view/>",
})
.state('mediafiles.mediafile.list', {
resolve: {
mediafiles: function(Mediafile) {
return Mediafile.findAll();
.config([
'$stateProvider',
function($stateProvider) {
$stateProvider
.state('mediafiles', {
url: '/mediafiles',
abstract: true,
template: "<ui-view/>",
})
.state('mediafiles.mediafile', {
abstract: true,
template: "<ui-view/>",
})
.state('mediafiles.mediafile.list', {
resolve: {
mediafiles: function(Mediafile) {
return Mediafile.findAll();
}
}
}
})
.state('mediafiles.mediafile.create', {})
.state('mediafiles.mediafile.detail', {
url: '/{id:int}',
abstract: true,
resolve: {
mediafile: function(Mediafile, $stateParams) {
var id = $stateParams.id;
var file = Mediafile.find(id);
return file;
})
.state('mediafiles.mediafile.create', {})
.state('mediafiles.mediafile.detail', {
url: '/{id:int}',
abstract: true,
resolve: {
mediafile: function(Mediafile, $stateParams) {
var id = $stateParams.id;
var file = Mediafile.find(id);
return file;
}
},
template: "<ui-view/>",
})
.state('mediafiles.mediafile.detail.update', {
views: {
'@mediafiles.mediafile': {}
}
},
template: "<ui-view/>",
})
.state('mediafiles.mediafile.detail.update', {
views: {
'@mediafiles.mediafile': {}
});
}
])
.controller('MediafileListCtrl', [
'$scope',
'$http',
'$timeout',
'Upload',
'Mediafile',
function($scope, $http, $timeout, Upload, Mediafile) {
Mediafile.bindAll({}, $scope, 'mediafiles');
// setup table sorting
$scope.sortColumn = 'title';
$scope.filterPresent = '';
$scope.reverse = false;
// function to sort by clicked column
$scope.toggleSort = function ( column ) {
if ( $scope.sortColumn === column ) {
$scope.reverse = !$scope.reverse;
}
});
})
$scope.sortColumn = column;
};
.controller('MediafileListCtrl', function($scope, $http, $timeout, Upload, Mediafile) {
Mediafile.bindAll({}, $scope, 'mediafiles');
// setup table sorting
$scope.sortColumn = 'title';
$scope.filterPresent = '';
$scope.reverse = false;
// function to sort by clicked column
$scope.toggleSort = function ( column ) {
if ( $scope.sortColumn === column ) {
$scope.reverse = !$scope.reverse;
}
$scope.sortColumn = column;
};
// delete
$scope.delete = function (mediafile) {
//TODO: add confirm message
Mediafile.destroy(mediafile.id).then(
function(success) {
//TODO: success message
}
);
};
})
// delete
$scope.delete = function (mediafile) {
//TODO: add confirm message
Mediafile.destroy(mediafile.id).then(
function(success) {
//TODO: success message
}
);
};
}
])
.controller('MediafileCreateCtrl', [
'$scope',

View File

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

View File

@ -4,20 +4,28 @@
angular.module('OpenSlidesApp.motions.projector', ['OpenSlidesApp.motions'])
.config(function(slidesProvider) {
slidesProvider.registerSlide('motions/motion', {
template: 'static/templates/motions/slide_motion.html',
});
})
.config([
'slidesProvider',
function(slidesProvider) {
slidesProvider.registerSlide('motions/motion', {
template: 'static/templates/motions/slide_motion.html',
});
}
])
.controller('SlideMotionCtrl', 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.
var id = $scope.element.id;
Motion.find(id);
User.findAll();
Motion.bindOne(id, $scope, 'motion');
});
.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.
var id = $scope.element.id;
Motion.find(id);
User.findAll();
Motion.bindOne(id, $scope, 'motion');
}
]);
}());

View File

@ -18,121 +18,124 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
}
])
.config(function($stateProvider) {
$stateProvider
.state('motions', {
url: '/motions',
abstract: true,
template: "<ui-view/>",
})
.state('motions.motion', {
abstract: true,
template: "<ui-view/>",
})
.state('motions.motion.list', {
resolve: {
motions: function(Motion) {
return Motion.findAll();
},
categories: function(Category) {
return Category.findAll();
},
tags: function(Tag) {
return Tag.findAll();
},
users: function(User) {
return User.findAll();
},
workflows: function(Workflow) {
return Workflow.findAll();
.config([
'$stateProvider',
function($stateProvider) {
$stateProvider
.state('motions', {
url: '/motions',
abstract: true,
template: "<ui-view/>",
})
.state('motions.motion', {
abstract: true,
template: "<ui-view/>",
})
.state('motions.motion.list', {
resolve: {
motions: function(Motion) {
return Motion.findAll();
},
categories: function(Category) {
return Category.findAll();
},
tags: function(Tag) {
return Tag.findAll();
},
users: function(User) {
return User.findAll();
},
workflows: function(Workflow) {
return Workflow.findAll();
}
}
}
})
.state('motions.motion.detail', {
resolve: {
motion: function(Motion, $stateParams) {
return Motion.find($stateParams.id);
},
categories: function(Category) {
return Category.findAll();
},
users: function(User) {
return User.findAll();
},
mediafiles: function(Mediafile) {
return Mediafile.findAll();
},
tags: function(Tag) {
return Tag.findAll();
})
.state('motions.motion.detail', {
resolve: {
motion: function(Motion, $stateParams) {
return Motion.find($stateParams.id);
},
categories: function(Category) {
return Category.findAll();
},
users: function(User) {
return User.findAll();
},
mediafiles: function(Mediafile) {
return Mediafile.findAll();
},
tags: function(Tag) {
return Tag.findAll();
}
}
}
})
// redirects to motion detail and opens motion edit form dialog, uses edit url,
// used by ui-sref links from agenda only
// (from motion controller use MotionForm factory instead to open dialog in front of
// current view without redirect)
.state('motions.motion.detail.update', {
onEnter: ['$stateParams', '$state', 'ngDialog', 'Motion',
function($stateParams, $state, ngDialog, Motion) {
ngDialog.open({
template: 'static/templates/motions/motion-form.html',
controller: 'MotionUpdateCtrl',
className: 'ngdialog-theme-default wide-form',
closeByEscape: false,
closeByDocument: false,
resolve: {
motion: function() {return Motion.find($stateParams.id)}
},
preCloseCallback: function() {
$state.go('motions.motion.detail', {motion: $stateParams.id});
return true;
}
});
})
// redirects to motion detail and opens motion edit form dialog, uses edit url,
// used by ui-sref links from agenda only
// (from motion controller use MotionForm factory instead to open dialog in front of
// current view without redirect)
.state('motions.motion.detail.update', {
onEnter: ['$stateParams', '$state', 'ngDialog', 'Motion',
function($stateParams, $state, ngDialog, Motion) {
ngDialog.open({
template: 'static/templates/motions/motion-form.html',
controller: 'MotionUpdateCtrl',
className: 'ngdialog-theme-default wide-form',
closeByEscape: false,
closeByDocument: false,
resolve: {
motion: function() {return Motion.find($stateParams.id)}
},
preCloseCallback: function() {
$state.go('motions.motion.detail', {motion: $stateParams.id});
return true;
}
});
}
]
})
.state('motions.motion.import', {
url: '/import',
controller: 'MotionImportCtrl',
resolve: {
motions: function(Motion) {
return Motion.findAll();
},
categories: function(Category) {
return Category.findAll();
},
users: function(User) {
return User.findAll();
}
}
]
})
.state('motions.motion.import', {
url: '/import',
controller: 'MotionImportCtrl',
resolve: {
motions: function(Motion) {
return Motion.findAll();
},
categories: function(Category) {
return Category.findAll();
},
users: function(User) {
return User.findAll();
})
// categories
.state('motions.category', {
url: '/category',
abstract: true,
template: "<ui-view/>",
})
.state('motions.category.list', {
resolve: {
categories: function(Category) {
return Category.findAll();
}
}
}
})
// categories
.state('motions.category', {
url: '/category',
abstract: true,
template: "<ui-view/>",
})
.state('motions.category.list', {
resolve: {
categories: function(Category) {
return Category.findAll();
})
.state('motions.category.create', {})
.state('motions.category.detail', {
resolve: {
category: function(Category, $stateParams) {
return Category.find($stateParams.id);
}
}
}
})
.state('motions.category.create', {})
.state('motions.category.detail', {
resolve: {
category: function(Category, $stateParams) {
return Category.find($stateParams.id);
})
.state('motions.category.detail.update', {
views: {
'@motions.category': {}
}
}
})
.state('motions.category.detail.update', {
views: {
'@motions.category': {}
}
});
})
});
}
])
// Service for generic motion form (create and update)
.factory('MotionForm', [
@ -874,50 +877,70 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
])
.controller('CategoryListCtrl', function($scope, Category) {
Category.bindAll({}, $scope, 'categories');
.controller('CategoryListCtrl', [
'$scope',
'Category',
function($scope, Category) {
Category.bindAll({}, $scope, 'categories');
// setup table sorting
$scope.sortColumn = 'name';
$scope.reverse = false;
// function to sort by clicked column
$scope.toggleSort = function ( column ) {
if ( $scope.sortColumn === column ) {
$scope.reverse = !$scope.reverse;
}
$scope.sortColumn = column;
};
// delete selected category
$scope.delete = function (category) {
Category.destroy(category.id);
};
})
.controller('CategoryDetailCtrl', function($scope, Category, category) {
Category.bindOne(category.id, $scope, 'category');
})
.controller('CategoryCreateCtrl', function($scope, $state, Category) {
$scope.category = {};
$scope.save = function (category) {
Category.create(category).then(
function(success) {
$state.go('motions.category.list');
// setup table sorting
$scope.sortColumn = 'name';
$scope.reverse = false;
// function to sort by clicked column
$scope.toggleSort = function ( column ) {
if ( $scope.sortColumn === column ) {
$scope.reverse = !$scope.reverse;
}
);
};
})
$scope.sortColumn = column;
};
.controller('CategoryUpdateCtrl', function($scope, $state, Category, category) {
$scope.category = category;
$scope.save = function (category) {
Category.save(category).then(
function(success) {
$state.go('motions.category.list');
}
);
};
});
// delete selected category
$scope.delete = function (category) {
Category.destroy(category.id);
};
}
])
.controller('CategoryDetailCtrl', [
'$scope',
'Category',
'category',
function($scope, Category, category) {
Category.bindOne(category.id, $scope, 'category');
}
])
.controller('CategoryCreateCtrl', [
'$scope',
'$state',
'Category',
function($scope, $state, Category) {
$scope.category = {};
$scope.save = function (category) {
Category.create(category).then(
function(success) {
$state.go('motions.category.list');
}
);
};
}
])
.controller('CategoryUpdateCtrl', [
'$scope',
'$state',
'Category',
'category',
function($scope, $state, Category, category) {
$scope.category = category;
$scope.save = function (category) {
Category.save(category).then(
function(success) {
$state.go('motions.category.list');
}
);
};
}
]);
}());

View File

@ -60,80 +60,92 @@ angular.module('OpenSlidesApp.users', [])
}
])
.factory('User', ['DS', 'Group', 'jsDataModel', function(DS, Group, jsDataModel) {
var name = 'users/user';
return DS.defineResource({
name: name,
useClass: jsDataModel,
computed: {
full_name: function () {
return this.get_full_name();
.factory('User', [
'DS',
'Group',
'jsDataModel',
function(DS, Group, jsDataModel) {
var name = 'users/user';
return DS.defineResource({
name: name,
useClass: jsDataModel,
computed: {
full_name: function () {
return this.get_full_name();
},
short_name: function () {
return this.get_short_name();
},
},
short_name: function () {
return this.get_short_name();
},
},
methods: {
getResourceName: function () {
return name;
},
get_short_name: function() {
// should be the same as in the python user model.
var firstName = _.trim(this.first_name),
lastName = _.trim(this.last_name),
name;
methods: {
getResourceName: function () {
return name;
},
get_short_name: function() {
// should be the same as in the python user model.
var firstName = _.trim(this.first_name),
lastName = _.trim(this.last_name),
name;
if (firstName && lastName) {
// TODO: check config
name = [firstName, lastName].join(' ');
} else {
name = firstName || lastName || this.username;
}
return name;
},
get_full_name: function() {
// should be the same as in the python user model.
var firstName = _.trim(this.first_name),
lastName = _.trim(this.last_name),
structure_level = _.trim(this.structure_level),
name;
if (firstName && lastName) {
// TODO: check config
name = [firstName, lastName].join(' ');
} else {
name = firstName || lastName || this.username;
}
if (structure_level) {
name = name + " (" + structure_level + ")";
}
return name;
},
getPerms: function() {
var allPerms = [];
var allGroups = this.groups;
// Add registered group
allGroups.push(2);
_.forEach(allGroups, function(groupId) {
var group = Group.get(groupId);
if (group) {
_.forEach(group.permissions, function(perm) {
allPerms.push(perm);
});
if (firstName && lastName) {
// TODO: check config
name = [firstName, lastName].join(' ');
} else {
name = firstName || lastName || this.username;
}
});
return _.uniq(allPerms);
return name;
},
get_full_name: function() {
// should be the same as in the python user model.
var firstName = _.trim(this.first_name),
lastName = _.trim(this.last_name),
structure_level = _.trim(this.structure_level),
name;
if (firstName && lastName) {
// TODO: check config
name = [firstName, lastName].join(' ');
} else {
name = firstName || lastName || this.username;
}
if (structure_level) {
name = name + " (" + structure_level + ")";
}
return name;
},
getPerms: function() {
var allPerms = [];
var allGroups = this.groups;
// Add registered group
allGroups.push(2);
_.forEach(allGroups, function(groupId) {
var group = Group.get(groupId);
if (group) {
_.forEach(group.permissions, function(perm) {
allPerms.push(perm);
});
}
});
return _.uniq(allPerms);
},
},
},
});
}])
});
}
])
.factory('Group', ['DS', function(DS) {
return DS.defineResource({
name: 'users/group',
});
}])
.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) {
slidesProvider.registerSlide('users/user', {
template: 'static/templates/users/slide_user.html',
});
})
.config([
'slidesProvider',
function(slidesProvider) {
slidesProvider.registerSlide('users/user', {
template: 'static/templates/users/slide_user.html',
});
}
])
.controller('SlideUserCtrl', 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');
});
.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,120 +18,123 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
}
])
.config(function($stateProvider) {
$stateProvider
.state('users', {
url: '/users',
abstract: true,
template: "<ui-view/>",
})
.state('users.user', {
abstract: true,
template: "<ui-view/>",
})
.state('users.user.list', {
resolve: {
users: function(User) {
return User.findAll();
}
}
})
.state('users.user.create', {
resolve: {
groups: function(Group) {
return Group.findAll();
}
}
})
.state('users.user.detail', {
resolve: {
user: function(User, $stateParams) {
return User.find($stateParams.id);
},
groups: function(Group) {
return Group.findAll();
}
}
})
.state('users.user.detail.profile', {
views: {
'@users.user': {},
},
url: '/profile',
controller: 'UserProfileCtrl',
})
.state('users.user.detail.password', {
views: {
'@users.user': {},
},
url: '/password',
controller: 'UserPasswordCtrl',
})
.state('users.user.import', {
url: '/import',
controller: 'UserImportCtrl',
resolve: {
groups: function(Group) {
return Group.findAll();
}
}
})
// groups
.state('users.group', {
url: '/groups',
abstract: true,
template: "<ui-view/>",
})
.state('users.group.list', {
resolve: {
groups: function(Group) {
return Group.findAll();
}
}
})
.state('users.group.create', {
resolve: {
permissions: function($http) {
return $http({ 'method': 'OPTIONS', 'url': '/rest/users/group/' });
}
}
})
.state('users.group.detail', {
resolve: {
group: function(Group, $stateParams) {
return Group.find($stateParams.id);
}
}
})
.state('users.group.detail.update', {
views: {
'@users.group': {}
},
resolve: {
permissions: function($http) {
return $http({ 'method': 'OPTIONS', 'url': '/rest/users/group/' });
}
}
})
.state('login', {
template: null,
url: '/login',
params: { guest_enabled: false },
onEnter: ['$state', '$stateParams', 'ngDialog', function($state, $stateParams, ngDialog) {
ngDialog.open({
template: 'static/templates/core/login-form.html',
controller: 'LoginFormCtrl',
showClose: $stateParams.guest_enabled,
closeByEscape: $stateParams.guest_enabled,
closeByDocument: $stateParams.guest_enabled,
preCloseCallback: function() {
$state.go('dashboard');
return true;
.config([
'$stateProvider',
function($stateProvider) {
$stateProvider
.state('users', {
url: '/users',
abstract: true,
template: "<ui-view/>",
})
.state('users.user', {
abstract: true,
template: "<ui-view/>",
})
.state('users.user.list', {
resolve: {
users: function(User) {
return User.findAll();
}
});
}]
});
})
}
})
.state('users.user.create', {
resolve: {
groups: function(Group) {
return Group.findAll();
}
}
})
.state('users.user.detail', {
resolve: {
user: function(User, $stateParams) {
return User.find($stateParams.id);
},
groups: function(Group) {
return Group.findAll();
}
}
})
.state('users.user.detail.profile', {
views: {
'@users.user': {},
},
url: '/profile',
controller: 'UserProfileCtrl',
})
.state('users.user.detail.password', {
views: {
'@users.user': {},
},
url: '/password',
controller: 'UserPasswordCtrl',
})
.state('users.user.import', {
url: '/import',
controller: 'UserImportCtrl',
resolve: {
groups: function(Group) {
return Group.findAll();
}
}
})
// groups
.state('users.group', {
url: '/groups',
abstract: true,
template: "<ui-view/>",
})
.state('users.group.list', {
resolve: {
groups: function(Group) {
return Group.findAll();
}
}
})
.state('users.group.create', {
resolve: {
permissions: function($http) {
return $http({ 'method': 'OPTIONS', 'url': '/rest/users/group/' });
}
}
})
.state('users.group.detail', {
resolve: {
group: function(Group, $stateParams) {
return Group.find($stateParams.id);
}
}
})
.state('users.group.detail.update', {
views: {
'@users.group': {}
},
resolve: {
permissions: function($http) {
return $http({ 'method': 'OPTIONS', 'url': '/rest/users/group/' });
}
}
})
.state('login', {
template: null,
url: '/login',
params: { guest_enabled: false },
onEnter: ['$state', '$stateParams', 'ngDialog', function($state, $stateParams, ngDialog) {
ngDialog.open({
template: 'static/templates/core/login-form.html',
controller: 'LoginFormCtrl',
showClose: $stateParams.guest_enabled,
closeByEscape: $stateParams.guest_enabled,
closeByDocument: $stateParams.guest_enabled,
preCloseCallback: function() {
$state.go('dashboard');
return true;
}
});
}]
});
}
])
.run([
'operator',