Merge pull request #1612 from ostcar/motion_tag_save

Reload config after login
This commit is contained in:
Oskar Hahn 2015-09-05 11:32:52 +02:00
commit 948e776d33
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,10 +472,11 @@ angular.module('OpenSlidesApp.core.site', [
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
})
}
])
// Version Controller
.controller('VersionCtrl', function($scope, $http) {
.controller('VersionCtrl', function ($scope, $http) {
$http.get('/core/version/').success(function(data) {
$scope.core_version = data.openslides_version;
$scope.plugins = data.plugins;

View File

@ -248,8 +248,19 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
};
})
.controller('MotionUpdateCtrl',
function($scope, $state, $http, Motion, Agenda, User, Category, Workflow, Tag, Mediafile, motion) {
.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');
Category.bindAll({}, $scope, 'categories');
@ -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