Reload config after login

Fix errors by saving tags to motions
This commit is contained in:
Oskar Hahn 2015-09-05 11:11:46 +02:00
parent 6acdb3c305
commit fbc57cc23a
2 changed files with 90 additions and 61 deletions

View File

@ -74,7 +74,12 @@ angular.module('OpenSlidesApp.core', [
});
}])
.run(['$rootScope', 'Config', 'Projector', function($rootScope, Config, Projector) {
.factory('loadGlobalData', [
'$rootScope',
'Config',
'Projector',
function ($rootScope, Config, Projector) {
return function () {
// Puts the config object into each scope.
Config.findAll().then(function() {
$rootScope.config = function(key) {
@ -90,6 +95,12 @@ angular.module('OpenSlidesApp.core', [
// Loads all projector data
Projector.findAll();
}
}
])
.run(['loadGlobalData', function(loadGlobalData) {
loadGlobalData();
}])
.factory('jsDataModel', ['$http', 'Projector', function($http, Projector) {
@ -433,7 +444,13 @@ angular.module('OpenSlidesApp.core.site', [
}
})
.controller('LoginFormModalCtrl', function ($scope, $modalInstance, $http, operator) {
.controller('LoginFormModalCtrl', [
'$scope',
'$modalInstance',
'$http',
'operator',
'loadGlobalData',
function ($scope, $modalInstance, $http, operator, loadGlobalData) {
$scope.login = function () {
$http.post(
'/users/login/',
@ -441,6 +458,7 @@ angular.module('OpenSlidesApp.core.site', [
).success(function(data) {
if (data.success) {
operator.setUser(data.user_id);
loadGlobalData();
$scope.loginFailed = false;
$modalInstance.close();
} else {
@ -454,7 +472,8 @@ angular.module('OpenSlidesApp.core.site', [
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
})
}
])
// Version Controller
.controller('VersionCtrl', function ($scope, $http) {

View File

@ -248,7 +248,18 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
};
})
.controller('MotionUpdateCtrl',
.controller('MotionUpdateCtrl', [
'$scope',
'$state',
'$http',
'Motion',
'Agenda',
'User',
'Category',
'Workflow',
'Tag',
'Mediafile',
'motion',
function ($scope, $state, $http, Motion, Agenda, User, Category, Workflow, Tag, Mediafile, motion) {
Agenda.bindAll({}, $scope, 'items');
User.bindAll({}, $scope, 'users');
@ -264,15 +275,14 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
$scope.motion.reason = $scope.motion.getReason(-1);
$scope.save = function (motion) {
motion.tags = []; // TODO: REST API should do it! (Bug in Django REST framework)
motion.attachments = []; // TODO: REST API should do it! (Bug in Django REST framework)
Motion.save(motion).then(
function(success) {
$state.go('motions.motion.list');
}
);
};
})
}
])
.controller('MotionCSVImportCtrl', function($scope, Motion) {
// TODO