Merge pull request #3018 from FinnStutzenstein/ErrorMessages
Error messages and global messaging service (closes #2949)
This commit is contained in:
commit
91cb124918
@ -96,9 +96,10 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
'osTableFilter',
|
'osTableFilter',
|
||||||
'AgendaCsvExport',
|
'AgendaCsvExport',
|
||||||
'PdfCreate',
|
'PdfCreate',
|
||||||
|
'ErrorMessage',
|
||||||
function($scope, $filter, $http, $state, DS, operator, ngDialog, Agenda, TopicForm,
|
function($scope, $filter, $http, $state, DS, operator, ngDialog, Agenda, TopicForm,
|
||||||
AgendaTree, Projector, ProjectionDefault, AgendaContentProvider, PdfMakeDocumentProvider,
|
AgendaTree, Projector, ProjectionDefault, AgendaContentProvider, PdfMakeDocumentProvider,
|
||||||
gettextCatalog, gettext, osTableFilter, AgendaCsvExport, PdfCreate) {
|
gettextCatalog, gettext, osTableFilter, AgendaCsvExport, PdfCreate, ErrorMessage) {
|
||||||
// Bind agenda tree to the scope
|
// Bind agenda tree to the scope
|
||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
return Agenda.lastModified();
|
return Agenda.lastModified();
|
||||||
@ -236,11 +237,7 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
$scope.alert.show = false;
|
$scope.alert.show = false;
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = { type: 'danger', msg: message, show: true };
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// delete related item
|
// delete related item
|
||||||
@ -393,7 +390,8 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
'itemId',
|
'itemId',
|
||||||
'Projector',
|
'Projector',
|
||||||
'ProjectionDefault',
|
'ProjectionDefault',
|
||||||
function ($scope, $filter, Agenda, itemId, Projector, ProjectionDefault) {
|
'ErrorMessage',
|
||||||
|
function ($scope, $filter, Agenda, itemId, Projector, ProjectionDefault, ErrorMessage) {
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
|
|
||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
@ -447,16 +445,16 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
|
|
||||||
// add user to list of speakers
|
// add user to list of speakers
|
||||||
$scope.addSpeaker = function (userId) {
|
$scope.addSpeaker = function (userId) {
|
||||||
$http.post('/rest/agenda/item/' + $scope.item.id + '/manage_speaker/', {'user': userId})
|
$http.post('/rest/agenda/item/' + $scope.item.id + '/manage_speaker/', {'user': userId}).then(
|
||||||
.success(function (data){
|
function (success) {
|
||||||
$scope.alert.show = false;
|
$scope.alert.show = false;
|
||||||
$scope.speakers = $scope.item.speakers;
|
$scope.speakers = $scope.item.speakers;
|
||||||
$scope.speakerSelectBox = {};
|
$scope.speakerSelectBox = {};
|
||||||
})
|
}, function (error) {
|
||||||
.error(function (data){
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
$scope.alert = {type: 'danger', msg: data.detail, show: true};
|
|
||||||
$scope.speakerSelectBox = {};
|
$scope.speakerSelectBox = {};
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// delete speaker(!) from list of speakers
|
// delete speaker(!) from list of speakers
|
||||||
@ -466,11 +464,10 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
{headers: {'Content-Type': 'application/json'},
|
{headers: {'Content-Type': 'application/json'},
|
||||||
data: JSON.stringify({speaker: speakerId})}
|
data: JSON.stringify({speaker: speakerId})}
|
||||||
)
|
)
|
||||||
.success(function(data){
|
.then(function (success) {
|
||||||
$scope.speakers = $scope.item.speakers;
|
$scope.speakers = $scope.item.speakers;
|
||||||
})
|
}, function (error) {
|
||||||
.error(function(data){
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
$scope.alert = { type: 'danger', msg: data.detail, show: true };
|
|
||||||
});
|
});
|
||||||
$scope.speakers = $scope.item.speakers;
|
$scope.speakers = $scope.item.speakers;
|
||||||
};
|
};
|
||||||
@ -486,11 +483,10 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
{headers: {'Content-Type': 'application/json'},
|
{headers: {'Content-Type': 'application/json'},
|
||||||
data: JSON.stringify({speaker: speakersOnList})}
|
data: JSON.stringify({speaker: speakersOnList})}
|
||||||
)
|
)
|
||||||
.success(function(data){
|
.then(function (success) {
|
||||||
$scope.speakers = $scope.item.speakers;
|
$scope.speakers = $scope.item.speakers;
|
||||||
})
|
}, function (error) {
|
||||||
.error(function(data){
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
$scope.alert = { type: 'danger', msg: data.detail, show: true };
|
|
||||||
});
|
});
|
||||||
$scope.speakers = $scope.item.speakers;
|
$scope.speakers = $scope.item.speakers;
|
||||||
};
|
};
|
||||||
@ -529,11 +525,10 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
// begin speech of selected/next speaker
|
// begin speech of selected/next speaker
|
||||||
$scope.beginSpeech = function (speakerId) {
|
$scope.beginSpeech = function (speakerId) {
|
||||||
$http.put('/rest/agenda/item/' + $scope.item.id + '/speak/', {'speaker': speakerId})
|
$http.put('/rest/agenda/item/' + $scope.item.id + '/speak/', {'speaker': speakerId})
|
||||||
.success(function(data){
|
.then(function (success) {
|
||||||
$scope.alert.show = false;
|
$scope.alert.show = false;
|
||||||
})
|
}, function (error) {
|
||||||
.error(function(data){
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
$scope.alert = { type: 'danger', msg: data.detail, show: true };
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -542,10 +537,12 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
$http.delete(
|
$http.delete(
|
||||||
'/rest/agenda/item/' + $scope.item.id + '/speak/',
|
'/rest/agenda/item/' + $scope.item.id + '/speak/',
|
||||||
{headers: {'Content-Type': 'application/json'}, data: {}}
|
{headers: {'Content-Type': 'application/json'}, data: {}}
|
||||||
)
|
).then(
|
||||||
.error(function(data){
|
function (success) {},
|
||||||
$scope.alert = { type: 'danger', msg: data.detail, show: true };
|
function (error) {
|
||||||
});
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
// gets speech duration of selected speaker in seconds
|
// gets speech duration of selected speaker in seconds
|
||||||
$scope.getDuration = function (speaker) {
|
$scope.getDuration = function (speaker) {
|
||||||
@ -576,7 +573,8 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
'$http',
|
'$http',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaTree',
|
'AgendaTree',
|
||||||
function($scope, $http, Agenda, AgendaTree) {
|
'ErrorMessage',
|
||||||
|
function($scope, $http, Agenda, AgendaTree, ErrorMessage) {
|
||||||
// Bind agenda tree to the scope
|
// Bind agenda tree to the scope
|
||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
return Agenda.lastModified();
|
return Agenda.lastModified();
|
||||||
@ -600,7 +598,7 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
).then(
|
).then(
|
||||||
function(success) {},
|
function(success) {},
|
||||||
function(error){
|
function(error){
|
||||||
$scope.alert = {type: 'danger', msg: error.data.detail, show: true};
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -422,9 +422,11 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
'PdfCreate',
|
'PdfCreate',
|
||||||
'AssignmentPhases',
|
'AssignmentPhases',
|
||||||
|
'ErrorMessage',
|
||||||
function($scope, $http, $filter, filterFilter, gettext, ngDialog, AssignmentForm, operator, Assignment,
|
function($scope, $http, $filter, filterFilter, gettext, ngDialog, AssignmentForm, operator, Assignment,
|
||||||
User, assignmentId, Projector, ProjectionDefault, AssignmentContentProvider, BallotContentProvider,
|
User, assignmentId, Projector, ProjectionDefault, AssignmentContentProvider, BallotContentProvider,
|
||||||
PdfMakeDocumentProvider, PdfMakeBallotPaperProvider, gettextCatalog, PdfCreate, AssignmentPhases) {
|
PdfMakeDocumentProvider, PdfMakeBallotPaperProvider, gettextCatalog, PdfCreate, AssignmentPhases,
|
||||||
|
ErrorMessage) {
|
||||||
var assignment = Assignment.get(assignmentId);
|
var assignment = Assignment.get(assignmentId);
|
||||||
User.bindAll({}, $scope, 'users');
|
User.bindAll({}, $scope, 'users');
|
||||||
Assignment.loadRelations(assignment, 'agenda_item');
|
Assignment.loadRelations(assignment, 'agenda_item');
|
||||||
@ -455,12 +457,11 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
// add (nominate) candidate
|
// add (nominate) candidate
|
||||||
$scope.addCandidate = function (userId) {
|
$scope.addCandidate = function (userId) {
|
||||||
$http.post('/rest/assignments/assignment/' + assignment.id + '/candidature_other/', {'user': userId})
|
$http.post('/rest/assignments/assignment/' + assignment.id + '/candidature_other/', {'user': userId})
|
||||||
.success(function(data){
|
.then(function (success){
|
||||||
$scope.alert.show = false;
|
$scope.alert.show = false;
|
||||||
$scope.candidateSelectBox = {};
|
$scope.candidateSelectBox = {};
|
||||||
})
|
}, function (error){
|
||||||
.error(function(data){
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
$scope.alert = { type: 'danger', msg: data.detail, show: true };
|
|
||||||
$scope.candidateSelectBox = {};
|
$scope.candidateSelectBox = {};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -469,29 +470,31 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
$http.delete('/rest/assignments/assignment/' + assignment.id + '/candidature_other/',
|
$http.delete('/rest/assignments/assignment/' + assignment.id + '/candidature_other/',
|
||||||
{headers: {'Content-Type': 'application/json'},
|
{headers: {'Content-Type': 'application/json'},
|
||||||
data: JSON.stringify({user: userId})})
|
data: JSON.stringify({user: userId})})
|
||||||
.error(function(data){
|
.then(function (success) {},
|
||||||
$scope.alert = { type: 'danger', msg: data.detail, show: true };
|
function (error) {
|
||||||
});
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
// add me (nominate self as candidate)
|
// add me (nominate self as candidate)
|
||||||
$scope.addMe = function () {
|
$scope.addMe = function () {
|
||||||
$http.post('/rest/assignments/assignment/' + assignment.id + '/candidature_self/', {})
|
$http.post('/rest/assignments/assignment/' + assignment.id + '/candidature_self/', {}).then(
|
||||||
.success(function(data){
|
function (success) {
|
||||||
$scope.alert.show = false;
|
$scope.alert.show = false;
|
||||||
})
|
}, function (error) {
|
||||||
.error(function(data){
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
$scope.alert = { type: 'danger', msg: data.detail, show: true };
|
}
|
||||||
});
|
);
|
||||||
};
|
};
|
||||||
// remove me (withdraw own candidature)
|
// remove me (withdraw own candidature)
|
||||||
$scope.removeMe = function () {
|
$scope.removeMe = function () {
|
||||||
$http.delete('/rest/assignments/assignment/' + assignment.id + '/candidature_self/')
|
$http.delete('/rest/assignments/assignment/' + assignment.id + '/candidature_self/').then(
|
||||||
.success(function(data){
|
function (success) {
|
||||||
$scope.alert.show = false;
|
$scope.alert.show = false;
|
||||||
})
|
}, function (error) {
|
||||||
.error(function(data){
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
$scope.alert = { type: 'danger', msg: data.detail, show: true };
|
}
|
||||||
});
|
);
|
||||||
};
|
};
|
||||||
// check if current user is already a candidate (elected==false)
|
// check if current user is already a candidate (elected==false)
|
||||||
$scope.isCandidate = function () {
|
$scope.isCandidate = function () {
|
||||||
@ -525,15 +528,14 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
// create new ballot
|
// create new ballot
|
||||||
$scope.createBallot = function () {
|
$scope.createBallot = function () {
|
||||||
$scope.activeTab = 0;
|
$scope.activeTab = 0;
|
||||||
$http.post('/rest/assignments/assignment/' + assignment.id + '/create_poll/')
|
$http.post('/rest/assignments/assignment/' + assignment.id + '/create_poll/').then(
|
||||||
.success(function(data){
|
function (success) {
|
||||||
$scope.alert.show = false;
|
$scope.alert.show = false;
|
||||||
if (assignment.phase === 0) {
|
if (assignment.phase === 0) {
|
||||||
$scope.updatePhase(1);
|
$scope.updatePhase(1);
|
||||||
}
|
}
|
||||||
})
|
}, function (error) {
|
||||||
.error(function(data){
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
$scope.alert = { type: 'danger', msg: data.detail, show: true };
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// delete ballot
|
// delete ballot
|
||||||
@ -562,13 +564,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
})
|
})
|
||||||
.then(function (success) {
|
.then(function (success) {
|
||||||
$scope.alert.show = false;
|
$scope.alert.show = false;
|
||||||
})
|
}, function (error) {
|
||||||
.catch(function(error) {
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
var message = '';
|
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = { type: 'danger', msg: message, show: true };
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -637,7 +634,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
'AssignmentForm',
|
'AssignmentForm',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaUpdate',
|
'AgendaUpdate',
|
||||||
function($scope, $state, Assignment, AssignmentForm, Agenda, AgendaUpdate) {
|
'ErrorMessage',
|
||||||
|
function($scope, $state, Assignment, AssignmentForm, Agenda, AgendaUpdate, ErrorMessage) {
|
||||||
$scope.model = {};
|
$scope.model = {};
|
||||||
// set default value for open posts form field
|
// set default value for open posts form field
|
||||||
$scope.model.open_posts = 1;
|
$scope.model.open_posts = 1;
|
||||||
@ -656,6 +654,9 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
$state.go('assignments.assignment.detail', {id: success.id});
|
$state.go('assignments.assignment.detail', {id: success.id});
|
||||||
}
|
}
|
||||||
$scope.closeThisDialog();
|
$scope.closeThisDialog();
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -670,7 +671,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaUpdate',
|
'AgendaUpdate',
|
||||||
'assignmentId',
|
'assignmentId',
|
||||||
function($scope, $state, Assignment, AssignmentForm, Agenda, AgendaUpdate, assignmentId) {
|
'ErrorMessage',
|
||||||
|
function($scope, $state, Assignment, AssignmentForm, Agenda, AgendaUpdate, assignmentId, ErrorMessage) {
|
||||||
var assignment = Assignment.get(assignmentId);
|
var assignment = Assignment.get(assignmentId);
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
// set initial values for form model by create deep copy of assignment object
|
// set initial values for form model by create deep copy of assignment object
|
||||||
@ -707,11 +709,7 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
// save error: revert all changes by restore
|
// save error: revert all changes by restore
|
||||||
// (refresh) original assignment object from server
|
// (refresh) original assignment object from server
|
||||||
Assignment.refresh(assignment);
|
Assignment.refresh(assignment);
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -725,7 +723,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
'AssignmentPoll',
|
'AssignmentPoll',
|
||||||
'assignmentpollId',
|
'assignmentpollId',
|
||||||
'ballot',
|
'ballot',
|
||||||
function($scope, $filter, gettextCatalog, AssignmentPoll, assignmentpollId, ballot) {
|
'ErrorMessage',
|
||||||
|
function($scope, $filter, gettextCatalog, AssignmentPoll, assignmentpollId, ballot, ErrorMessage) {
|
||||||
// set initial values for form model by create deep copy of assignmentpoll object
|
// set initial values for form model by create deep copy of assignmentpoll object
|
||||||
// so detail view is not updated while editing poll
|
// so detail view is not updated while editing poll
|
||||||
var assignmentpoll = angular.copy(AssignmentPoll.get(assignmentpollId));
|
var assignmentpoll = angular.copy(AssignmentPoll.get(assignmentpollId));
|
||||||
@ -879,13 +878,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
.then(function(success) {
|
.then(function(success) {
|
||||||
$scope.alert.show = false;
|
$scope.alert.show = false;
|
||||||
$scope.closeThisDialog();
|
$scope.closeThisDialog();
|
||||||
})
|
}, function (error) {
|
||||||
.catch(function(error) {
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
var message = '';
|
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = { type: 'danger', msg: message, show: true };
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1156,42 +1156,46 @@ img {
|
|||||||
font-size: 90%;
|
font-size: 90%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Pdf creation status bar **/
|
/** Messaging status bar **/
|
||||||
#pdf-status {
|
#messaging {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 100;
|
z-index: 100000;
|
||||||
}
|
}
|
||||||
#pdf-status-container {
|
#messaging-container {
|
||||||
margin: 0 auto 0 auto;
|
margin: 0 auto 0 auto;
|
||||||
padding: 0px 20px;
|
padding: 0px 20px;
|
||||||
max-width: 1400px;
|
max-width: 1400px;
|
||||||
}
|
}
|
||||||
#pdf-status-container > div {
|
#messaging-container > div {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||||
}
|
}
|
||||||
#pdf-status .generating {
|
#messaging .info {
|
||||||
color: #222;
|
color: #222;
|
||||||
background-color: #bed4de;
|
background-color: #bed4de;
|
||||||
border-color: #46b8da;
|
border-color: #46b8da;
|
||||||
}
|
}
|
||||||
#pdf-status .error {
|
#messaging .error {
|
||||||
color: #a94442;
|
color: #a94442;
|
||||||
background-color: #f2dede;
|
background-color: #f2dede;
|
||||||
border-color: #ebccd1;
|
border-color: #ebccd1;
|
||||||
}
|
}
|
||||||
#pdf-status .finished {
|
#messaging .success {
|
||||||
color: #3c763d;
|
color: #3c763d;
|
||||||
background-color: #dff0d8;
|
background-color: #dff0d8;
|
||||||
border-color: #d6e9c6;
|
border-color: #d6e9c6;
|
||||||
}
|
}
|
||||||
|
#messaging .warning {
|
||||||
|
color: #8a6d3b;
|
||||||
|
background-color: #fcf8e3;
|
||||||
|
border-color: #faebcc;
|
||||||
|
}
|
||||||
|
|
||||||
/** General helper classes **/
|
/** General helper classes **/
|
||||||
|
|
||||||
.disabled {
|
.disabled {
|
||||||
color: #555;
|
color: #555;
|
||||||
cursor: not-allowed !important;
|
cursor: not-allowed !important;
|
||||||
|
@ -47,7 +47,8 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
'REALM',
|
'REALM',
|
||||||
'ProjectorID',
|
'ProjectorID',
|
||||||
'$q',
|
'$q',
|
||||||
function (DS, REALM, ProjectorID, $q) {
|
'ErrorMessage',
|
||||||
|
function (DS, REALM, ProjectorID, $q, ErrorMessage) {
|
||||||
var socket = null;
|
var socket = null;
|
||||||
var recInterval = null;
|
var recInterval = null;
|
||||||
|
|
||||||
@ -82,11 +83,12 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
Autoupdate.newConnect = function () {
|
Autoupdate.newConnect = function () {
|
||||||
socket = new WebSocket(websocketProtocol + '//' + location.host + websocketPath);
|
socket = new WebSocket(websocketProtocol + '//' + location.host + websocketPath);
|
||||||
clearInterval(recInterval);
|
clearInterval(recInterval);
|
||||||
socket.onclose = function () {
|
socket.onclose = function (event) {
|
||||||
socket = null;
|
socket = null;
|
||||||
recInterval = setInterval(function () {
|
recInterval = setInterval(function () {
|
||||||
Autoupdate.newConnect();
|
Autoupdate.newConnect();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
ErrorMessage.setConnectionError();
|
||||||
};
|
};
|
||||||
socket.onmessage = function (event) {
|
socket.onmessage = function (event) {
|
||||||
_.forEach(Autoupdate.messageReceivers, function (receiver) {
|
_.forEach(Autoupdate.messageReceivers, function (receiver) {
|
||||||
@ -96,6 +98,7 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
if (Autoupdate.firstMessageDeferred.promise.$$state.status === 0) {
|
if (Autoupdate.firstMessageDeferred.promise.$$state.status === 0) {
|
||||||
Autoupdate.firstMessageDeferred.resolve();
|
Autoupdate.firstMessageDeferred.resolve();
|
||||||
}
|
}
|
||||||
|
ErrorMessage.clearConnectionError();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
return Autoupdate;
|
return Autoupdate;
|
||||||
@ -460,6 +463,108 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
.factory('ErrorMessage', [
|
||||||
|
'$timeout',
|
||||||
|
'gettextCatalog',
|
||||||
|
'Messaging',
|
||||||
|
function ($timeout, gettextCatalog, Messaging) {
|
||||||
|
return {
|
||||||
|
forAlert: function (error) {
|
||||||
|
var message = gettextCatalog.getString('Error') + ': ';
|
||||||
|
|
||||||
|
if (!error.data) {
|
||||||
|
message += gettextCatalog.getString("The server didn't respond.");
|
||||||
|
} else if (error.data.detail) {
|
||||||
|
message += error.data.detail;
|
||||||
|
} else {
|
||||||
|
for (var e in error.data) {
|
||||||
|
message += e + ': ' + error.data[e] + ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { type: 'danger', msg: message, show: true };
|
||||||
|
},
|
||||||
|
setConnectionError: function () {
|
||||||
|
$timeout(function () {
|
||||||
|
Messaging.createOrEditMessage(
|
||||||
|
'connectionLostMessage',
|
||||||
|
gettextCatalog.getString('Connection lost. You are not connected to the server anymore.'),
|
||||||
|
'error',
|
||||||
|
{noClose: true});
|
||||||
|
}, 1);
|
||||||
|
},
|
||||||
|
clearConnectionError: function () {
|
||||||
|
$timeout(function () {
|
||||||
|
Messaging.deleteMessage('connectionLostMessage');
|
||||||
|
}, 1);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
/* Messaging factory. The text is html-binded into the document, so you can
|
||||||
|
* provide also html markup for the messages. There are 4 types: 'info',
|
||||||
|
* 'success', 'warning', 'error'. The timeout is for autodeleting the message.
|
||||||
|
* Args that could be provided:
|
||||||
|
* - timeout: Milliseconds until autoclose the message
|
||||||
|
* - noClose: Whether to show the close button*/
|
||||||
|
.factory('Messaging', [
|
||||||
|
'$timeout',
|
||||||
|
function($timeout) {
|
||||||
|
var callbackList = [],
|
||||||
|
messages = {},
|
||||||
|
idCounter = 0;
|
||||||
|
|
||||||
|
var onChange = function () {
|
||||||
|
_.forEach(callbackList, function (callback) {
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
addMessage: function (text, type, args) {
|
||||||
|
var id = idCounter++;
|
||||||
|
return this.createOrEditMessage(id, text, type, args);
|
||||||
|
},
|
||||||
|
createOrEditMessage: function (id, text, type, args) {
|
||||||
|
if (!args) {
|
||||||
|
args = {};
|
||||||
|
}
|
||||||
|
if (messages[id] && messages[id].timeout) {
|
||||||
|
$timeout.cancel(messages[id].timeout);
|
||||||
|
}
|
||||||
|
messages[id] = {
|
||||||
|
text: text,
|
||||||
|
type: type,
|
||||||
|
id: id,
|
||||||
|
args: args,
|
||||||
|
};
|
||||||
|
if (typeof args.timeout === 'number' && args.timeout > 0) {
|
||||||
|
var self = this;
|
||||||
|
messages[id].timeout = $timeout(function () {
|
||||||
|
self.deleteMessage(id);
|
||||||
|
}, args.timeout);
|
||||||
|
}
|
||||||
|
onChange();
|
||||||
|
return id;
|
||||||
|
},
|
||||||
|
deleteMessage: function (id) {
|
||||||
|
delete messages[id];
|
||||||
|
onChange();
|
||||||
|
},
|
||||||
|
getMessages: function () {
|
||||||
|
return messages;
|
||||||
|
},
|
||||||
|
registerMessageChangeCallback: function (fn) {
|
||||||
|
if (typeof fn === 'function') {
|
||||||
|
callbackList.push(fn);
|
||||||
|
} else {
|
||||||
|
throw 'fn has to be a function';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
.factory('Tag', [
|
.factory('Tag', [
|
||||||
'DS',
|
'DS',
|
||||||
function(DS) {
|
function(DS) {
|
||||||
|
@ -784,8 +784,9 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
.factory('PdfCreate', [
|
.factory('PdfCreate', [
|
||||||
'$timeout',
|
'$timeout',
|
||||||
'FileSaver',
|
'FileSaver',
|
||||||
function ($timeout, FileSaver) {
|
'Messaging',
|
||||||
var stateChangeCallbacks = [];
|
function ($timeout, FileSaver, Messaging) {
|
||||||
|
var filenameMessageMap = {};
|
||||||
var b64toBlob = function(b64Data) {
|
var b64toBlob = function(b64Data) {
|
||||||
var byteCharacters = atob(b64Data);
|
var byteCharacters = atob(b64Data);
|
||||||
var byteNumbers = new Array(byteCharacters.length);
|
var byteNumbers = new Array(byteCharacters.length);
|
||||||
@ -797,18 +798,36 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
return blob;
|
return blob;
|
||||||
};
|
};
|
||||||
var stateChange = function (state, filename, error) {
|
var stateChange = function (state, filename, error) {
|
||||||
_.forEach(stateChangeCallbacks, function (cb) {
|
var text, timeout;
|
||||||
$timeout(function () {cb(state, filename, error);}, 1);
|
switch (state) {
|
||||||
});
|
case 'info':
|
||||||
|
text = '<i class="fa fa-spinner fa-pulse fa-lg spacer-right"></i>' +
|
||||||
|
'<translate>Generating PDF file ' + filename + ' ...</translate>';
|
||||||
|
break;
|
||||||
|
case 'success':
|
||||||
|
text = '<i class="fa fa-check fa-lg spacer-right"></i>' +
|
||||||
|
'<translate>PDF successfully generated.</translate>';
|
||||||
|
timeout = 3000;
|
||||||
|
break;
|
||||||
|
case 'error':
|
||||||
|
text = '<i class="fa fa-exclamation-triangle fa-lg spacer-right"></i>' +
|
||||||
|
'<translate>Error while generating PDF file</translate> ' + filename + ':' +
|
||||||
|
'<span ng-if="pdf.errorMessage"><code>{{ pdf.errorMessage | translate }}</code></span>' ;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$timeout(function () {
|
||||||
|
filenameMessageMap[filename] = Messaging.createOrEditMessage(
|
||||||
|
filenameMessageMap[filename], text, state, {timeout: timeout});
|
||||||
|
}, 1);
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
download: function (pdfDocument, filename) {
|
download: function (pdfDocument, filename) {
|
||||||
stateChange('generating', filename);
|
stateChange('info', filename);
|
||||||
var pdfWorker = new Worker('/static/js/workers/pdf-worker.js');
|
var pdfWorker = new Worker('/static/js/workers/pdf-worker.js');
|
||||||
|
|
||||||
pdfWorker.addEventListener('message', function (event) {
|
pdfWorker.addEventListener('message', function (event) {
|
||||||
var blob = b64toBlob(event.data);
|
var blob = b64toBlob(event.data);
|
||||||
stateChange('finished', filename);
|
stateChange('success', filename);
|
||||||
FileSaver.saveAs(blob, filename);
|
FileSaver.saveAs(blob, filename);
|
||||||
});
|
});
|
||||||
pdfWorker.addEventListener('error', function (event) {
|
pdfWorker.addEventListener('error', function (event) {
|
||||||
@ -816,43 +835,6 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
});
|
});
|
||||||
pdfWorker.postMessage(JSON.stringify(pdfDocument));
|
pdfWorker.postMessage(JSON.stringify(pdfDocument));
|
||||||
},
|
},
|
||||||
registerStateChangeCallback: function (cb) {
|
|
||||||
if (cb && typeof cb === 'function') {
|
|
||||||
stateChangeCallbacks.push(cb);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
.directive('pdfGenerationStatus', [
|
|
||||||
'$timeout',
|
|
||||||
'PdfCreate',
|
|
||||||
function($timeout, PdfCreate) {
|
|
||||||
return {
|
|
||||||
restrict: 'E',
|
|
||||||
templateUrl: 'static/templates/pdf-status.html',
|
|
||||||
scope: {},
|
|
||||||
controller: function ($scope, $element, $attrs, $location) {
|
|
||||||
$scope.pdfs = {};
|
|
||||||
|
|
||||||
var createStateChange = function (state, filename, error) {
|
|
||||||
$scope.pdfs[filename] = {
|
|
||||||
state: state,
|
|
||||||
errorMessage: error
|
|
||||||
};
|
|
||||||
if (state === 'finished') {
|
|
||||||
$timeout(function () {
|
|
||||||
$scope.close(filename);
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
PdfCreate.registerStateChangeCallback(createStateChange);
|
|
||||||
|
|
||||||
$scope.close = function (filename) {
|
|
||||||
delete $scope.pdfs[filename];
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
@ -806,6 +806,30 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
.directive('messaging', [
|
||||||
|
'$timeout',
|
||||||
|
'Messaging',
|
||||||
|
function ($timeout, Messaging) {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'static/templates/messaging.html',
|
||||||
|
scope: {},
|
||||||
|
controller: function ($scope, $element, $attrs, $location) {
|
||||||
|
$scope.messages = {};
|
||||||
|
|
||||||
|
var update = function () {
|
||||||
|
$scope.messages = Messaging.getMessages();
|
||||||
|
};
|
||||||
|
Messaging.registerMessageChangeCallback(update);
|
||||||
|
|
||||||
|
$scope.close = function (id) {
|
||||||
|
Messaging.deleteMessage(id);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
.controller('MainMenuCtrl', [
|
.controller('MainMenuCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'mainMenu',
|
'mainMenu',
|
||||||
@ -893,9 +917,9 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
'$scope',
|
'$scope',
|
||||||
'$http',
|
'$http',
|
||||||
function ($scope, $http) {
|
function ($scope, $http) {
|
||||||
$http.get('/core/version/').success(function(data) {
|
$http.get('/core/version/').then(function (success) {
|
||||||
$scope.core_version = data.openslides_version;
|
$scope.core_version = success.data.openslides_version;
|
||||||
$scope.plugins = data.plugins;
|
$scope.plugins = success.data.plugins;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
@ -1424,7 +1448,8 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
'ngDialog',
|
'ngDialog',
|
||||||
'TagForm',
|
'TagForm',
|
||||||
'gettext',
|
'gettext',
|
||||||
function($scope, Tag, ngDialog, TagForm, gettext) {
|
'ErrorMessage',
|
||||||
|
function($scope, Tag, ngDialog, TagForm, gettext, ErrorMessage) {
|
||||||
Tag.bindAll({}, $scope, 'tags');
|
Tag.bindAll({}, $scope, 'tags');
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
|
|
||||||
@ -1447,11 +1472,7 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
show: true,
|
show: true,
|
||||||
};
|
};
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -1465,7 +1486,8 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
'$scope',
|
'$scope',
|
||||||
'Tag',
|
'Tag',
|
||||||
'TagForm',
|
'TagForm',
|
||||||
function($scope, Tag, TagForm) {
|
'ErrorMessage',
|
||||||
|
function($scope, Tag, TagForm, ErrorMessage) {
|
||||||
$scope.model = {};
|
$scope.model = {};
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
$scope.formFields = TagForm.getFormFields();
|
$scope.formFields = TagForm.getFormFields();
|
||||||
@ -1475,11 +1497,7 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
$scope.closeThisDialog();
|
$scope.closeThisDialog();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -1491,7 +1509,8 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
'Tag',
|
'Tag',
|
||||||
'tagId',
|
'tagId',
|
||||||
'TagForm',
|
'TagForm',
|
||||||
function($scope, Tag, tagId, TagForm) {
|
'ErrorMessage',
|
||||||
|
function($scope, Tag, tagId, TagForm, ErrorMessage) {
|
||||||
$scope.model = angular.copy(Tag.get(tagId));
|
$scope.model = angular.copy(Tag.get(tagId));
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
$scope.formFields = TagForm.getFormFields();
|
$scope.formFields = TagForm.getFormFields();
|
||||||
@ -1503,11 +1522,7 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
// save error: revert all changes by restore
|
// save error: revert all changes by restore
|
||||||
// the original object
|
// the original object
|
||||||
Tag.refresh(tag);
|
Tag.refresh(tag);
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1541,16 +1556,14 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
$http.post(
|
$http.post(
|
||||||
'/rest/core/chat-message/',
|
'/rest/core/chat-message/',
|
||||||
{message: $scope.newMessage}
|
{message: $scope.newMessage}
|
||||||
)
|
).then(function (success) {
|
||||||
.success(function () {
|
|
||||||
$scope.newMessage = '';
|
$scope.newMessage = '';
|
||||||
angular.element('#messageSendButton').removeClass('disabled');
|
angular.element('#messageSendButton').removeClass('disabled');
|
||||||
angular.element('#messageInput').removeAttr('disabled');
|
angular.element('#messageInput').removeAttr('disabled');
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
angular.element('#messageInput').focus();
|
angular.element('#messageInput').focus();
|
||||||
}, 0);
|
}, 0);
|
||||||
})
|
}, function (error) {
|
||||||
.error(function () {
|
|
||||||
angular.element('#messageSendButton').removeClass('disabled');
|
angular.element('#messageSendButton').removeClass('disabled');
|
||||||
angular.element('#messageInput').removeAttr('disabled');
|
angular.element('#messageInput').removeAttr('disabled');
|
||||||
});
|
});
|
||||||
|
@ -14,15 +14,15 @@ angular.module('OpenSlidesApp.core.start', [])
|
|||||||
'mainMenu',
|
'mainMenu',
|
||||||
function($http, $rootScope, $state, autoupdate, operator, Group, mainMenu) {
|
function($http, $rootScope, $state, autoupdate, operator, Group, mainMenu) {
|
||||||
$rootScope.openslidesBootstrapDone = false;
|
$rootScope.openslidesBootstrapDone = false;
|
||||||
$http.get('/users/whoami/').success(function(data) {
|
$http.get('/users/whoami/').then(function (success) {
|
||||||
$rootScope.guest_enabled = data.guest_enabled;
|
$rootScope.guest_enabled = success.data.guest_enabled;
|
||||||
if (data.user_id === null && !data.guest_enabled) {
|
if (success.data.user_id === null && !success.data.guest_enabled) {
|
||||||
// Redirect to login dialog if user is not logged in.
|
// Redirect to login dialog if user is not logged in.
|
||||||
$state.go('login', {guest_enabled: data.guest_enabled});
|
$state.go('login', {guest_enabled: success.data.guest_enabled});
|
||||||
} else {
|
} else {
|
||||||
autoupdate.newConnect();
|
autoupdate.newConnect();
|
||||||
autoupdate.firstMessageDeferred.promise.then(function () {
|
autoupdate.firstMessageDeferred.promise.then(function () {
|
||||||
operator.setUser(data.user_id, data.user);
|
operator.setUser(success.data.user_id, success.data.user);
|
||||||
$rootScope.operator = operator;
|
$rootScope.operator = operator;
|
||||||
mainMenu.updateMainMenu();
|
mainMenu.updateMainMenu();
|
||||||
$rootScope.openslidesBootstrapDone = true;
|
$rootScope.openslidesBootstrapDone = true;
|
||||||
|
@ -218,7 +218,7 @@
|
|||||||
</div><!--end content-container-->
|
</div><!--end content-container-->
|
||||||
</div><!--end content-->
|
</div><!--end content-->
|
||||||
|
|
||||||
<pdf-generation-status></pdf-generation-status>
|
<messaging></messaging>
|
||||||
|
|
||||||
</div><!--end wrapper-->
|
</div><!--end wrapper-->
|
||||||
|
|
||||||
|
10
openslides/core/static/templates/messaging.html
Normal file
10
openslides/core/static/templates/messaging.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<div id="messaging">
|
||||||
|
<div id="messaging-container">
|
||||||
|
<div ng-repeat="(id, message) in messages" ng-class="message.type">
|
||||||
|
|
||||||
|
<span class="close fa fa-times fa-lg" ng-click="close(id)" ng-if="!message.args.noClose"></span>
|
||||||
|
<span ng-bind-html="message.text | trusted"></span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -9,7 +9,8 @@ angular.module('OpenSlidesApp.mediafiles.create', [
|
|||||||
.controller('MediafileCreateCtrl', [
|
.controller('MediafileCreateCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'MediafileForm',
|
'MediafileForm',
|
||||||
function ($scope, MediafileForm) {
|
'ErrorMessage',
|
||||||
|
function ($scope, MediafileForm, ErrorMessage) {
|
||||||
$scope.model = {};
|
$scope.model = {};
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
$scope.formFields = MediafileForm.getFormFields(true);
|
$scope.formFields = MediafileForm.getFormFields(true);
|
||||||
@ -23,11 +24,7 @@ angular.module('OpenSlidesApp.mediafiles.create', [
|
|||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
$scope.activeUpload = void 0;
|
$scope.activeUpload = void 0;
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
},
|
},
|
||||||
function (progress) {
|
function (progress) {
|
||||||
$scope.progress = parseInt(100.0 * progress.loaded / progress.total);
|
$scope.progress = parseInt(100.0 * progress.loaded / progress.total);
|
||||||
|
@ -14,7 +14,8 @@ angular.module('OpenSlidesApp.mediafiles.update', [
|
|||||||
'Mediafile',
|
'Mediafile',
|
||||||
'mediafileId',
|
'mediafileId',
|
||||||
'MediafileForm',
|
'MediafileForm',
|
||||||
function ($scope, operator, User, Mediafile, mediafileId, MediafileForm) {
|
'ErrorMessage',
|
||||||
|
function ($scope, operator, User, Mediafile, mediafileId, MediafileForm, ErrorMessage) {
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
$scope.formFields = MediafileForm.getFormFields();
|
$scope.formFields = MediafileForm.getFormFields();
|
||||||
|
|
||||||
@ -40,11 +41,7 @@ angular.module('OpenSlidesApp.mediafiles.update', [
|
|||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
Mediafile.refresh(mediafile);
|
Mediafile.refresh(mediafile);
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -144,7 +144,8 @@ angular.module('OpenSlidesApp.motions.motionBlock', [])
|
|||||||
'motionBlockId',
|
'motionBlockId',
|
||||||
'Projector',
|
'Projector',
|
||||||
'ProjectionDefault',
|
'ProjectionDefault',
|
||||||
function($scope, $http, ngDialog, Motion, MotionBlockForm, MotionBlock, motionBlockId, Projector, ProjectionDefault) {
|
'ErrorMessage',
|
||||||
|
function($scope, $http, ngDialog, Motion, MotionBlockForm, MotionBlock, motionBlockId, Projector, ProjectionDefault, ErrorMessage) {
|
||||||
MotionBlock.bindOne(motionBlockId, $scope, 'motionBlock');
|
MotionBlock.bindOne(motionBlockId, $scope, 'motionBlock');
|
||||||
Motion.bindAll({}, $scope, 'motions');
|
Motion.bindAll({}, $scope, 'motions');
|
||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
@ -159,12 +160,11 @@ angular.module('OpenSlidesApp.motions.motionBlock', [])
|
|||||||
ngDialog.open(MotionBlockForm.getDialog(motionBlock));
|
ngDialog.open(MotionBlockForm.getDialog(motionBlock));
|
||||||
};
|
};
|
||||||
$scope.followRecommendations = function () {
|
$scope.followRecommendations = function () {
|
||||||
$http.post('/rest/motions/motion-block/' + motionBlockId + '/follow_recommendations/')
|
$http.post('/rest/motions/motion-block/' + motionBlockId + '/follow_recommendations/').then(
|
||||||
.success(function(data) {
|
function (success) {
|
||||||
$scope.alert = { type: 'success', msg: data.detail, show: true };
|
$scope.alert = { type: 'success', msg: success.data.detail, show: true };
|
||||||
})
|
}, function (error) {
|
||||||
.error(function(data) {
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
$scope.alert = { type: 'danger', msg: data.detail, show: true };
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.delete = function (motion) {
|
$scope.delete = function (motion) {
|
||||||
|
@ -30,8 +30,8 @@ angular.module('OpenSlidesApp.motions.motionservices', ['OpenSlidesApp.motions',
|
|||||||
return element.getAttribute("src");
|
return element.getAttribute("src");
|
||||||
});
|
});
|
||||||
|
|
||||||
$http.post('/core/encode_media/', JSON.stringify(image_sources)).success(function(data) {
|
$http.post('/core/encode_media/', JSON.stringify(image_sources)).then(function (success) {
|
||||||
var converter = PdfMakeConverter.createInstance(data.images);
|
var converter = PdfMakeConverter.createInstance(sucess.data.images);
|
||||||
var motionContentProvider = MotionContentProvider.createInstance(converter, $scope.motion, $scope, User, $http);
|
var motionContentProvider = MotionContentProvider.createInstance(converter, $scope.motion, $scope, User, $http);
|
||||||
var documentProvider = PdfMakeDocumentProvider.createInstance(motionContentProvider);
|
var documentProvider = PdfMakeDocumentProvider.createInstance(motionContentProvider);
|
||||||
var identifier = $scope.motion.identifier ? '-' + $scope.motion.identifier : '';
|
var identifier = $scope.motion.identifier ? '-' + $scope.motion.identifier : '';
|
||||||
|
@ -912,8 +912,8 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
});
|
});
|
||||||
|
|
||||||
//post-request to convert the images. Async.
|
//post-request to convert the images. Async.
|
||||||
$http.post('/core/encode_media/', JSON.stringify(image_sources)).success(function(data) {
|
$http.post('/core/encode_media/', JSON.stringify(image_sources)).then(function (success) {
|
||||||
var converter = PdfMakeConverter.createInstance(data.images);
|
var converter = PdfMakeConverter.createInstance(success.data.images);
|
||||||
var motionContentProviderArray = [];
|
var motionContentProviderArray = [];
|
||||||
|
|
||||||
//convert the filtered motions to motionContentProviders
|
//convert the filtered motions to motionContentProviders
|
||||||
@ -1313,7 +1313,8 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'MotionChangeRecommendation',
|
'MotionChangeRecommendation',
|
||||||
'ChangeRecommendationForm',
|
'ChangeRecommendationForm',
|
||||||
'change',
|
'change',
|
||||||
function ($scope, MotionChangeRecommendation, ChangeRecommendationForm, change) {
|
'ErrorMessage',
|
||||||
|
function ($scope, MotionChangeRecommendation, ChangeRecommendationForm, change, ErrorMessage) {
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
$scope.model = angular.copy(change);
|
$scope.model = angular.copy(change);
|
||||||
|
|
||||||
@ -1330,11 +1331,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
MotionChangeRecommendation.refresh(change);
|
MotionChangeRecommendation.refresh(change);
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -1397,8 +1394,9 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'Workflow',
|
'Workflow',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaUpdate',
|
'AgendaUpdate',
|
||||||
|
'ErrorMessage',
|
||||||
function($scope, $state, gettext, gettextCatalog, operator, Motion, MotionForm,
|
function($scope, $state, gettext, gettextCatalog, operator, Motion, MotionForm,
|
||||||
Category, Config, Mediafile, Tag, User, Workflow, Agenda, AgendaUpdate) {
|
Category, Config, Mediafile, Tag, User, Workflow, Agenda, AgendaUpdate, ErrorMessage) {
|
||||||
Category.bindAll({}, $scope, 'categories');
|
Category.bindAll({}, $scope, 'categories');
|
||||||
Mediafile.bindAll({}, $scope, 'mediafiles');
|
Mediafile.bindAll({}, $scope, 'mediafiles');
|
||||||
Tag.bindAll({}, $scope, 'tags');
|
Tag.bindAll({}, $scope, 'tags');
|
||||||
@ -1445,11 +1443,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
$scope.closeThisDialog();
|
$scope.closeThisDialog();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -1470,8 +1464,9 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaUpdate',
|
'AgendaUpdate',
|
||||||
'motionId',
|
'motionId',
|
||||||
|
'ErrorMessage',
|
||||||
function($scope, $state, Motion, Category, Config, Mediafile, MotionForm, Tag,
|
function($scope, $state, Motion, Category, Config, Mediafile, MotionForm, Tag,
|
||||||
User, Workflow, Agenda, AgendaUpdate, motionId) {
|
User, Workflow, Agenda, AgendaUpdate, motionId, ErrorMessage) {
|
||||||
Category.bindAll({}, $scope, 'categories');
|
Category.bindAll({}, $scope, 'categories');
|
||||||
Mediafile.bindAll({}, $scope, 'mediafiles');
|
Mediafile.bindAll({}, $scope, 'mediafiles');
|
||||||
Tag.bindAll({}, $scope, 'tags');
|
Tag.bindAll({}, $scope, 'tags');
|
||||||
@ -1547,11 +1542,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
// save error: revert all changes by restore
|
// save error: revert all changes by restore
|
||||||
// (refresh) original motion object from server
|
// (refresh) original motion object from server
|
||||||
Motion.refresh(motion);
|
Motion.refresh(motion);
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -1565,7 +1556,9 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'MotionPollForm',
|
'MotionPollForm',
|
||||||
'motionpollId',
|
'motionpollId',
|
||||||
'voteNumber',
|
'voteNumber',
|
||||||
function($scope, gettextCatalog, MotionPoll, MotionPollForm, motionpollId, voteNumber) {
|
'ErrorMessage',
|
||||||
|
function($scope, gettextCatalog, MotionPoll, MotionPollForm, motionpollId,
|
||||||
|
voteNumber, ErrorMessage) {
|
||||||
// set initial values for form model by create deep copy of motionpoll object
|
// set initial values for form model by create deep copy of motionpoll object
|
||||||
// so detail view is not updated while editing poll
|
// so detail view is not updated while editing poll
|
||||||
var motionpoll = MotionPoll.get(motionpollId);
|
var motionpoll = MotionPoll.get(motionpollId);
|
||||||
@ -1586,13 +1579,8 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
.then(function(success) {
|
.then(function(success) {
|
||||||
$scope.alert.show = false;
|
$scope.alert.show = false;
|
||||||
$scope.closeThisDialog();
|
$scope.closeThisDialog();
|
||||||
})
|
}, function(error) {
|
||||||
.catch(function(error) {
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
var message = '';
|
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = { type: 'danger', msg: message, show: true };
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1865,7 +1853,8 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'$scope',
|
'$scope',
|
||||||
'Category',
|
'Category',
|
||||||
'CategoryForm',
|
'CategoryForm',
|
||||||
function($scope, Category, CategoryForm) {
|
'ErrorMessage',
|
||||||
|
function($scope, Category, CategoryForm, ErrorMessage) {
|
||||||
$scope.model = {};
|
$scope.model = {};
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
$scope.formFields = CategoryForm.getFormFields();
|
$scope.formFields = CategoryForm.getFormFields();
|
||||||
@ -1875,11 +1864,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
$scope.closeThisDialog();
|
$scope.closeThisDialog();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -1891,7 +1876,8 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'Category',
|
'Category',
|
||||||
'categoryId',
|
'categoryId',
|
||||||
'CategoryForm',
|
'CategoryForm',
|
||||||
function($scope, Category, categoryId, CategoryForm) {
|
'ErrorMessage',
|
||||||
|
function($scope, Category, categoryId, CategoryForm, ErrorMessage) {
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
$scope.model = angular.copy(Category.get(categoryId));
|
$scope.model = angular.copy(Category.get(categoryId));
|
||||||
$scope.formFields = CategoryForm.getFormFields();
|
$scope.formFields = CategoryForm.getFormFields();
|
||||||
@ -1905,11 +1891,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
// save error: revert all changes by restore
|
// save error: revert all changes by restore
|
||||||
// (refresh) original category object from server
|
// (refresh) original category object from server
|
||||||
Category.refresh(category);
|
Category.refresh(category);
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -1924,7 +1906,8 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'Category',
|
'Category',
|
||||||
'categoryId',
|
'categoryId',
|
||||||
'Motion',
|
'Motion',
|
||||||
function($scope, $stateParams, $http, MotionList, Category, categoryId, Motion) {
|
'ErrorMessage',
|
||||||
|
function($scope, $stateParams, $http, MotionList, Category, categoryId, Motion, ErrorMessage) {
|
||||||
Category.bindOne(categoryId, $scope, 'category');
|
Category.bindOne(categoryId, $scope, 'category');
|
||||||
Motion.bindAll({}, $scope, 'motions');
|
Motion.bindAll({}, $scope, 'motions');
|
||||||
$scope.filter = { category_id: categoryId,
|
$scope.filter = { category_id: categoryId,
|
||||||
@ -1951,12 +1934,11 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
|
|
||||||
// renumber them
|
// renumber them
|
||||||
$http.post('/rest/motions/category/' + $scope.category.id + '/numbering/',
|
$http.post('/rest/motions/category/' + $scope.category.id + '/numbering/',
|
||||||
{'motions': sorted_motions} )
|
{'motions': sorted_motions} ).then(
|
||||||
.success(function(data) {
|
function (success) {
|
||||||
$scope.alert = { type: 'success', msg: data.detail, show: true };
|
$scope.alert = { type: 'success', msg: success.data.detail, show: true };
|
||||||
})
|
}, function (error) {
|
||||||
.error(function(data) {
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
$scope.alert = { type: 'danger', msg: data.detail, show: true };
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,8 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
'TopicForm',
|
'TopicForm',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaUpdate',
|
'AgendaUpdate',
|
||||||
function($scope, $state, Topic, TopicForm, Agenda, AgendaUpdate) {
|
'ErrorMessage',
|
||||||
|
function($scope, $state, Topic, TopicForm, Agenda, AgendaUpdate, ErrorMessage) {
|
||||||
$scope.topic = {};
|
$scope.topic = {};
|
||||||
$scope.model = {};
|
$scope.model = {};
|
||||||
$scope.model.showAsAgendaItem = true;
|
$scope.model.showAsAgendaItem = true;
|
||||||
@ -193,8 +194,11 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
var changes = [{key: 'type', value: (topic.showAsAgendaItem ? 1 : 2)},
|
var changes = [{key: 'type', value: (topic.showAsAgendaItem ? 1 : 2)},
|
||||||
{key: 'parent_id', value: topic.agenda_parent_item_id}];
|
{key: 'parent_id', value: topic.agenda_parent_item_id}];
|
||||||
AgendaUpdate.saveChanges(success.agenda_item_id,changes);
|
AgendaUpdate.saveChanges(success.agenda_item_id,changes);
|
||||||
});
|
|
||||||
$scope.closeThisDialog();
|
$scope.closeThisDialog();
|
||||||
|
}, function (error) {
|
||||||
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
@ -207,7 +211,8 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaUpdate',
|
'AgendaUpdate',
|
||||||
'topicId',
|
'topicId',
|
||||||
function($scope, $state, Topic, TopicForm, Agenda, AgendaUpdate, topicId) {
|
'ErrorMessage',
|
||||||
|
function($scope, $state, Topic, TopicForm, Agenda, AgendaUpdate, topicId, ErrorMessage) {
|
||||||
var topic = Topic.get(topicId);
|
var topic = Topic.get(topicId);
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
// set initial values for form model by create deep copy of topic object
|
// set initial values for form model by create deep copy of topic object
|
||||||
@ -237,11 +242,7 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
// save error: revert all changes by restore
|
// save error: revert all changes by restore
|
||||||
// (refresh) original topic object from server
|
// (refresh) original topic object from server
|
||||||
Topic.refresh(topic);
|
Topic.refresh(topic);
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -603,11 +603,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
$scope.alert.show = false;
|
$scope.alert.show = false;
|
||||||
},
|
},
|
||||||
function(error){
|
function(error){
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = { type: 'danger', msg: message, show: true };
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// delete single user
|
// delete single user
|
||||||
@ -744,7 +740,8 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
'User',
|
'User',
|
||||||
'UserForm',
|
'UserForm',
|
||||||
'Group',
|
'Group',
|
||||||
function($scope, $state, User, UserForm, Group) {
|
'ErrorMessage',
|
||||||
|
function($scope, $state, User, UserForm, Group, ErrorMessage) {
|
||||||
Group.bindAll({where: {id: {'>': 2}}}, $scope, 'groups');
|
Group.bindAll({where: {id: {'>': 2}}}, $scope, 'groups');
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
// get all form fields
|
// get all form fields
|
||||||
@ -760,11 +757,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
$scope.closeThisDialog();
|
$scope.closeThisDialog();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -779,7 +772,8 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
'UserForm',
|
'UserForm',
|
||||||
'Group',
|
'Group',
|
||||||
'userId',
|
'userId',
|
||||||
function($scope, $state, $http, User, UserForm, Group, userId) {
|
'ErrorMessage',
|
||||||
|
function($scope, $state, $http, User, UserForm, Group, userId, ErrorMessage) {
|
||||||
Group.bindAll({where: {id: {'>': 2}}}, $scope, 'groups');
|
Group.bindAll({where: {id: {'>': 2}}}, $scope, 'groups');
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
// set initial values for form model by create deep copy of user object
|
// set initial values for form model by create deep copy of user object
|
||||||
@ -805,11 +799,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
// save error: revert all changes by restore
|
// save error: revert all changes by restore
|
||||||
// (refresh) original user object from server
|
// (refresh) original user object from server
|
||||||
User.refresh(user);
|
User.refresh(user);
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -823,7 +813,8 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
'operator',
|
'operator',
|
||||||
'UserProfileForm',
|
'UserProfileForm',
|
||||||
'gettext',
|
'gettext',
|
||||||
function($scope, Editor, User, operator, UserProfileForm, gettext) {
|
'ErrorMessage',
|
||||||
|
function($scope, Editor, User, operator, UserProfileForm, gettext, ErrorMessage) {
|
||||||
$scope.model = angular.copy(operator.user);
|
$scope.model = angular.copy(operator.user);
|
||||||
$scope.title = gettext('Edit profile');
|
$scope.title = gettext('Edit profile');
|
||||||
$scope.formFields = UserProfileForm.getFormFields();
|
$scope.formFields = UserProfileForm.getFormFields();
|
||||||
@ -837,11 +828,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
// save error: revert all changes by restore
|
// save error: revert all changes by restore
|
||||||
// (refresh) original user object from server
|
// (refresh) original user object from server
|
||||||
User.refresh(user);
|
User.refresh(user);
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -856,7 +843,8 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
'userId',
|
'userId',
|
||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
'PasswordGenerator',
|
'PasswordGenerator',
|
||||||
function($scope, $state, $http, User, userId, gettextCatalog, PasswordGenerator) {
|
'ErrorMessage',
|
||||||
|
function($scope, $state, $http, User, userId, gettextCatalog, PasswordGenerator, ErrorMessage) {
|
||||||
User.bindOne(userId, $scope, 'user');
|
User.bindOne(userId, $scope, 'user');
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
$scope.generatePassword = function () {
|
$scope.generatePassword = function () {
|
||||||
@ -873,7 +861,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
$scope.new_password = '';
|
$scope.new_password = '';
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
$scope.alert = {type: 'danger', msg: error.data.detail, show: true};
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -887,7 +875,8 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
'$http',
|
'$http',
|
||||||
'gettext',
|
'gettext',
|
||||||
'UserPasswordForm',
|
'UserPasswordForm',
|
||||||
function($scope, $state, $http, gettext, UserPasswordForm) {
|
'ErrorMessage',
|
||||||
|
function($scope, $state, $http, gettext, UserPasswordForm, ErrorMessage) {
|
||||||
$scope.title = 'Change password';
|
$scope.title = 'Change password';
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
$scope.model = {};
|
$scope.model = {};
|
||||||
@ -911,12 +900,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
function (error) {
|
function (error) {
|
||||||
// Error, e. g. wrong old password.
|
// Error, e. g. wrong old password.
|
||||||
$scope.model = {};
|
$scope.model = {};
|
||||||
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
var message = '';
|
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = {type: 'danger', msg: message, show: true};
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1362,7 +1346,8 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
'$scope',
|
'$scope',
|
||||||
'Group',
|
'Group',
|
||||||
'group',
|
'group',
|
||||||
function($scope, Group, group) {
|
'ErrorMessage',
|
||||||
|
function($scope, Group, group, ErrorMessage) {
|
||||||
$scope.group = group;
|
$scope.group = group;
|
||||||
$scope.new_name = group.name;
|
$scope.new_name = group.name;
|
||||||
|
|
||||||
@ -1375,11 +1360,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
$scope.closeThisDialog();
|
$scope.closeThisDialog();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = { msg: message, show: true };
|
|
||||||
$scope.group.name = old_name;
|
$scope.group.name = old_name;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -1390,7 +1371,8 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
.controller('GroupCreateCtrl', [
|
.controller('GroupCreateCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'Group',
|
'Group',
|
||||||
function($scope, Group) {
|
'ErrorMessage',
|
||||||
|
function($scope, Group, ErrorMessage) {
|
||||||
$scope.new_name = '';
|
$scope.new_name = '';
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
|
|
||||||
@ -1405,11 +1387,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
$scope.closeThisDialog();
|
$scope.closeThisDialog();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
var message = '';
|
$scope.alert = ErrorMessage.forAlert(error);
|
||||||
for (var e in error.data) {
|
|
||||||
message += e + ': ' + error.data[e] + ' ';
|
|
||||||
}
|
|
||||||
$scope.alert = { msg: message, show: true };
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -1469,11 +1447,11 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
$scope.guestAllowed = $rootScope.guest_enabled;
|
$scope.guestAllowed = $rootScope.guest_enabled;
|
||||||
|
|
||||||
// get login info-text from server
|
// get login info-text from server
|
||||||
$http.get('/users/login/').success(function(data) {
|
$http.get('/users/login/').then(function (success) {
|
||||||
if(data.info_text) {
|
if(success.data.info_text) {
|
||||||
$scope.alerts.push({
|
$scope.alerts.push({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
msg: data.info_text
|
msg: success.data.info_text
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user