Merge pull request #2886 from FinnStutzenstein/Resolver
Removing unnecessary resolvers (closes #2869)
This commit is contained in:
commit
29907c83b7
@ -23,10 +23,14 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
|
|||||||
|
|
||||||
.factory('AgendaUpdate',[
|
.factory('AgendaUpdate',[
|
||||||
'Agenda',
|
'Agenda',
|
||||||
function(Agenda) {
|
'operator',
|
||||||
|
function(Agenda, operator) {
|
||||||
return {
|
return {
|
||||||
saveChanges: function (item_id, changes) {
|
saveChanges: function (item_id, changes) {
|
||||||
Agenda.find(item_id).then(function(item) {
|
// change agenda item only if user has the permission to do that
|
||||||
|
if (operator.hasPerms('agenda.can_manage agenda.can_see_hidden_items')) {
|
||||||
|
Agenda.find(item_id).then(function (item) {
|
||||||
|
console.log(item);
|
||||||
var something = false;
|
var something = false;
|
||||||
_.each(changes, function(change) {
|
_.each(changes, function(change) {
|
||||||
if (change.value !== item[change.key]) {
|
if (change.value !== item[change.key]) {
|
||||||
@ -39,6 +43,7 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -40,58 +40,21 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
abstract: true,
|
abstract: true,
|
||||||
template: "<ui-view/>",
|
template: "<ui-view/>",
|
||||||
})
|
})
|
||||||
.state('agenda.item.list', {
|
.state('agenda.item.list', {})
|
||||||
resolve: {
|
|
||||||
items: function(Agenda) {
|
|
||||||
return Agenda.findAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.state('agenda.item.detail', {
|
.state('agenda.item.detail', {
|
||||||
resolve: {
|
resolve: {
|
||||||
item: function(Agenda, $stateParams) {
|
itemId: ['$stateParams', function($stateParams) {
|
||||||
return Agenda.find($stateParams.id).catch(
|
return $stateParams.id;
|
||||||
function () {
|
}],
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
users: function(User) {
|
|
||||||
return User.findAll().catch(
|
|
||||||
function () {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
tags: function(Tag) {
|
|
||||||
return Tag.findAll();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('agenda.item.sort', {
|
.state('agenda.item.sort', {
|
||||||
resolve: {
|
|
||||||
items: function(Agenda) {
|
|
||||||
return Agenda.findAll();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
url: '/sort',
|
url: '/sort',
|
||||||
controller: 'AgendaSortCtrl',
|
controller: 'AgendaSortCtrl',
|
||||||
})
|
})
|
||||||
.state('agenda.current-list-of-speakers', {
|
.state('agenda.current-list-of-speakers', {
|
||||||
url: '/speakers',
|
url: '/speakers',
|
||||||
controller: 'ListOfSpeakersViewCtrl',
|
controller: 'ListOfSpeakersViewCtrl',
|
||||||
resolve: {
|
|
||||||
users: function(User) {
|
|
||||||
return User.findAll().catch(
|
|
||||||
function () {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
items: function(Agenda) {
|
|
||||||
return Agenda.findAll();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data: {
|
data: {
|
||||||
title: gettext('Current list of speakers'),
|
title: gettext('Current list of speakers'),
|
||||||
},
|
},
|
||||||
@ -421,10 +384,11 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
'operator',
|
'operator',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'User',
|
'User',
|
||||||
'item',
|
'itemId',
|
||||||
'Projector',
|
'Projector',
|
||||||
'ProjectionDefault',
|
'ProjectionDefault',
|
||||||
function ($scope, $filter, $http, $state, operator, Agenda, User, item, Projector, ProjectionDefault) {
|
function ($scope, $filter, $http, $state, operator, Agenda, User, itemId, Projector, ProjectionDefault) {
|
||||||
|
var item = Agenda.get(itemId);
|
||||||
Agenda.bindOne(item.id, $scope, 'item');
|
Agenda.bindOne(item.id, $scope, 'item');
|
||||||
User.bindAll({}, $scope, 'users');
|
User.bindAll({}, $scope, 'users');
|
||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
|
@ -8,11 +8,14 @@
|
|||||||
<translate>New</translate>
|
<translate>New</translate>
|
||||||
</a>
|
</a>
|
||||||
<!-- import -->
|
<!-- import -->
|
||||||
<a ui-sref="topics.topic.import" os-perms="agenda.can_manage"
|
<span os-perms="agenda.can_manage">
|
||||||
|
<a ui-sref="topics.topic.import"
|
||||||
|
os-perms="agenda.can_see_hidden_items"
|
||||||
class="btn btn-default btn-sm">
|
class="btn btn-default btn-sm">
|
||||||
<i class="fa fa-download fa-lg"></i>
|
<i class="fa fa-download fa-lg"></i>
|
||||||
<translate>Import</translate>
|
<translate>Import</translate>
|
||||||
</a>
|
</a>
|
||||||
|
</span>
|
||||||
<!-- current list of speakers -->
|
<!-- current list of speakers -->
|
||||||
<a ui-sref="agenda.current-list-of-speakers" os-perms="users.can_see_name"
|
<a ui-sref="agenda.current-list-of-speakers" os-perms="users.can_see_name"
|
||||||
class="btn btn-default btn-sm">
|
class="btn btn-default btn-sm">
|
||||||
|
@ -316,6 +316,8 @@ angular.module('OpenSlidesApp.assignments', [])
|
|||||||
verboseName: gettext('Election'),
|
verboseName: gettext('Election'),
|
||||||
verboseNamePlural: gettext('Elections'),
|
verboseNamePlural: gettext('Elections'),
|
||||||
phases: phases,
|
phases: phases,
|
||||||
|
// TODO (Issue 2885): Do not query this from server. It should be included in the startup data.
|
||||||
|
// Remove than all 'phases' injections from resolvers.
|
||||||
getPhases: function () {
|
getPhases: function () {
|
||||||
if (!this.phases) {
|
if (!this.phases) {
|
||||||
this.phases = $http({ 'method': 'OPTIONS', 'url': '/rest/assignments/assignment/' })
|
this.phases = $http({ 'method': 'OPTIONS', 'url': '/rest/assignments/assignment/' })
|
||||||
|
@ -42,48 +42,20 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
})
|
})
|
||||||
.state('assignments.assignment.list', {
|
.state('assignments.assignment.list', {
|
||||||
resolve: {
|
resolve: {
|
||||||
assignments: function(Assignment) {
|
phases: ['Assignment', function (Assignment) {
|
||||||
return Assignment.findAll();
|
|
||||||
},
|
|
||||||
tags: function(Tag) {
|
|
||||||
return Tag.findAll();
|
|
||||||
},
|
|
||||||
items: function(Agenda) {
|
|
||||||
return Agenda.findAll().catch(
|
|
||||||
function() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
phases: function(Assignment) {
|
|
||||||
return Assignment.getPhases();
|
return Assignment.getPhases();
|
||||||
}
|
}],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('assignments.assignment.detail', {
|
.state('assignments.assignment.detail', {
|
||||||
controller: 'AssignmentDetailCtrl',
|
controller: 'AssignmentDetailCtrl',
|
||||||
resolve: {
|
resolve: {
|
||||||
assignment: function(Assignment, $stateParams) {
|
assignmentId: ['$stateParams', function($stateParams) {
|
||||||
return Assignment.find($stateParams.id).then(function(assignment) {
|
return $stateParams.id;
|
||||||
return assignment;
|
}],
|
||||||
});
|
phases: ['Assignment', function (Assignment) {
|
||||||
},
|
|
||||||
users: function(User) {
|
|
||||||
return User.findAll();
|
|
||||||
},
|
|
||||||
tags: function(Tag) {
|
|
||||||
return Tag.findAll();
|
|
||||||
},
|
|
||||||
items: function(Agenda) {
|
|
||||||
return Agenda.findAll().catch(
|
|
||||||
function() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
phases: function(Assignment) {
|
|
||||||
return Assignment.getPhases();
|
return Assignment.getPhases();
|
||||||
}
|
}],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// redirects to assignment detail and opens assignment edit form dialog, uses edit url,
|
// redirects to assignment detail and opens assignment edit form dialog, uses edit url,
|
||||||
@ -91,8 +63,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
// (from assignment controller use AssignmentForm factory instead to open dialog in front
|
// (from assignment controller use AssignmentForm factory instead to open dialog in front
|
||||||
// of current view without redirect)
|
// of current view without redirect)
|
||||||
.state('assignments.assignment.detail.update', {
|
.state('assignments.assignment.detail.update', {
|
||||||
onEnter: ['$stateParams', '$state', 'ngDialog', 'Assignment',
|
onEnter: ['$stateParams', '$state', 'ngDialog',
|
||||||
function($stateParams, $state, ngDialog, Assignment) {
|
function($stateParams, $state, ngDialog) {
|
||||||
ngDialog.open({
|
ngDialog.open({
|
||||||
template: 'static/templates/assignments/assignment-form.html',
|
template: 'static/templates/assignments/assignment-form.html',
|
||||||
controller: 'AssignmentUpdateCtrl',
|
controller: 'AssignmentUpdateCtrl',
|
||||||
@ -100,16 +72,8 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
closeByEscape: false,
|
closeByEscape: false,
|
||||||
closeByDocument: false,
|
closeByDocument: false,
|
||||||
resolve: {
|
resolve: {
|
||||||
assignment: function() {
|
assignmentId: function() {
|
||||||
return Assignment.find($stateParams.id).then(function(assignment) {
|
return $stateParams.id;
|
||||||
return Assignment.loadRelations(assignment, 'agenda_item');
|
|
||||||
});
|
|
||||||
},
|
|
||||||
items: function(Agenda) {
|
|
||||||
return Agenda.findAll().catch(
|
|
||||||
function() {
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
preCloseCallback: function() {
|
preCloseCallback: function() {
|
||||||
@ -135,25 +99,15 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
return {
|
return {
|
||||||
// ngDialog for assignment form
|
// ngDialog for assignment form
|
||||||
getDialog: function (assignment) {
|
getDialog: function (assignment) {
|
||||||
var resolve = {};
|
|
||||||
if (assignment) {
|
|
||||||
resolve.assignment = function () {
|
|
||||||
return assignment;
|
|
||||||
};
|
|
||||||
resolve.agenda_item = function () {
|
|
||||||
return Assignment.loadRelations(assignment, 'agenda_item');
|
|
||||||
};
|
|
||||||
}
|
|
||||||
resolve.items = function() {
|
|
||||||
return Agenda.getAll();
|
|
||||||
};
|
|
||||||
return {
|
return {
|
||||||
template: 'static/templates/assignments/assignment-form.html',
|
template: 'static/templates/assignments/assignment-form.html',
|
||||||
controller: (assignment) ? 'AssignmentUpdateCtrl' : 'AssignmentCreateCtrl',
|
controller: (assignment) ? 'AssignmentUpdateCtrl' : 'AssignmentCreateCtrl',
|
||||||
className: 'ngdialog-theme-default wide-form',
|
className: 'ngdialog-theme-default wide-form',
|
||||||
closeByEscape: false,
|
closeByEscape: false,
|
||||||
closeByDocument: false,
|
closeByDocument: false,
|
||||||
resolve: resolve
|
resolve: {
|
||||||
|
assignmentId: function () {return assignment ? assignment.id : void 0;}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// angular-formly fields for assignment form
|
// angular-formly fields for assignment form
|
||||||
@ -298,7 +252,6 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
'Assignment',
|
'Assignment',
|
||||||
'Tag',
|
'Tag',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'phases',
|
|
||||||
'Projector',
|
'Projector',
|
||||||
'ProjectionDefault',
|
'ProjectionDefault',
|
||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
@ -309,9 +262,10 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
'osTableFilter',
|
'osTableFilter',
|
||||||
'osTableSort',
|
'osTableSort',
|
||||||
'gettext',
|
'gettext',
|
||||||
function($scope, ngDialog, AssignmentForm, Assignment, Tag, Agenda, phases, Projector, ProjectionDefault,
|
'phases',
|
||||||
|
function($scope, ngDialog, AssignmentForm, Assignment, Tag, Agenda, Projector, ProjectionDefault,
|
||||||
gettextCatalog, AssignmentContentProvider, AssignmentCatalogContentProvider, PdfMakeDocumentProvider,
|
gettextCatalog, AssignmentContentProvider, AssignmentCatalogContentProvider, PdfMakeDocumentProvider,
|
||||||
User, osTableFilter, osTableSort, gettext) {
|
User, osTableFilter, osTableSort, gettext, phases) {
|
||||||
Assignment.bindAll({}, $scope, 'assignments');
|
Assignment.bindAll({}, $scope, 'assignments');
|
||||||
Tag.bindAll({}, $scope, 'tags');
|
Tag.bindAll({}, $scope, 'tags');
|
||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
@ -419,7 +373,6 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
};
|
};
|
||||||
// create the PDF List
|
// create the PDF List
|
||||||
$scope.makePDF_assignmentList = function () {
|
$scope.makePDF_assignmentList = function () {
|
||||||
User.findAll().then( function(users) {
|
|
||||||
var filename = gettextCatalog.getString("Elections") + ".pdf";
|
var filename = gettextCatalog.getString("Elections") + ".pdf";
|
||||||
var assignmentContentProviderArray = [];
|
var assignmentContentProviderArray = [];
|
||||||
|
|
||||||
@ -433,7 +386,6 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
var documentProvider =
|
var documentProvider =
|
||||||
PdfMakeDocumentProvider.createInstance(assignmentCatalogContentProvider);
|
PdfMakeDocumentProvider.createInstance(assignmentCatalogContentProvider);
|
||||||
pdfMake.createPdf(documentProvider.getDocument()).download(filename);
|
pdfMake.createPdf(documentProvider.getDocument()).download(filename);
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
@ -449,7 +401,7 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
'operator',
|
'operator',
|
||||||
'Assignment',
|
'Assignment',
|
||||||
'User',
|
'User',
|
||||||
'assignment',
|
'assignmentId',
|
||||||
'phases',
|
'phases',
|
||||||
'Projector',
|
'Projector',
|
||||||
'ProjectionDefault',
|
'ProjectionDefault',
|
||||||
@ -459,8 +411,9 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
'PdfMakeBallotPaperProvider',
|
'PdfMakeBallotPaperProvider',
|
||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
function($scope, $http, $filter, filterFilter, gettext, ngDialog, AssignmentForm, operator, Assignment,
|
function($scope, $http, $filter, filterFilter, gettext, ngDialog, AssignmentForm, operator, Assignment,
|
||||||
User, assignment, phases, Projector, ProjectionDefault, AssignmentContentProvider, BallotContentProvider,
|
User, assignmentId, phases, Projector, ProjectionDefault, AssignmentContentProvider, BallotContentProvider,
|
||||||
PdfMakeDocumentProvider, PdfMakeBallotPaperProvider, gettextCatalog) {
|
PdfMakeDocumentProvider, PdfMakeBallotPaperProvider, gettextCatalog) {
|
||||||
|
var assignment = Assignment.get(assignmentId);
|
||||||
User.bindAll({}, $scope, 'users');
|
User.bindAll({}, $scope, 'users');
|
||||||
Assignment.loadRelations(assignment, 'agenda_item');
|
Assignment.loadRelations(assignment, 'agenda_item');
|
||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
@ -584,12 +537,7 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
closeByEscape: false,
|
closeByEscape: false,
|
||||||
closeByDocument: false,
|
closeByDocument: false,
|
||||||
resolve: {
|
resolve: {
|
||||||
assignmentpoll: function (AssignmentPoll) {
|
assignmentpollId: function () {return poll.id;}
|
||||||
return AssignmentPoll.find(poll.id);
|
|
||||||
},
|
|
||||||
ballot: function () {
|
|
||||||
return ballot;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -703,8 +651,9 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
'AssignmentForm',
|
'AssignmentForm',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaUpdate',
|
'AgendaUpdate',
|
||||||
'assignment',
|
'assignmentId',
|
||||||
function($scope, Assignment, AssignmentForm, Agenda, AgendaUpdate, assignment) {
|
function($scope, Assignment, AssignmentForm, Agenda, AgendaUpdate, 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
|
||||||
// so list/detail view is not updated while editing
|
// so list/detail view is not updated while editing
|
||||||
@ -753,12 +702,13 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
'$filter',
|
'$filter',
|
||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
'AssignmentPoll',
|
'AssignmentPoll',
|
||||||
'assignmentpoll',
|
'assignmentpollId',
|
||||||
'ballot',
|
'ballot',
|
||||||
function($scope, $filter, gettextCatalog, AssignmentPoll, assignmentpoll, ballot) {
|
function($scope, $filter, gettextCatalog, AssignmentPoll, assignmentpollId, ballot) {
|
||||||
// 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
|
||||||
$scope.model = angular.copy(assignmentpoll);
|
var assignmentpoll = angular.copy(AssignmentPoll.get(assignmentpollId));
|
||||||
|
$scope.model = assignmentpoll;
|
||||||
$scope.ballot = ballot;
|
$scope.ballot = ballot;
|
||||||
$scope.formFields = [];
|
$scope.formFields = [];
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
|
@ -171,7 +171,7 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
|
|||||||
var STEPS = 5;
|
var STEPS = 5;
|
||||||
$scope.scroll = 0;
|
$scope.scroll = 0;
|
||||||
var setScroll = function (scroll) {
|
var setScroll = function (scroll) {
|
||||||
scroll = 80 * scroll;
|
scroll = -80 * scroll;
|
||||||
if ($scope.scrollTimeout) {
|
if ($scope.scrollTimeout) {
|
||||||
$timeout.cancel($scope.scrollTimeout);
|
$timeout.cancel($scope.scrollTimeout);
|
||||||
}
|
}
|
||||||
|
@ -336,22 +336,21 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
title: gettext('Tags'),
|
title: gettext('Tags'),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.state('core.tag.list', {
|
.state('core.tag.list', {})
|
||||||
resolve: {
|
|
||||||
tags: function(Tag) {
|
|
||||||
return Tag.findAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.state('core.tag.create', {})
|
.state('core.tag.create', {})
|
||||||
.state('core.tag.detail', {
|
.state('core.tag.detail', {
|
||||||
resolve: {
|
resolve: {
|
||||||
tag: function(Tag, $stateParams) {
|
tagId: ['$stateParams', function($stateParams) {
|
||||||
return Tag.find($stateParams.id);
|
return $stateParams.id;
|
||||||
}
|
}],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('core.tag.detail.update', {
|
.state('core.tag.detail.update', {
|
||||||
|
resolve: {
|
||||||
|
tagId: ['$stateParams', function($stateParams) {
|
||||||
|
return $stateParams.id;
|
||||||
|
}],
|
||||||
|
},
|
||||||
views: {
|
views: {
|
||||||
'@core.tag': {}
|
'@core.tag': {}
|
||||||
}
|
}
|
||||||
@ -381,8 +380,8 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
closeByEscape: false,
|
closeByEscape: false,
|
||||||
closeByDocument: false,
|
closeByDocument: false,
|
||||||
resolve: {
|
resolve: {
|
||||||
projectorMessage: function () {
|
projectorMessageId: function () {
|
||||||
return message;
|
return message.id;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -1136,12 +1135,12 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
|
|
||||||
.controller('ProjectorMessageEditCtrl', [
|
.controller('ProjectorMessageEditCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'projectorMessage',
|
'projectorMessageId',
|
||||||
'ProjectorMessage',
|
'ProjectorMessage',
|
||||||
'ProjectorMessageForm',
|
'ProjectorMessageForm',
|
||||||
function ($scope, projectorMessage, ProjectorMessage, ProjectorMessageForm) {
|
function ($scope, projectorMessageId, ProjectorMessage, ProjectorMessageForm) {
|
||||||
$scope.formFields = ProjectorMessageForm.getFormFields();
|
$scope.formFields = ProjectorMessageForm.getFormFields();
|
||||||
$scope.model = angular.copy(projectorMessage);
|
$scope.model = angular.copy(ProjectorMessage.get(projectorMessageId));
|
||||||
|
|
||||||
$scope.save = function (message) {
|
$scope.save = function (message) {
|
||||||
ProjectorMessage.inject(message);
|
ProjectorMessage.inject(message);
|
||||||
@ -1336,9 +1335,9 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
.controller('TagDetailCtrl', [
|
.controller('TagDetailCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'Tag',
|
'Tag',
|
||||||
'tag',
|
'tagId',
|
||||||
function($scope, Tag, tag) {
|
function($scope, Tag, tagId) {
|
||||||
Tag.bindOne(tag.id, $scope, 'tag');
|
Tag.bindOne(tagId, $scope, 'tag');
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
@ -1362,9 +1361,9 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
'$scope',
|
'$scope',
|
||||||
'$state',
|
'$state',
|
||||||
'Tag',
|
'Tag',
|
||||||
'tag',
|
'tagId',
|
||||||
function($scope, $state, Tag, tag) {
|
function($scope, $state, Tag, tagId) {
|
||||||
$scope.tag = tag;
|
$scope.tag = Tag.get(tagId);
|
||||||
$scope.save = function (tag) {
|
$scope.save = function (tag) {
|
||||||
Tag.save(tag).then(
|
Tag.save(tag).then(
|
||||||
function(success) {
|
function(success) {
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
<td ng-mouseover="tag.hover=true" ng-mouseleave="tag.hover=false">
|
<td ng-mouseover="tag.hover=true" ng-mouseleave="tag.hover=false">
|
||||||
<strong>{{ tag.name }}</strong>
|
<strong>{{ tag.name }}</strong>
|
||||||
<div class="hoverActions" ng-class="{'hiddenDiv': !tag.hover}">
|
<div class="hoverActions" ng-class="{'hiddenDiv': !tag.hover}">
|
||||||
<a ui-sref="core.tag.detail.update({id: tag.id })" translate>Edit</a> |
|
<a ui-sref="core.tag.detail.update({id: tag.id })" translate>Edit</a> ·
|
||||||
<a href="" class="text-danger"
|
<a href="" class="text-danger"
|
||||||
ng-bootbox-confirm="{{ 'Are you sure you want to delete this entry?' | translate }}<br>
|
ng-bootbox-confirm="{{ 'Are you sure you want to delete this entry?' | translate }}<br>
|
||||||
<b>{{ tag.name }}</b>"
|
<b>{{ tag.name }}</b>"
|
||||||
|
@ -39,20 +39,7 @@ angular.module('OpenSlidesApp.mediafiles.states', [
|
|||||||
abstract: true,
|
abstract: true,
|
||||||
template: "<ui-view/>",
|
template: "<ui-view/>",
|
||||||
})
|
})
|
||||||
.state('mediafiles.mediafile.list', {
|
.state('mediafiles.mediafile.list', {});
|
||||||
resolve: {
|
|
||||||
mediafiles: function (Mediafile) {
|
|
||||||
return Mediafile.findAll();
|
|
||||||
},
|
|
||||||
users: function (User) {
|
|
||||||
return User.findAll().catch(
|
|
||||||
function () {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -46,9 +46,7 @@ angular.module('OpenSlidesApp.motions.motionBlock', [])
|
|||||||
|
|
||||||
.run(['MotionBlock', function(MotionBlock) {}])
|
.run(['MotionBlock', function(MotionBlock) {}])
|
||||||
|
|
||||||
|
|
||||||
// MotionBlock views (list view, create dialog, update dialog)
|
// MotionBlock views (list view, create dialog, update dialog)
|
||||||
|
|
||||||
.factory('MotionBlockForm', [
|
.factory('MotionBlockForm', [
|
||||||
'$http',
|
'$http',
|
||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
@ -65,9 +63,7 @@ angular.module('OpenSlidesApp.motions.motionBlock', [])
|
|||||||
closeByEscape: false,
|
closeByEscape: false,
|
||||||
closeByDocument: false,
|
closeByDocument: false,
|
||||||
resolve: {
|
resolve: {
|
||||||
motionBlock: function () {
|
motionBlockId: function () {return motionBlock ? motionBlock.id : void 0;}
|
||||||
return motionBlock;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -133,11 +129,11 @@ angular.module('OpenSlidesApp.motions.motionBlock', [])
|
|||||||
'Motion',
|
'Motion',
|
||||||
'MotionBlockForm',
|
'MotionBlockForm',
|
||||||
'MotionBlock',
|
'MotionBlock',
|
||||||
'motionBlock',
|
'motionBlockId',
|
||||||
'Projector',
|
'Projector',
|
||||||
'ProjectionDefault',
|
'ProjectionDefault',
|
||||||
function($scope, $http, ngDialog, Motion, MotionBlockForm, MotionBlock, motionBlock, Projector, ProjectionDefault) {
|
function($scope, $http, ngDialog, Motion, MotionBlockForm, MotionBlock, motionBlockId, Projector, ProjectionDefault) {
|
||||||
MotionBlock.bindOne(motionBlock.id, $scope, 'motionBlock');
|
MotionBlock.bindOne(motionBlockId, $scope, 'motionBlock');
|
||||||
Motion.bindAll({}, $scope, 'motions');
|
Motion.bindAll({}, $scope, 'motions');
|
||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
return Projector.lastModified();
|
return Projector.lastModified();
|
||||||
@ -211,14 +207,15 @@ angular.module('OpenSlidesApp.motions.motionBlock', [])
|
|||||||
'MotionBlock',
|
'MotionBlock',
|
||||||
'MotionBlockForm',
|
'MotionBlockForm',
|
||||||
'AgendaUpdate',
|
'AgendaUpdate',
|
||||||
'motionBlock',
|
'motionBlockId',
|
||||||
function($scope, $state, MotionBlock, MotionBlockForm, AgendaUpdate, motionBlock) {
|
function($scope, $state, MotionBlock, MotionBlockForm, AgendaUpdate, motionBlockId) {
|
||||||
// TODO: Check #2486 and remove some agenda related code.
|
// TODO: Check #2486 and remove some agenda related code.
|
||||||
//MotionBlock.loadRelations(motionBlock, 'agenda_item');
|
//MotionBlock.loadRelations(motionBlock, 'agenda_item');
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
|
|
||||||
// Prepare form. Set initial values by creating a deep copy of
|
// Prepare form. Set initial values by creating a deep copy of
|
||||||
// motionBlock object so list/detail view is not updated while editing.
|
// motionBlock object so list/detail view is not updated while editing.
|
||||||
|
var motionBlock = MotionBlock.get(motionBlockId);
|
||||||
$scope.model = angular.copy(motionBlock);
|
$scope.model = angular.copy(motionBlock);
|
||||||
|
|
||||||
// Get all form fields.
|
// Get all form fields.
|
||||||
|
@ -43,82 +43,12 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
abstract: true,
|
abstract: true,
|
||||||
template: "<ui-view/>",
|
template: "<ui-view/>",
|
||||||
})
|
})
|
||||||
.state('motions.motion.list', {
|
.state('motions.motion.list', {})
|
||||||
resolve: {
|
|
||||||
motions: function(Motion) {
|
|
||||||
return Motion.findAll().then(function(motions) {
|
|
||||||
angular.forEach(motions, function(motion) {
|
|
||||||
Motion.loadRelations(motion, 'agenda_item');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
categories: function(Category) {
|
|
||||||
return Category.findAll();
|
|
||||||
},
|
|
||||||
motionBlocks: function(MotionBlock) {
|
|
||||||
return MotionBlock.findAll();
|
|
||||||
},
|
|
||||||
tags: function(Tag) {
|
|
||||||
return Tag.findAll();
|
|
||||||
},
|
|
||||||
users: function(User) {
|
|
||||||
return User.findAll().catch(
|
|
||||||
function () {
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
workflows: function(Workflow) {
|
|
||||||
return Workflow.findAll();
|
|
||||||
},
|
|
||||||
items: function(Agenda) {
|
|
||||||
return Agenda.findAll().catch(
|
|
||||||
function () {
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.state('motions.motion.detail', {
|
.state('motions.motion.detail', {
|
||||||
resolve: {
|
resolve: {
|
||||||
motion: function(Motion, $stateParams) {
|
motionId: ['$stateParams', function($stateParams) {
|
||||||
return Motion.find($stateParams.id);
|
return $stateParams.id;
|
||||||
},
|
}],
|
||||||
motions: function(Motion) {
|
|
||||||
return Motion.findAll();
|
|
||||||
},
|
|
||||||
categories: function(Category) {
|
|
||||||
return Category.findAll();
|
|
||||||
},
|
|
||||||
motionBlocks: function(MotionBlock) {
|
|
||||||
return MotionBlock.findAll();
|
|
||||||
},
|
|
||||||
users: function(User) {
|
|
||||||
return User.findAll().catch(
|
|
||||||
function () {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
items: function(Agenda) {
|
|
||||||
return Agenda.findAll().catch(
|
|
||||||
function () {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
mediafiles: function(Mediafile) {
|
|
||||||
return Mediafile.findAll().catch(
|
|
||||||
function () {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
tags: function(Tag) {
|
|
||||||
return Tag.findAll();
|
|
||||||
},
|
|
||||||
change_recommendations: function(MotionChangeRecommendation, motion) {
|
|
||||||
return MotionChangeRecommendation.findAll({'where': {'motion_version_id': {'==': motion.active_version}}});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// redirects to motion detail and opens motion edit form dialog, uses edit url,
|
// redirects to motion detail and opens motion edit form dialog, uses edit url,
|
||||||
@ -135,20 +65,9 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
closeByEscape: false,
|
closeByEscape: false,
|
||||||
closeByDocument: false,
|
closeByDocument: false,
|
||||||
resolve: {
|
resolve: {
|
||||||
motion: function() {
|
motionId: function () {return $stateParams.id;},
|
||||||
return Motion.find($stateParams.id).then(function(motion) {
|
|
||||||
return Motion.loadRelations(motion, 'agenda_item');
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
items: function(Agenda) {
|
preCloseCallback: function () {
|
||||||
return Agenda.findAll().catch(
|
|
||||||
function() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
preCloseCallback: function() {
|
|
||||||
$state.go('motions.motion.detail', {motion: $stateParams.id});
|
$state.go('motions.motion.detail', {motion: $stateParams.id});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -159,17 +78,6 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
.state('motions.motion.import', {
|
.state('motions.motion.import', {
|
||||||
url: '/import',
|
url: '/import',
|
||||||
controller: 'MotionImportCtrl',
|
controller: 'MotionImportCtrl',
|
||||||
resolve: {
|
|
||||||
motions: function(Motion) {
|
|
||||||
return Motion.findAll();
|
|
||||||
},
|
|
||||||
categories: function(Category) {
|
|
||||||
return Category.findAll();
|
|
||||||
},
|
|
||||||
users: function(User) {
|
|
||||||
return User.findAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
// categories
|
// categories
|
||||||
.state('motions.category', {
|
.state('motions.category', {
|
||||||
@ -180,19 +88,13 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
title: gettext('Categories'),
|
title: gettext('Categories'),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.state('motions.category.list', {
|
.state('motions.category.list', {})
|
||||||
resolve: {
|
|
||||||
categories: function(Category) {
|
|
||||||
return Category.findAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.state('motions.category.create', {})
|
.state('motions.category.create', {})
|
||||||
.state('motions.category.detail', {
|
.state('motions.category.detail', {
|
||||||
resolve: {
|
resolve: {
|
||||||
category: function(Category, $stateParams) {
|
categoryId: ['$stateParams', function($stateParams) {
|
||||||
return Category.find($stateParams.id);
|
return $stateParams.id;
|
||||||
}
|
}]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('motions.category.detail.update', {
|
.state('motions.category.detail.update', {
|
||||||
@ -202,16 +104,13 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
})
|
})
|
||||||
.state('motions.category.sort', {
|
.state('motions.category.sort', {
|
||||||
url: '/sort/{id}',
|
url: '/sort/{id}',
|
||||||
resolve: {
|
|
||||||
category: function(Category, $stateParams) {
|
|
||||||
return Category.find($stateParams.id);
|
|
||||||
},
|
|
||||||
motions: function(Motion) {
|
|
||||||
return Motion.findAll();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
controller: 'CategorySortCtrl',
|
controller: 'CategorySortCtrl',
|
||||||
templateUrl: 'static/templates/motions/category-sort.html'
|
templateUrl: 'static/templates/motions/category-sort.html',
|
||||||
|
resolve: {
|
||||||
|
categoryId: ['$stateParams', function($stateParams) {
|
||||||
|
return $stateParams.id;
|
||||||
|
}],
|
||||||
|
},
|
||||||
})
|
})
|
||||||
// MotionBlock
|
// MotionBlock
|
||||||
.state('motions.motionBlock', {
|
.state('motions.motionBlock', {
|
||||||
@ -222,38 +121,12 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
title: gettext('Motion blocks'),
|
title: gettext('Motion blocks'),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.state('motions.motionBlock.list', {
|
.state('motions.motionBlock.list', {})
|
||||||
resolve: {
|
|
||||||
motionBlocks: function (MotionBlock) {
|
|
||||||
return MotionBlock.findAll();
|
|
||||||
},
|
|
||||||
motions: function(Motion) {
|
|
||||||
return Motion.findAll();
|
|
||||||
},
|
|
||||||
items: function(Agenda) {
|
|
||||||
return Agenda.findAll().catch(
|
|
||||||
function () {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.state('motions.motionBlock.detail', {
|
.state('motions.motionBlock.detail', {
|
||||||
resolve: {
|
resolve: {
|
||||||
motionBlock: function(MotionBlock, $stateParams) {
|
motionBlockId: ['$stateParams', function($stateParams) {
|
||||||
return MotionBlock.find($stateParams.id);
|
return $stateParams.id;
|
||||||
},
|
}],
|
||||||
motions: function(Motion) {
|
|
||||||
return Motion.findAll();
|
|
||||||
},
|
|
||||||
items: function(Agenda) {
|
|
||||||
return Agenda.findAll().catch(
|
|
||||||
function () {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// redirects to motionBlock detail and opens motionBlock edit form dialog, uses edit url,
|
// redirects to motionBlock detail and opens motionBlock edit form dialog, uses edit url,
|
||||||
@ -261,8 +134,8 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
// (from motionBlock controller use MotionBlockForm factory instead to open dialog in front
|
// (from motionBlock controller use MotionBlockForm factory instead to open dialog in front
|
||||||
// of current view without redirect)
|
// of current view without redirect)
|
||||||
.state('motions.motionBlock.detail.update', {
|
.state('motions.motionBlock.detail.update', {
|
||||||
onEnter: ['$stateParams', '$state', 'ngDialog', 'MotionBlock',
|
onEnter: ['$stateParams', '$state', 'ngDialog',
|
||||||
function($stateParams, $state, ngDialog, MotionBlock) {
|
function($stateParams, $state, ngDialog) {
|
||||||
ngDialog.open({
|
ngDialog.open({
|
||||||
template: 'static/templates/motions/motion-block-form.html',
|
template: 'static/templates/motions/motion-block-form.html',
|
||||||
controller: 'MotionBlockUpdateCtrl',
|
controller: 'MotionBlockUpdateCtrl',
|
||||||
@ -270,8 +143,8 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
closeByEscape: false,
|
closeByEscape: false,
|
||||||
closeByDocument: false,
|
closeByDocument: false,
|
||||||
resolve: {
|
resolve: {
|
||||||
motionBlock: function () {
|
motionBlockId: function () {
|
||||||
return MotionBlock.find($stateParams.id);
|
return $stateParams.id;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
preCloseCallback: function() {
|
preCloseCallback: function() {
|
||||||
@ -417,28 +290,15 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
return {
|
return {
|
||||||
// ngDialog for motion form
|
// ngDialog for motion form
|
||||||
getDialog: function (motion) {
|
getDialog: function (motion) {
|
||||||
var resolve = {};
|
|
||||||
if (motion) {
|
|
||||||
resolve = {
|
|
||||||
motion: function() {
|
|
||||||
MotionComment.populateFields(motion);
|
|
||||||
return motion;
|
|
||||||
},
|
|
||||||
agenda_item: function(Motion) {
|
|
||||||
return Motion.loadRelations(motion, 'agenda_item');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
resolve.mediafiles = function (Mediafile) {
|
|
||||||
return Mediafile.findAll();
|
|
||||||
};
|
|
||||||
return {
|
return {
|
||||||
template: 'static/templates/motions/motion-form.html',
|
template: 'static/templates/motions/motion-form.html',
|
||||||
controller: (motion) ? 'MotionUpdateCtrl' : 'MotionCreateCtrl',
|
controller: motion ? 'MotionUpdateCtrl' : 'MotionCreateCtrl',
|
||||||
className: 'ngdialog-theme-default wide-form',
|
className: 'ngdialog-theme-default wide-form',
|
||||||
closeByEscape: false,
|
closeByEscape: false,
|
||||||
closeByDocument: false,
|
closeByDocument: false,
|
||||||
resolve: (resolve) ? resolve : null
|
resolve: {
|
||||||
|
motionId: function () {return motion ? motion.id : void 0;},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// angular-formly fields for motion form
|
// angular-formly fields for motion form
|
||||||
@ -1090,21 +950,21 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'User',
|
'User',
|
||||||
'Workflow',
|
'Workflow',
|
||||||
'Config',
|
'Config',
|
||||||
'motion',
|
'motionId',
|
||||||
'MotionInlineEditing',
|
'MotionInlineEditing',
|
||||||
'MotionCommentsInlineEditing',
|
'MotionCommentsInlineEditing',
|
||||||
'Projector',
|
'Projector',
|
||||||
'ProjectionDefault',
|
'ProjectionDefault',
|
||||||
function($scope, $http, operator, ngDialog, MotionForm,
|
function($scope, $http, operator, ngDialog, MotionForm,
|
||||||
ChangeRecommmendationCreate, ChangeRecommmendationView, MotionChangeRecommendation, MotionPDFExport,
|
ChangeRecommmendationCreate, ChangeRecommmendationView, MotionChangeRecommendation, MotionPDFExport,
|
||||||
Motion, MotionComment, Category, Mediafile, Tag, User, Workflow, Config, motion, MotionInlineEditing,
|
Motion, MotionComment, Category, Mediafile, Tag, User, Workflow, Config, motionId, MotionInlineEditing,
|
||||||
MotionCommentsInlineEditing, Projector, ProjectionDefault) {
|
MotionCommentsInlineEditing, Projector, ProjectionDefault) {
|
||||||
|
var motion = Motion.get(motionId);
|
||||||
Category.bindAll({}, $scope, 'categories');
|
Category.bindAll({}, $scope, 'categories');
|
||||||
Mediafile.bindAll({}, $scope, 'mediafiles');
|
Mediafile.bindAll({}, $scope, 'mediafiles');
|
||||||
Tag.bindAll({}, $scope, 'tags');
|
Tag.bindAll({}, $scope, 'tags');
|
||||||
User.bindAll({}, $scope, 'users');
|
User.bindAll({}, $scope, 'users');
|
||||||
Workflow.bindAll({}, $scope, 'workflows');
|
Workflow.bindAll({}, $scope, 'workflows');
|
||||||
Motion.loadRelations(motion, 'agenda_item');
|
|
||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
return MotionChangeRecommendation.lastModified();
|
return MotionChangeRecommendation.lastModified();
|
||||||
}, function () {
|
}, function () {
|
||||||
@ -1122,9 +982,9 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
$scope.defaultProjectorId = ProjectionDefault.filter({name: 'motions'})[0].projector_id;
|
$scope.defaultProjectorId = ProjectionDefault.filter({name: 'motions'})[0].projector_id;
|
||||||
});
|
});
|
||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
return Motion.lastModified(motion.id);
|
return Motion.lastModified(motionId);
|
||||||
}, function () {
|
}, function () {
|
||||||
$scope.motion = Motion.get(motion.id);
|
$scope.motion = Motion.get(motionId);
|
||||||
MotionComment.populateFields($scope.motion);
|
MotionComment.populateFields($scope.motion);
|
||||||
});
|
});
|
||||||
$scope.projectionModes = [
|
$scope.projectionModes = [
|
||||||
@ -1288,8 +1148,8 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
closeByEscape: false,
|
closeByEscape: false,
|
||||||
closeByDocument: false,
|
closeByDocument: false,
|
||||||
resolve: {
|
resolve: {
|
||||||
motionpoll: function (MotionPoll) {
|
motionpollId: function () {
|
||||||
return MotionPoll.find(poll.id);
|
return poll.id;
|
||||||
},
|
},
|
||||||
voteNumber: function () {
|
voteNumber: function () {
|
||||||
return voteNumber;
|
return voteNumber;
|
||||||
@ -1454,7 +1314,8 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'Workflow',
|
'Workflow',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaUpdate',
|
'AgendaUpdate',
|
||||||
function($scope, $state, gettext, gettextCatalog, operator, Motion, MotionForm, Category, Config, Mediafile, Tag, User, Workflow, Agenda, AgendaUpdate) {
|
function($scope, $state, gettext, gettextCatalog, operator, Motion, MotionForm,
|
||||||
|
Category, Config, Mediafile, Tag, User, Workflow, Agenda, AgendaUpdate) {
|
||||||
Category.bindAll({}, $scope, 'categories');
|
Category.bindAll({}, $scope, 'categories');
|
||||||
Mediafile.bindAll({}, $scope, 'mediafiles');
|
Mediafile.bindAll({}, $scope, 'mediafiles');
|
||||||
Tag.bindAll({}, $scope, 'tags');
|
Tag.bindAll({}, $scope, 'tags');
|
||||||
@ -1489,14 +1350,11 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
$scope.save = function (motion) {
|
$scope.save = function (motion) {
|
||||||
Motion.create(motion).then(
|
Motion.create(motion).then(
|
||||||
function(success) {
|
function(success) {
|
||||||
// change agenda item only if user has the permission to do that
|
|
||||||
if (operator.hasPerms('agenda.can_manage')) {
|
|
||||||
// type: Value 1 means a non hidden agenda item, value 2 means a hidden agenda item,
|
// type: Value 1 means a non hidden agenda item, value 2 means a hidden agenda item,
|
||||||
// see openslides.agenda.models.Item.ITEM_TYPE.
|
// see openslides.agenda.models.Item.ITEM_TYPE.
|
||||||
var changes = [{key: 'type', value: (motion.showAsAgendaItem ? 1 : 2)},
|
var changes = [{key: 'type', value: (motion.showAsAgendaItem ? 1 : 2)},
|
||||||
{key: 'parent_id', value: motion.agenda_parent_item_id}];
|
{key: 'parent_id', value: motion.agenda_parent_item_id}];
|
||||||
AgendaUpdate.saveChanges(success.agenda_item_id, changes);
|
AgendaUpdate.saveChanges(success.agenda_item_id, changes);
|
||||||
}
|
|
||||||
if (isAmendment) {
|
if (isAmendment) {
|
||||||
$state.go('motions.motion.detail', {id: success.id});
|
$state.go('motions.motion.detail', {id: success.id});
|
||||||
}
|
}
|
||||||
@ -1519,8 +1377,8 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'Workflow',
|
'Workflow',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaUpdate',
|
'AgendaUpdate',
|
||||||
'motion',
|
'motionId',
|
||||||
function($scope, Motion, Category, Config, Mediafile, MotionForm, Tag, User, Workflow, Agenda, AgendaUpdate, motion) {
|
function($scope, Motion, Category, Config, Mediafile, MotionForm, Tag, User, Workflow, Agenda, AgendaUpdate, motionId) {
|
||||||
Category.bindAll({}, $scope, 'categories');
|
Category.bindAll({}, $scope, 'categories');
|
||||||
Mediafile.bindAll({}, $scope, 'mediafiles');
|
Mediafile.bindAll({}, $scope, 'mediafiles');
|
||||||
Tag.bindAll({}, $scope, 'tags');
|
Tag.bindAll({}, $scope, 'tags');
|
||||||
@ -1530,6 +1388,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
|
|
||||||
// set initial values for form model by create deep copy of motion object
|
// set initial values for form model by create deep copy of motion object
|
||||||
// so list/detail view is not updated while editing
|
// so list/detail view is not updated while editing
|
||||||
|
var motion = Motion.get(motionId);
|
||||||
$scope.model = angular.copy(motion);
|
$scope.model = angular.copy(motion);
|
||||||
$scope.model.disable_versioning = false;
|
$scope.model.disable_versioning = false;
|
||||||
$scope.model.more = false;
|
$scope.model.more = false;
|
||||||
@ -1581,14 +1440,12 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
// save change motion object on server
|
// save change motion object on server
|
||||||
Motion.save(motion, { method: 'PATCH' }).then(
|
Motion.save(motion, { method: 'PATCH' }).then(
|
||||||
function(success) {
|
function(success) {
|
||||||
Agenda.find(success.agenda_item_id).then(function(item) {
|
|
||||||
// type: Value 1 means a non hidden agenda item, value 2 means a hidden agenda item,
|
// type: Value 1 means a non hidden agenda item, value 2 means a hidden agenda item,
|
||||||
// see openslides.agenda.models.Item.ITEM_TYPE.
|
// see openslides.agenda.models.Item.ITEM_TYPE.
|
||||||
var changes = [{key: 'type', value: (motion.showAsAgendaItem ? 1 : 2)},
|
var changes = [{key: 'type', value: (motion.showAsAgendaItem ? 1 : 2)},
|
||||||
{key: 'parent_id', value: motion.agenda_parent_item_id}];
|
{key: 'parent_id', value: motion.agenda_parent_item_id}];
|
||||||
AgendaUpdate.saveChanges(success.agenda_item_id,changes);
|
AgendaUpdate.saveChanges(success.agenda_item_id,changes);
|
||||||
$scope.closeThisDialog();
|
$scope.closeThisDialog();
|
||||||
});
|
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
// save error: revert all changes by restore
|
// save error: revert all changes by restore
|
||||||
@ -1610,11 +1467,12 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
'MotionPoll',
|
'MotionPoll',
|
||||||
'MotionPollForm',
|
'MotionPollForm',
|
||||||
'motionpoll',
|
'motionpollId',
|
||||||
'voteNumber',
|
'voteNumber',
|
||||||
function($scope, gettextCatalog, MotionPoll, MotionPollForm, motionpoll, voteNumber) {
|
function($scope, gettextCatalog, MotionPoll, MotionPollForm, motionpollId, voteNumber) {
|
||||||
// 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);
|
||||||
$scope.model = angular.copy(motionpoll);
|
$scope.model = angular.copy(motionpoll);
|
||||||
$scope.voteNumber = voteNumber;
|
$scope.voteNumber = voteNumber;
|
||||||
$scope.formFields = MotionPollForm.getFormFields();
|
$scope.formFields = MotionPollForm.getFormFields();
|
||||||
@ -1900,9 +1758,9 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
.controller('CategoryDetailCtrl', [
|
.controller('CategoryDetailCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'Category',
|
'Category',
|
||||||
'category',
|
'categoryId',
|
||||||
function($scope, Category, category) {
|
function($scope, Category, categoryId) {
|
||||||
Category.bindOne(category.id, $scope, 'category');
|
Category.bindOne(categoryId, $scope, 'category');
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
@ -1926,9 +1784,9 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'$scope',
|
'$scope',
|
||||||
'$state',
|
'$state',
|
||||||
'Category',
|
'Category',
|
||||||
'category',
|
'categoryId',
|
||||||
function($scope, $state, Category, category) {
|
function($scope, $state, Category, categoryId) {
|
||||||
$scope.category = category;
|
$scope.category = Category.get(categoryId);
|
||||||
$scope.save = function (category) {
|
$scope.save = function (category) {
|
||||||
Category.save(category).then(
|
Category.save(category).then(
|
||||||
function(success) {
|
function(success) {
|
||||||
@ -1945,13 +1803,12 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
'$http',
|
'$http',
|
||||||
'MotionList',
|
'MotionList',
|
||||||
'Category',
|
'Category',
|
||||||
'category',
|
'categoryId',
|
||||||
'Motion',
|
'Motion',
|
||||||
'motions',
|
function($scope, $stateParams, $http, MotionList, Category, categoryId, Motion) {
|
||||||
function($scope, $stateParams, $http, MotionList, Category, category, Motion, motions) {
|
Category.bindOne(categoryId, $scope, 'category');
|
||||||
Category.bindOne(category.id, $scope, 'category');
|
|
||||||
Motion.bindAll({}, $scope, 'motions');
|
Motion.bindAll({}, $scope, 'motions');
|
||||||
$scope.filter = { category_id: category.id,
|
$scope.filter = { category_id: categoryId,
|
||||||
parent_id: null,
|
parent_id: null,
|
||||||
orderBy: 'identifier' };
|
orderBy: 'identifier' };
|
||||||
|
|
||||||
|
@ -25,12 +25,9 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
})
|
})
|
||||||
.state('topics.topic.detail', {
|
.state('topics.topic.detail', {
|
||||||
resolve: {
|
resolve: {
|
||||||
topic: function(Topic, $stateParams) {
|
topicId: ['$stateParams', function($stateParams) {
|
||||||
return Topic.find($stateParams.id);
|
return $stateParams.id;
|
||||||
},
|
}],
|
||||||
items: function(Agenda) {
|
|
||||||
return Agenda.findAll();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// redirects to topic detail and opens topic edit form dialog, uses edit url,
|
// redirects to topic detail and opens topic edit form dialog, uses edit url,
|
||||||
@ -38,8 +35,8 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
// (from topic controller use TopicForm factory instead to open dialog in front
|
// (from topic controller use TopicForm factory instead to open dialog in front
|
||||||
// of current view without redirect)
|
// of current view without redirect)
|
||||||
.state('topics.topic.detail.update', {
|
.state('topics.topic.detail.update', {
|
||||||
onEnter: ['$stateParams', '$state', 'ngDialog', 'Topic',
|
onEnter: ['$stateParams', '$state', 'ngDialog',
|
||||||
function($stateParams, $state, ngDialog, Topic) {
|
function($stateParams, $state, ngDialog) {
|
||||||
ngDialog.open({
|
ngDialog.open({
|
||||||
template: 'static/templates/topics/topic-form.html',
|
template: 'static/templates/topics/topic-form.html',
|
||||||
controller: 'TopicUpdateCtrl',
|
controller: 'TopicUpdateCtrl',
|
||||||
@ -47,16 +44,9 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
closeByEscape: false,
|
closeByEscape: false,
|
||||||
closeByDocument: false,
|
closeByDocument: false,
|
||||||
resolve: {
|
resolve: {
|
||||||
topic: function() {
|
topicId: function() {
|
||||||
return Topic.find($stateParams.id);
|
return $stateParams.id;
|
||||||
},
|
},
|
||||||
items: function(Agenda) {
|
|
||||||
return Agenda.findAll().catch(
|
|
||||||
function() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
preCloseCallback: function() {
|
preCloseCallback: function() {
|
||||||
$state.go('topics.topic.detail', {topic: $stateParams.id});
|
$state.go('topics.topic.detail', {topic: $stateParams.id});
|
||||||
@ -82,22 +72,15 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
return {
|
return {
|
||||||
// ngDialog for topic form
|
// ngDialog for topic form
|
||||||
getDialog: function (topic) {
|
getDialog: function (topic) {
|
||||||
var resolve = {};
|
|
||||||
if (topic) {
|
|
||||||
resolve = {
|
|
||||||
topic: function (Topic) {return Topic.find(topic.id);}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
resolve.mediafiles = function (Mediafile) {
|
|
||||||
return Mediafile.findAll();
|
|
||||||
};
|
|
||||||
return {
|
return {
|
||||||
template: 'static/templates/topics/topic-form.html',
|
template: 'static/templates/topics/topic-form.html',
|
||||||
controller: (topic) ? 'TopicUpdateCtrl' : 'TopicCreateCtrl',
|
controller: (topic) ? 'TopicUpdateCtrl' : 'TopicCreateCtrl',
|
||||||
className: 'ngdialog-theme-default wide-form',
|
className: 'ngdialog-theme-default wide-form',
|
||||||
closeByEscape: false,
|
closeByEscape: false,
|
||||||
closeByDocument: false,
|
closeByDocument: false,
|
||||||
resolve: (resolve) ? resolve : null
|
resolve: {
|
||||||
|
topicId: function () {return topic ? topic.id: void 0;}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getFormFields: function (isCreateForm) {
|
getFormFields: function (isCreateForm) {
|
||||||
@ -169,11 +152,11 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
'ngDialog',
|
'ngDialog',
|
||||||
'TopicForm',
|
'TopicForm',
|
||||||
'Topic',
|
'Topic',
|
||||||
'topic',
|
'topicId',
|
||||||
'Projector',
|
'Projector',
|
||||||
'ProjectionDefault',
|
'ProjectionDefault',
|
||||||
function($scope, ngDialog, TopicForm, Topic, topic, Projector, ProjectionDefault) {
|
function($scope, ngDialog, TopicForm, Topic, topicId, Projector, ProjectionDefault) {
|
||||||
Topic.bindOne(topic.id, $scope, 'topic');
|
Topic.bindOne(topicId, $scope, 'topic');
|
||||||
$scope.$watch(function () {
|
$scope.$watch(function () {
|
||||||
return Projector.lastModified();
|
return Projector.lastModified();
|
||||||
}, function () {
|
}, function () {
|
||||||
@ -182,7 +165,6 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
$scope.defaultProjectorId = projectiondefault.projector_id;
|
$scope.defaultProjectorId = projectiondefault.projector_id;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Topic.loadRelations(topic, 'agenda_item');
|
|
||||||
$scope.openDialog = function (topic) {
|
$scope.openDialog = function (topic) {
|
||||||
ngDialog.open(TopicForm.getDialog(topic));
|
ngDialog.open(TopicForm.getDialog(topic));
|
||||||
};
|
};
|
||||||
@ -224,9 +206,9 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
'TopicForm',
|
'TopicForm',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'AgendaUpdate',
|
'AgendaUpdate',
|
||||||
'topic',
|
'topicId',
|
||||||
function($scope, $state, Topic, TopicForm, Agenda, AgendaUpdate, topic) {
|
function($scope, $state, Topic, TopicForm, Agenda, AgendaUpdate, topicId) {
|
||||||
Topic.loadRelations(topic, 'agenda_item');
|
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
|
||||||
// so list/detail view is not updated while editing
|
// so list/detail view is not updated while editing
|
||||||
@ -273,7 +255,8 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
'Topic',
|
'Topic',
|
||||||
'HumanTimeConverter',
|
'HumanTimeConverter',
|
||||||
'TopicsCsvExample',
|
'TopicsCsvExample',
|
||||||
function($scope, gettext, Agenda, Topic, HumanTimeConverter, TopicsCsvExample) {
|
'AgendaUpdate',
|
||||||
|
function($scope, gettext, Agenda, Topic, HumanTimeConverter, TopicsCsvExample, AgendaUpdate) {
|
||||||
// Big TODO: Change wording from "item" to "topic".
|
// Big TODO: Change wording from "item" to "topic".
|
||||||
// import from textarea
|
// import from textarea
|
||||||
$scope.importByLine = function () {
|
$scope.importByLine = function () {
|
||||||
@ -285,13 +268,9 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
// TODO: create all items in bulk mode
|
// TODO: create all items in bulk mode
|
||||||
Topic.create(item).then(
|
Topic.create(item).then(
|
||||||
function(success) {
|
function(success) {
|
||||||
// find related agenda item
|
var changes = [{key: 'type', value: 1},
|
||||||
Agenda.find(success.agenda_item_id).then(function(item) {
|
{key: 'weight', value: 1000 + index}];
|
||||||
// import all items as type AGENDA_ITEM = 1
|
AgendaUpdate.saveChanges(success.agenda_item_id, changes);
|
||||||
item.type = 1;
|
|
||||||
item.weight = 1000 + index;
|
|
||||||
Agenda.save(item);
|
|
||||||
});
|
|
||||||
$scope.importcounter++;
|
$scope.importcounter++;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -376,15 +355,12 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics', 'OpenSlides
|
|||||||
if (item.selected && !item.importerror) {
|
if (item.selected && !item.importerror) {
|
||||||
Topic.create(item).then(
|
Topic.create(item).then(
|
||||||
function(success) {
|
function(success) {
|
||||||
|
var changes = [{key: 'duration', value: item.duration},
|
||||||
|
{key: 'comment', value: item.comment},
|
||||||
|
{key: 'type', value: item.type},
|
||||||
|
{key: 'weight', value: item.weight}];
|
||||||
|
AgendaUpdate.saveChanges(success.agenda_item_id, changes);
|
||||||
item.imported = true;
|
item.imported = true;
|
||||||
// find related agenda item
|
|
||||||
Agenda.find(success.agenda_item_id).then(function(agendaItem) {
|
|
||||||
agendaItem.duration = item.duration;
|
|
||||||
agendaItem.comment = item.comment;
|
|
||||||
agendaItem.type = item.type;
|
|
||||||
agendaItem.weight = item.weight;
|
|
||||||
Agenda.save(agendaItem);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -132,6 +132,8 @@ angular.module('OpenSlidesApp.users', [])
|
|||||||
return DS.defineResource({
|
return DS.defineResource({
|
||||||
name: 'users/group',
|
name: 'users/group',
|
||||||
permissions: permissions,
|
permissions: permissions,
|
||||||
|
// TODO (Issue 2862): Do not query the permissions from server. They should be included
|
||||||
|
// in the startup data. Then remove 'permission' injection from group list controller.
|
||||||
getPermissions: function() {
|
getPermissions: function() {
|
||||||
if (!this.permissions) {
|
if (!this.permissions) {
|
||||||
this.permissions = $http({ 'method': 'OPTIONS', 'url': '/rest/users/group/' })
|
this.permissions = $http({ 'method': 'OPTIONS', 'url': '/rest/users/group/' })
|
||||||
|
@ -751,9 +751,9 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
'$state',
|
'$state',
|
||||||
'Editor',
|
'Editor',
|
||||||
'User',
|
'User',
|
||||||
'user',
|
'userId',
|
||||||
function($scope, $state, Editor, User, user) {
|
function($scope, $state, Editor, User, userId) {
|
||||||
$scope.user = user; // autoupdate is not activated
|
$scope.user = angular.copy(User.get(userId));
|
||||||
$scope.ckeditorOptions = Editor.getOptions();
|
$scope.ckeditorOptions = Editor.getOptions();
|
||||||
$scope.save = function (user) {
|
$scope.save = function (user) {
|
||||||
User.save(user).then(
|
User.save(user).then(
|
||||||
@ -805,10 +805,8 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
'$scope',
|
'$scope',
|
||||||
'$state',
|
'$state',
|
||||||
'$http',
|
'$http',
|
||||||
'user',
|
function($scope, $state, $http) {
|
||||||
function($scope, $state, $http, user) {
|
$scope.save = function () {
|
||||||
$scope.user = user; // autoupdate is not activated
|
|
||||||
$scope.save = function (user) {
|
|
||||||
if ($scope.newPassword != $scope.newPassword2) {
|
if ($scope.newPassword != $scope.newPassword2) {
|
||||||
$scope.newPassword = $scope.newPassword2 = '';
|
$scope.newPassword = $scope.newPassword2 = '';
|
||||||
$scope.formError = 'Password confirmation does not match.';
|
$scope.formError = 'Password confirmation does not match.';
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
name="inputNewPassword2"
|
name="inputNewPassword2"
|
||||||
required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" ng-click="save(user)" class="btn btn-primary" translate>
|
<button type="submit" ng-click="save()" class="btn btn-primary" translate>
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
<button ui-sref="users.user.list" class="btn btn-default" translate>
|
<button ui-sref="users.user.list" class="btn btn-default" translate>
|
||||||
|
Loading…
Reference in New Issue
Block a user