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. // Puts the config object into each scope.
Config.findAll().then(function() { Config.findAll().then(function() {
$rootScope.config = function(key) { $rootScope.config = function(key) {
@ -90,6 +95,12 @@ angular.module('OpenSlidesApp.core', [
// Loads all projector data // Loads all projector data
Projector.findAll(); Projector.findAll();
}
}
])
.run(['loadGlobalData', function(loadGlobalData) {
loadGlobalData();
}]) }])
.factory('jsDataModel', ['$http', 'Projector', function($http, Projector) { .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 () { $scope.login = function () {
$http.post( $http.post(
'/users/login/', '/users/login/',
@ -441,6 +458,7 @@ angular.module('OpenSlidesApp.core.site', [
).success(function(data) { ).success(function(data) {
if (data.success) { if (data.success) {
operator.setUser(data.user_id); operator.setUser(data.user_id);
loadGlobalData();
$scope.loginFailed = false; $scope.loginFailed = false;
$modalInstance.close(); $modalInstance.close();
} else { } else {
@ -454,10 +472,11 @@ angular.module('OpenSlidesApp.core.site', [
$scope.cancel = function () { $scope.cancel = function () {
$modalInstance.dismiss('cancel'); $modalInstance.dismiss('cancel');
}; };
}) }
])
// Version Controller // Version Controller
.controller('VersionCtrl', function($scope, $http) { .controller('VersionCtrl', function ($scope, $http) {
$http.get('/core/version/').success(function(data) { $http.get('/core/version/').success(function(data) {
$scope.core_version = data.openslides_version; $scope.core_version = data.openslides_version;
$scope.plugins = data.plugins; $scope.plugins = data.plugins;

View File

@ -248,8 +248,19 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
}; };
}) })
.controller('MotionUpdateCtrl', .controller('MotionUpdateCtrl', [
function($scope, $state, $http, Motion, Agenda, User, Category, Workflow, Tag, Mediafile, motion) { '$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'); Agenda.bindAll({}, $scope, 'items');
User.bindAll({}, $scope, 'users'); User.bindAll({}, $scope, 'users');
Category.bindAll({}, $scope, 'categories'); Category.bindAll({}, $scope, 'categories');
@ -264,15 +275,14 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
$scope.motion.reason = $scope.motion.getReason(-1); $scope.motion.reason = $scope.motion.getReason(-1);
$scope.save = function (motion) { $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( Motion.save(motion).then(
function(success) { function(success) {
$state.go('motions.motion.list'); $state.go('motions.motion.list');
} }
); );
}; };
}) }
])
.controller('MotionCSVImportCtrl', function($scope, Motion) { .controller('MotionCSVImportCtrl', function($scope, Motion) {
// TODO // TODO