A lot of template fixes
- Reset password from current (unsaved) value of default_password. - MotionForm, AssignmentForm and UserForm factory for open ngDialog. Fixes edit url redirect problem. - Added back-to-detail-view-button to list of speakers view. - Add translation context. - Fixed (missing) translation strings. - Fixed tags and category list views. - motion detail: Use select box for changing state. - motion slide updated
This commit is contained in:
parent
4a3cefadb1
commit
93e2296bdc
@ -101,7 +101,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
|
|||||||
// detail view of related item (content object)
|
// detail view of related item (content object)
|
||||||
$scope.open = function (item) {
|
$scope.open = function (item) {
|
||||||
$state.go(item.content_object.collection.replace('/','.')+'.detail',
|
$state.go(item.content_object.collection.replace('/','.')+'.detail',
|
||||||
{id: item.content_object.id});
|
{id: item.content_object.id});
|
||||||
};
|
};
|
||||||
// save changed item
|
// save changed item
|
||||||
$scope.save = function (item) {
|
$scope.save = function (item) {
|
||||||
@ -183,10 +183,11 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
|
|||||||
'$scope',
|
'$scope',
|
||||||
'$filter',
|
'$filter',
|
||||||
'$http',
|
'$http',
|
||||||
|
'$state',
|
||||||
'Agenda',
|
'Agenda',
|
||||||
'User',
|
'User',
|
||||||
'item',
|
'item',
|
||||||
function ($scope, $filter, $http, Agenda, User, item) {
|
function ($scope, $filter, $http, $state, Agenda, User, item) {
|
||||||
Agenda.bindOne(item.id, $scope, 'item');
|
Agenda.bindOne(item.id, $scope, 'item');
|
||||||
User.bindAll({}, $scope, 'users');
|
User.bindAll({}, $scope, 'users');
|
||||||
$scope.speakerSelectBox = {};
|
$scope.speakerSelectBox = {};
|
||||||
@ -198,6 +199,13 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
|
|||||||
$scope.speakers = $filter('orderBy')(item.speakers, 'weight');
|
$scope.speakers = $filter('orderBy')(item.speakers, 'weight');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// go to detail view of related item (content object)
|
||||||
|
$scope.open = function (item) {
|
||||||
|
$state.go(item.content_object.collection.replace('/','.')+'.detail',
|
||||||
|
{id: item.content_object.id});
|
||||||
|
};
|
||||||
|
|
||||||
// close/open list of speakers of current item
|
// close/open list of speakers of current item
|
||||||
$scope.closeList = function (listClosed) {
|
$scope.closeList = function (listClosed) {
|
||||||
item.speaker_list_closed = listClosed;
|
item.speaker_list_closed = listClosed;
|
||||||
|
@ -3,7 +3,11 @@
|
|||||||
<div class="submenu">
|
<div class="submenu">
|
||||||
<a ui-sref="agenda.item.list" class="btn btn-sm btn-default">
|
<a ui-sref="agenda.item.list" class="btn btn-sm btn-default">
|
||||||
<i class="fa fa-angle-double-left fa-lg"></i>
|
<i class="fa fa-angle-double-left fa-lg"></i>
|
||||||
<translate>Back to agenda</translate>
|
<translate>Agenda</translate>
|
||||||
|
</a>
|
||||||
|
<a href="" ng-click="open(item)" class="btn btn-sm btn-default">
|
||||||
|
<i class="fa fa-angle-double-left fa-lg"></i>
|
||||||
|
{{item.getContentResource().verboseName}}
|
||||||
</a>
|
</a>
|
||||||
<!-- project list of speakers -->
|
<!-- project list of speakers -->
|
||||||
<a os-perms="core.can_manage_projector" class="btn btn-default btn-sm"
|
<a os-perms="core.can_manage_projector" class="btn btn-default btn-sm"
|
||||||
|
@ -146,10 +146,10 @@
|
|||||||
<a ui-sref="agenda.item.detail({id: item.id})" translate>List of speakers</a> |
|
<a ui-sref="agenda.item.detail({id: item.id})" translate>List of speakers</a> |
|
||||||
<a href="" ng-click="item.quickEdit=true" translate>QuickEdit</a> |
|
<a href="" ng-click="item.quickEdit=true" translate>QuickEdit</a> |
|
||||||
<a href="" ng-click="editDialog(item)" translate>Edit</a>
|
<a href="" ng-click="editDialog(item)" translate>Edit</a>
|
||||||
<!-- TODO: translate confirm message -->
|
|
||||||
<span ng-if="item.content_object.collection == 'core/customslide'"> |
|
<span ng-if="item.content_object.collection == 'core/customslide'"> |
|
||||||
<a href="" class="text-danger"
|
<a href="" class="text-danger"
|
||||||
ng-bootbox-confirm="Are you sure you want to delete <b>{{ item.getTitle() }}</b>?"
|
ng-bootbox-confirm="{{ 'Are you sure you want to delete this entry?' | translate }}<br>
|
||||||
|
<b>{{ item.getTitle() }}</b>"
|
||||||
ng-bootbox-confirm-action="deleteRelatedItem(item)" translate>Delete</a>
|
ng-bootbox-confirm-action="deleteRelatedItem(item)" translate>Delete</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@ -159,7 +159,7 @@
|
|||||||
<td ng-if="!item.quickEdit">
|
<td ng-if="!item.quickEdit">
|
||||||
<input type="checkbox" ng-model="item.closed" ng-change="save(item.id);">
|
<input type="checkbox" ng-model="item.closed" ng-change="save(item.id);">
|
||||||
<!-- quickEdit columns -->
|
<!-- quickEdit columns -->
|
||||||
<td ng-if="$parent.item.quickEdit" os-perms="agenda.can_manage" colspan="3">
|
<td ng-show="item.quickEdit" os-perms="agenda.can_manage" colspan="3">
|
||||||
<form ng-submit="save(item)">
|
<form ng-submit="save(item)">
|
||||||
<h4>{{ item.getTitle() }} <span class="text-muted">– QuickEdit</span></h4>
|
<h4>{{ item.getTitle() }} <span class="text-muted">– QuickEdit</span></h4>
|
||||||
<alert ng-show="alert.show" type="{{ alert.type }}" ng-click="alert={}" close="alert={}">
|
<alert ng-show="alert.show" type="{{ alert.type }}" ng-click="alert={}" close="alert={}">
|
||||||
|
@ -79,7 +79,8 @@ angular.module('OpenSlidesApp.assignments', [])
|
|||||||
return DS.defineResource({
|
return DS.defineResource({
|
||||||
name: name,
|
name: name,
|
||||||
useClass: jsDataModel,
|
useClass: jsDataModel,
|
||||||
agendaSupplement: gettext('Election'),
|
verboseName: gettext('Election'),
|
||||||
|
agendaSupplement: this.verboseName,
|
||||||
phases: phases,
|
phases: phases,
|
||||||
getPhases: function () {
|
getPhases: function () {
|
||||||
if (!this.phases) {
|
if (!this.phases) {
|
||||||
|
@ -50,24 +50,54 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// redirects to assignment detail and opens assignment edit form dialog, uses edit url,
|
||||||
|
// used by ui-sref links from agenda only
|
||||||
|
// (from assignment controller use AssignmentForm factory instead to open dialog in front
|
||||||
|
// of current view without redirect)
|
||||||
.state('assignments.assignment.detail.update', {
|
.state('assignments.assignment.detail.update', {
|
||||||
onEnter: ['$stateParams', 'ngDialog', 'Assignment', function($stateParams, ngDialog, Assignment) {
|
onEnter: ['$stateParams', '$state', 'ngDialog', 'Assignment',
|
||||||
ngDialog.open({
|
function($stateParams, $state, ngDialog, Assignment) {
|
||||||
template: 'static/templates/assignments/assignment-form.html',
|
ngDialog.open({
|
||||||
controller: 'AssignmentUpdateCtrl',
|
template: 'static/templates/assignments/assignment-form.html',
|
||||||
className: 'ngdialog-theme-default wide-form',
|
controller: 'AssignmentUpdateCtrl',
|
||||||
resolve: { assignment: function() {
|
className: 'ngdialog-theme-default wide-form',
|
||||||
return Assignment.find($stateParams.id) }}
|
closeByEscape: false,
|
||||||
});
|
closeByDocument: false,
|
||||||
}]
|
resolve: {
|
||||||
|
assignment: function() {return Assignment.find($stateParams.id)}
|
||||||
|
},
|
||||||
|
preCloseCallback: function() {
|
||||||
|
$state.go('assignments.assignment.detail', {assignment: $stateParams.id});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
]
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
// Provide generic assignment form fields for create and update view
|
// Service for generic assignment form (create and update)
|
||||||
.factory('AssignmentFormFieldFactory', [
|
.factory('AssignmentForm', [
|
||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
function (gettextCatalog) {
|
function (gettextCatalog) {
|
||||||
return {
|
return {
|
||||||
|
// ngDialog for assignment form
|
||||||
|
getDialog: function (assignment) {
|
||||||
|
if (assignment) {
|
||||||
|
var resolve = {
|
||||||
|
assignment: function(Assignment) {return Assignment.find(assignment.id);}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
template: 'static/templates/assignments/assignment-form.html',
|
||||||
|
controller: (assignment) ? 'AssignmentUpdateCtrl' : 'AssignmentCreateCtrl',
|
||||||
|
className: 'ngdialog-theme-default wide-form',
|
||||||
|
closeByEscape: false,
|
||||||
|
closeByDocument: false,
|
||||||
|
resolve: (resolve) ? resolve : null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// angular-formly fields for assignment form
|
||||||
getFormFields: function () {
|
getFormFields: function () {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@ -143,9 +173,10 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
|
|||||||
.controller('AssignmentListCtrl', [
|
.controller('AssignmentListCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'ngDialog',
|
'ngDialog',
|
||||||
|
'AssignmentForm',
|
||||||
'Assignment',
|
'Assignment',
|
||||||
'phases',
|
'phases',
|
||||||
function($scope, ngDialog, Assignment, phases) {
|
function($scope, ngDialog, AssignmentForm, Assignment, phases) {
|
||||||
Assignment.bindAll({}, $scope, 'assignments');
|
Assignment.bindAll({}, $scope, 'assignments');
|
||||||
// get all item types via OPTIONS request
|
// get all item types via OPTIONS request
|
||||||
$scope.phases = phases.data.actions.POST.phase.choices;
|
$scope.phases = phases.data.actions.POST.phase.choices;
|
||||||
@ -163,26 +194,9 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
|
|||||||
$scope.sortColumn = column;
|
$scope.sortColumn = column;
|
||||||
};
|
};
|
||||||
|
|
||||||
// open new dialog
|
// open new/edit dialog
|
||||||
$scope.newDialog = function () {
|
$scope.openDialog = function (assignment) {
|
||||||
ngDialog.open({
|
ngDialog.open(AssignmentForm.getDialog(assignment));
|
||||||
template: 'static/templates/assignments/assignment-form.html',
|
|
||||||
controller: 'AssignmentCreateCtrl',
|
|
||||||
className: 'ngdialog-theme-default wide-form'
|
|
||||||
});
|
|
||||||
};
|
|
||||||
// open edit dialog
|
|
||||||
$scope.editDialog = function (assignment) {
|
|
||||||
ngDialog.open({
|
|
||||||
template: 'static/templates/assignments/assignment-form.html',
|
|
||||||
controller: 'AssignmentUpdateCtrl',
|
|
||||||
className: 'ngdialog-theme-default wide-form',
|
|
||||||
resolve: {
|
|
||||||
assignment: function(Assignment) {
|
|
||||||
return Assignment.find(assignment.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
// save changed assignment
|
// save changed assignment
|
||||||
$scope.save = function (assignment) {
|
$scope.save = function (assignment) {
|
||||||
@ -237,16 +251,22 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
|
|||||||
'$http',
|
'$http',
|
||||||
'gettext',
|
'gettext',
|
||||||
'ngDialog',
|
'ngDialog',
|
||||||
|
'AssignmentForm',
|
||||||
'operator',
|
'operator',
|
||||||
'Assignment',
|
'Assignment',
|
||||||
'User',
|
'User',
|
||||||
'assignment',
|
'assignment',
|
||||||
function($scope, $http, gettext, ngDialog, operator, Assignment, User, assignment) {
|
function($scope, $http, gettext, ngDialog, AssignmentForm, operator, Assignment, User, assignment) {
|
||||||
User.bindAll({}, $scope, 'users');
|
User.bindAll({}, $scope, 'users');
|
||||||
Assignment.bindOne(assignment.id, $scope, 'assignment');
|
Assignment.bindOne(assignment.id, $scope, 'assignment');
|
||||||
Assignment.loadRelations(assignment, 'agenda_item');
|
Assignment.loadRelations(assignment, 'agenda_item');
|
||||||
$scope.candidateSelectBox = {};
|
$scope.candidateSelectBox = {};
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
|
|
||||||
|
// open edit dialog
|
||||||
|
$scope.openDialog = function (assignment) {
|
||||||
|
ngDialog.open(AssignmentForm.getDialog(assignment));
|
||||||
|
};
|
||||||
// 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})
|
||||||
@ -369,13 +389,13 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
|
|||||||
'$scope',
|
'$scope',
|
||||||
'$state',
|
'$state',
|
||||||
'Assignment',
|
'Assignment',
|
||||||
'AssignmentFormFieldFactory',
|
'AssignmentForm',
|
||||||
function($scope, $state, Assignment, AssignmentFormFieldFactory) {
|
function($scope, $state, Assignment, AssignmentForm) {
|
||||||
$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;
|
||||||
// get all form fields
|
// get all form fields
|
||||||
$scope.formFields = AssignmentFormFieldFactory.getFormFields();
|
$scope.formFields = AssignmentForm.getFormFields();
|
||||||
|
|
||||||
// save assignment
|
// save assignment
|
||||||
$scope.save = function(assignment) {
|
$scope.save = function(assignment) {
|
||||||
@ -392,13 +412,13 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
|
|||||||
'$scope',
|
'$scope',
|
||||||
'$state',
|
'$state',
|
||||||
'Assignment',
|
'Assignment',
|
||||||
'AssignmentFormFieldFactory',
|
'AssignmentForm',
|
||||||
'assignment',
|
'assignment',
|
||||||
function($scope, $state, Assignment, AssignmentFormFieldFactory, assignment) {
|
function($scope, $state, Assignment, AssignmentForm, assignment) {
|
||||||
// set initial values for form model
|
// set initial values for form model
|
||||||
$scope.model = assignment;
|
$scope.model = assignment;
|
||||||
// get all form fields
|
// get all form fields
|
||||||
$scope.formFields = AssignmentFormFieldFactory.getFormFields();
|
$scope.formFields = AssignmentForm.getFormFields();
|
||||||
|
|
||||||
// save assignment
|
// save assignment
|
||||||
$scope.save = function (assignment) {
|
$scope.save = function (assignment) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<div class="submenu">
|
<div class="submenu">
|
||||||
<a ui-sref="assignments.assignment.list" class="btn btn-sm btn-default">
|
<a ui-sref="assignments.assignment.list" class="btn btn-sm btn-default">
|
||||||
<i class="fa fa-angle-double-left fa-lg"></i>
|
<i class="fa fa-angle-double-left fa-lg"></i>
|
||||||
<translate>Back to overview</translate>
|
<translate>All elections</translate>
|
||||||
</a>
|
</a>
|
||||||
<a ui-sref="assignments_single_pdf({pk: assignment.id})" target="_blank" class="btn btn-default btn-sm">
|
<a ui-sref="assignments_single_pdf({pk: assignment.id})" target="_blank" class="btn btn-default btn-sm">
|
||||||
<i class="fa fa-file-pdf-o fa-lg"></i>
|
<i class="fa fa-file-pdf-o fa-lg"></i>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
<i class="fa fa-video-camera"></i>
|
<i class="fa fa-video-camera"></i>
|
||||||
</a>
|
</a>
|
||||||
<!-- edit -->
|
<!-- edit -->
|
||||||
<a ui-sref="assignments.assignment.detail.update({id: assignment.id })" os-perms="assignments.can_manage"
|
<a os-perms="assignments.can_manage" ng-click="openDialog(assignment)"
|
||||||
class="btn btn-default btn-sm"
|
class="btn btn-default btn-sm"
|
||||||
title="{{ 'Edit' | translate}}">
|
title="{{ 'Edit' | translate}}">
|
||||||
<i class="fa fa-pencil"></i>
|
<i class="fa fa-pencil"></i>
|
||||||
@ -30,8 +30,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<h1>{{ assignment.title }}</h1>
|
<h1>{{ assignment.title }}</h1>
|
||||||
<h2>
|
<h2>
|
||||||
<translate>Election</translate> –
|
<translate>Election</translate>
|
||||||
<translate>Agenda</translate>: {{ assignment.agenda_item.item_number }}
|
<span ng-if="assignment.agenda_item.item_number">
|
||||||
|
–
|
||||||
|
<translate>Agenda</translate>: {{ assignment.agenda_item.item_number }}
|
||||||
|
</span>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<form name="assignmentForm" ng-submit="save(model)">
|
<form name="assignmentForm" ng-submit="save(model)">
|
||||||
<formly-form model="model" fields="formFields">
|
<formly-form model="model" fields="formFields">
|
||||||
<button type="submit" ng-disabled="assignmentForm.$invalid" class="btn btn-primary" translate>
|
<button type="submit" ng-disabled="assignmentForm.$invalid" class="btn btn-primary" translate>
|
||||||
Submit
|
Save
|
||||||
</button>
|
</button>
|
||||||
<button ng-click="closeThisDialog()" class="btn btn-default" translate>
|
<button ng-click="closeThisDialog()" class="btn btn-default" translate>
|
||||||
Cancel
|
Cancel
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div class="submenu">
|
<div class="submenu">
|
||||||
<a ng-click="newDialog()" os-perms="assignments.can_manage" class="btn btn-primary btn-sm">
|
<a ng-click="openDialog()" os-perms="assignments.can_manage" class="btn btn-primary btn-sm">
|
||||||
<i class="fa fa-plus fa-lg"></i>
|
<i class="fa fa-plus fa-lg"></i>
|
||||||
<translate>New</translate>
|
<translate>New</translate>
|
||||||
</a>
|
</a>
|
||||||
@ -115,11 +115,11 @@
|
|||||||
<td ng-if="!assignment.quickEdit" ng-mouseover="assignment.hover=true" ng-mouseleave="assignment.hover=false">
|
<td ng-if="!assignment.quickEdit" ng-mouseover="assignment.hover=true" ng-mouseleave="assignment.hover=false">
|
||||||
<strong><a ui-sref="assignments.assignment.detail({id: assignment.id})">{{ assignment.title }}</a></strong>
|
<strong><a ui-sref="assignments.assignment.detail({id: assignment.id})">{{ assignment.title }}</a></strong>
|
||||||
<div os-perms="assignments.can_manage" class="hoverActions" ng-class="{'hiddenDiv': !assignment.hover}">
|
<div os-perms="assignments.can_manage" class="hoverActions" ng-class="{'hiddenDiv': !assignment.hover}">
|
||||||
<a href="" ng-click="editDialog(assignment)" translate>Edit</a> |
|
<a href="" ng-click="openDialog(assignment)" translate>Edit</a> |
|
||||||
<a href="" ng-click="assignment.quickEdit=true" translate>QuickEdit</a> |
|
<a href="" ng-click="assignment.quickEdit=true" translate>QuickEdit</a> |
|
||||||
<!-- TODO: translate confirm message -->
|
|
||||||
<a href="" class="text-danger"
|
<a href="" class="text-danger"
|
||||||
ng-bootbox-confirm="Are you sure you want to delete <b>{{ assignment.title }}</b>?"
|
ng-bootbox-confirm="{{ 'Are you sure you want to delete this entry?' | translate }}<br>
|
||||||
|
<b>{{ assignment.title }}</b>"
|
||||||
ng-bootbox-confirm-action="delete(assignment)" translate>Delete</a>
|
ng-bootbox-confirm-action="delete(assignment)" translate>Delete</a>
|
||||||
</div>
|
</div>
|
||||||
<td ng-if="!assignment.quickEdit" class="optional">
|
<td ng-if="!assignment.quickEdit" class="optional">
|
||||||
@ -164,7 +164,7 @@
|
|||||||
<button ng-click="save(assignment)" class="btn btn-primary" translate>
|
<button ng-click="save(assignment)" class="btn btn-primary" translate>
|
||||||
Update
|
Update
|
||||||
</button>
|
</button>
|
||||||
<a href="" ng-click="editDialog(assignment)"
|
<a href="" ng-click="openDialog(assignment)"
|
||||||
class="pull-right" translate>Edit election ...</a>
|
class="pull-right" translate>Edit election ...</a>
|
||||||
</div>
|
</div>
|
||||||
</table>
|
</table>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<form name="assignmentpollForm" ng-submit="save(model)">
|
<form name="assignmentpollForm" ng-submit="save(model)">
|
||||||
<formly-form model="model" fields="formFields">
|
<formly-form model="model" fields="formFields">
|
||||||
<button type="submit" ng-disabled="assignmentForm.$invalid" class="btn btn-primary" translate>
|
<button type="submit" ng-disabled="assignmentForm.$invalid" class="btn btn-primary" translate>
|
||||||
Submit
|
Save
|
||||||
</button>
|
</button>
|
||||||
<button ng-click="closeThisDialog()" class="btn btn-default" translate>
|
<button ng-click="closeThisDialog()" class="btn btn-default" translate>
|
||||||
Cancel
|
Cancel
|
||||||
|
@ -167,11 +167,13 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
.factory('Customslide', [
|
.factory('Customslide', [
|
||||||
'DS',
|
'DS',
|
||||||
'jsDataModel',
|
'jsDataModel',
|
||||||
function(DS, jsDataModel) {
|
'gettext',
|
||||||
|
function(DS, jsDataModel, gettext) {
|
||||||
var name = 'core/customslide';
|
var name = 'core/customslide';
|
||||||
return DS.defineResource({
|
return DS.defineResource({
|
||||||
name: name,
|
name: name,
|
||||||
useClass: jsDataModel,
|
useClass: jsDataModel,
|
||||||
|
verboseName: gettext('Agenda item'),
|
||||||
methods: {
|
methods: {
|
||||||
getResourceName: function () {
|
getResourceName: function () {
|
||||||
return name;
|
return name;
|
||||||
|
@ -258,6 +258,13 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('core.tag.create', {})
|
.state('core.tag.create', {})
|
||||||
|
.state('core.tag.detail', {
|
||||||
|
resolve: {
|
||||||
|
tag: function(Tag, $stateParams) {
|
||||||
|
return Tag.find($stateParams.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
.state('core.tag.detail.update', {
|
.state('core.tag.detail.update', {
|
||||||
views: {
|
views: {
|
||||||
'@core.tag': {}
|
'@core.tag': {}
|
||||||
@ -747,7 +754,6 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
Tag.save(tag);
|
Tag.save(tag);
|
||||||
};
|
};
|
||||||
$scope.delete = function (tag) {
|
$scope.delete = function (tag) {
|
||||||
//TODO: add confirm message
|
|
||||||
Tag.destroy(tag.id).then(
|
Tag.destroy(tag.id).then(
|
||||||
function(success) {
|
function(success) {
|
||||||
//TODO: success message
|
//TODO: success message
|
||||||
@ -756,6 +762,10 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
.controller('TagDetailCtrl', function($scope, Tag, tag) {
|
||||||
|
Tag.bindOne(tag.id, $scope, 'tag');
|
||||||
|
})
|
||||||
|
|
||||||
.controller('TagCreateCtrl', function($scope, $state, Tag) {
|
.controller('TagCreateCtrl', function($scope, $state, Tag) {
|
||||||
$scope.tag = {};
|
$scope.tag = {};
|
||||||
$scope.save = function (tag) {
|
$scope.save = function (tag) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<form name="customslideForm" ng-submit="save(model)">
|
<form name="customslideForm" ng-submit="save(model)">
|
||||||
<formly-form model="model" fields="formFields">
|
<formly-form model="model" fields="formFields">
|
||||||
<button type="submit" ng-disabled="customslideForm.$invalid" class="btn btn-primary" translate>
|
<button type="submit" ng-disabled="customslideForm.$invalid" class="btn btn-primary" translate>
|
||||||
Submit
|
Save
|
||||||
</button>
|
</button>
|
||||||
<button ng-click="closeThisDialog()" class="btn btn-default" translate>
|
<button ng-click="closeThisDialog()" class="btn btn-default" translate>
|
||||||
Cancel
|
Cancel
|
||||||
|
14
openslides/core/static/templates/core/tag-detail.html
Normal file
14
openslides/core/static/templates/core/tag-detail.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<div class="header">
|
||||||
|
<div class="title">
|
||||||
|
<div class="submenu">
|
||||||
|
<a ui-sref="core.tag.list" class="btn btn-sm btn-default">
|
||||||
|
<i class="fa fa-angle-double-left fa-lg"></i>
|
||||||
|
<translate>Back to overview</translate>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<h1>{{ tag.name }}</h1>
|
||||||
|
<h2 translate>Tag</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="details"></div>
|
@ -34,9 +34,9 @@
|
|||||||
<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> |
|
||||||
<!-- TODO: translate confirm message -->
|
|
||||||
<a href="" class="text-danger"
|
<a href="" class="text-danger"
|
||||||
ng-bootbox-confirm="Are you sure you want to delete <b>{{ tag.name }}</b>?"
|
ng-bootbox-confirm="{{ 'Are you sure you want to delete this entry?' | translate }}<br>
|
||||||
|
<b>{{ tag.name }}</b>"
|
||||||
ng-bootbox-confirm-action="delete(tag)" translate>Delete</a>
|
ng-bootbox-confirm-action="delete(tag)" translate>Delete</a>
|
||||||
</div>
|
</div>
|
||||||
</table>
|
</table>
|
||||||
|
@ -109,7 +109,6 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
function uploadFile($timeout, $scope, $state, operator, Upload, mediafile) {
|
function uploadFile($timeout, $scope, $state, operator, Upload, mediafile) {
|
||||||
console.log(operator.user);
|
|
||||||
return function(file) {
|
return function(file) {
|
||||||
file.upload = Upload.upload({
|
file.upload = Upload.upload({
|
||||||
url: '/rest/mediafiles/mediafile/' + (mediafile ? mediafile.id : ''),
|
url: '/rest/mediafiles/mediafile/' + (mediafile ? mediafile.id : ''),
|
||||||
|
@ -168,7 +168,8 @@ angular.module('OpenSlidesApp.motions', ['OpenSlidesApp.users'])
|
|||||||
return DS.defineResource({
|
return DS.defineResource({
|
||||||
name: name,
|
name: name,
|
||||||
useClass: jsDataModel,
|
useClass: jsDataModel,
|
||||||
agendaSupplement: gettext('Motion'),
|
verboseName: gettext('Motion'),
|
||||||
|
agendaSupplement: this.verboseName,
|
||||||
methods: {
|
methods: {
|
||||||
getResourceName: function () {
|
getResourceName: function () {
|
||||||
return name;
|
return name;
|
||||||
|
@ -64,16 +64,29 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// redirects to motion detail and opens motion edit form dialog, uses edit url,
|
||||||
|
// used by ui-sref links from agenda only
|
||||||
|
// (from motion controller use MotionForm factory instead to open dialog in front of
|
||||||
|
// current view without redirect)
|
||||||
.state('motions.motion.detail.update', {
|
.state('motions.motion.detail.update', {
|
||||||
onEnter: ['$stateParams', 'ngDialog', 'Motion', function($stateParams, ngDialog, Motion) {
|
onEnter: ['$stateParams', '$state', 'ngDialog', 'Motion',
|
||||||
ngDialog.open({
|
function($stateParams, $state, ngDialog, Motion) {
|
||||||
template: 'static/templates/motions/motion-form.html',
|
ngDialog.open({
|
||||||
controller: 'MotionUpdateCtrl',
|
template: 'static/templates/motions/motion-form.html',
|
||||||
className: 'ngdialog-theme-default wide-form',
|
controller: 'MotionUpdateCtrl',
|
||||||
resolve: { motion: function() {
|
className: 'ngdialog-theme-default wide-form',
|
||||||
return Motion.find($stateParams.id) }}
|
closeByEscape: false,
|
||||||
});
|
closeByDocument: false,
|
||||||
}]
|
resolve: {
|
||||||
|
motion: function() {return Motion.find($stateParams.id)}
|
||||||
|
},
|
||||||
|
preCloseCallback: function() {
|
||||||
|
$state.go('motions.motion.detail', {motion: $stateParams.id});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.state('motions.motion.import', {
|
.state('motions.motion.import', {
|
||||||
url: '/import',
|
url: '/import',
|
||||||
@ -118,8 +131,8 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
// Provide generic motion form fields for create and update view
|
// Service for generic motion form (create and update)
|
||||||
.factory('MotionFormFieldFactory', [
|
.factory('MotionForm', [
|
||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
'operator',
|
'operator',
|
||||||
'Category',
|
'Category',
|
||||||
@ -130,6 +143,23 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
'Workflow',
|
'Workflow',
|
||||||
function (gettextCatalog, operator, Category, Config, Mediafile, Tag, User, Workflow) {
|
function (gettextCatalog, operator, Category, Config, Mediafile, Tag, User, Workflow) {
|
||||||
return {
|
return {
|
||||||
|
// ngDialog for motion form
|
||||||
|
getDialog: function (motion) {
|
||||||
|
if (motion) {
|
||||||
|
var resolve = {
|
||||||
|
motion: function(Motion) { return Motion.find(motion.id); }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
template: 'static/templates/motions/motion-form.html',
|
||||||
|
controller: (motion) ? 'MotionUpdateCtrl' : 'MotionCreateCtrl',
|
||||||
|
className: 'ngdialog-theme-default wide-form',
|
||||||
|
closeByEscape: false,
|
||||||
|
closeByDocument: false,
|
||||||
|
resolve: (resolve) ? resolve : null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// angular-formly fields for motion form
|
||||||
getFormFields: function () {
|
getFormFields: function () {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@ -266,12 +296,13 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
'$scope',
|
'$scope',
|
||||||
'$state',
|
'$state',
|
||||||
'ngDialog',
|
'ngDialog',
|
||||||
|
'MotionForm',
|
||||||
'Motion',
|
'Motion',
|
||||||
'Category',
|
'Category',
|
||||||
'Tag',
|
'Tag',
|
||||||
'Workflow',
|
'Workflow',
|
||||||
'User',
|
'User',
|
||||||
function($scope, $state, ngDialog, Motion, Category, Tag, Workflow, User) {
|
function($scope, $state, ngDialog, MotionForm, Motion, Category, Tag, Workflow, User) {
|
||||||
Motion.bindAll({}, $scope, 'motions');
|
Motion.bindAll({}, $scope, 'motions');
|
||||||
Category.bindAll({}, $scope, 'categories');
|
Category.bindAll({}, $scope, 'categories');
|
||||||
Tag.bindAll({}, $scope, 'tags');
|
Tag.bindAll({}, $scope, 'tags');
|
||||||
@ -318,26 +349,9 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// open new dialog
|
// open new/edit dialog
|
||||||
$scope.newDialog = function () {
|
$scope.openDialog = function (motion) {
|
||||||
ngDialog.open({
|
ngDialog.open(MotionForm.getDialog(motion));
|
||||||
template: 'static/templates/motions/motion-form.html',
|
|
||||||
controller: 'MotionCreateCtrl',
|
|
||||||
className: 'ngdialog-theme-default wide-form'
|
|
||||||
});
|
|
||||||
};
|
|
||||||
// open edit dialog
|
|
||||||
$scope.editDialog = function (motion) {
|
|
||||||
ngDialog.open({
|
|
||||||
template: 'static/templates/motions/motion-form.html',
|
|
||||||
controller: 'MotionUpdateCtrl',
|
|
||||||
className: 'ngdialog-theme-default wide-form',
|
|
||||||
resolve: {
|
|
||||||
motion: function(Motion) {
|
|
||||||
return Motion.find(motion.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
// save changed motion
|
// save changed motion
|
||||||
$scope.save = function (motion) {
|
$scope.save = function (motion) {
|
||||||
@ -396,6 +410,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
'$scope',
|
'$scope',
|
||||||
'$http',
|
'$http',
|
||||||
'ngDialog',
|
'ngDialog',
|
||||||
|
'MotionForm',
|
||||||
'Motion',
|
'Motion',
|
||||||
'Category',
|
'Category',
|
||||||
'Mediafile',
|
'Mediafile',
|
||||||
@ -403,7 +418,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
'User',
|
'User',
|
||||||
'Workflow',
|
'Workflow',
|
||||||
'motion',
|
'motion',
|
||||||
function($scope, $http, ngDialog, Motion, Category, Mediafile, Tag, User, Workflow, motion) {
|
function($scope, $http, ngDialog, MotionForm, Motion, Category, Mediafile, Tag, User, Workflow, motion) {
|
||||||
Motion.bindOne(motion.id, $scope, 'motion');
|
Motion.bindOne(motion.id, $scope, 'motion');
|
||||||
Category.bindAll({}, $scope, 'categories');
|
Category.bindAll({}, $scope, 'categories');
|
||||||
Mediafile.bindAll({}, $scope, 'mediafiles');
|
Mediafile.bindAll({}, $scope, 'mediafiles');
|
||||||
@ -411,24 +426,13 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
User.bindAll({}, $scope, 'users');
|
User.bindAll({}, $scope, 'users');
|
||||||
Workflow.bindAll({}, $scope, 'workflows');
|
Workflow.bindAll({}, $scope, 'workflows');
|
||||||
Motion.loadRelations(motion, 'agenda_item');
|
Motion.loadRelations(motion, 'agenda_item');
|
||||||
// TODO: make 'motion.attachments' useable and itteratable in template
|
|
||||||
// Motion.loadRelations(motion, 'attachments');
|
|
||||||
|
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
$scope.isCollapsed = true;
|
$scope.isCollapsed = true;
|
||||||
|
|
||||||
// open edit dialog
|
// open edit dialog
|
||||||
$scope.editDialog = function (motion) {
|
$scope.openDialog = function (motion) {
|
||||||
ngDialog.open({
|
ngDialog.open(MotionForm.getDialog(motion));
|
||||||
template: 'static/templates/motions/motion-form.html',
|
|
||||||
controller: 'MotionUpdateCtrl',
|
|
||||||
className: 'ngdialog-theme-default wide-form',
|
|
||||||
resolve: {
|
|
||||||
motion: function(Motion) {
|
|
||||||
return Motion.find(motion.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.support = function () {
|
$scope.support = function () {
|
||||||
@ -437,8 +441,8 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
$scope.unsupport = function () {
|
$scope.unsupport = function () {
|
||||||
$http.delete('/rest/motions/motion/' + motion.id + '/support/');
|
$http.delete('/rest/motions/motion/' + motion.id + '/support/');
|
||||||
}
|
}
|
||||||
$scope.update_state = function (state) {
|
$scope.updateState = function (state_id) {
|
||||||
$http.put('/rest/motions/motion/' + motion.id + '/set_state/', {'state': state.id});
|
$http.put('/rest/motions/motion/' + motion.id + '/set_state/', {'state': state_id});
|
||||||
}
|
}
|
||||||
$scope.reset_state = function (state_id) {
|
$scope.reset_state = function (state_id) {
|
||||||
$http.put('/rest/motions/motion/' + motion.id + '/set_state/', {});
|
$http.put('/rest/motions/motion/' + motion.id + '/set_state/', {});
|
||||||
@ -483,14 +487,14 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
'$state',
|
'$state',
|
||||||
'gettext',
|
'gettext',
|
||||||
'Motion',
|
'Motion',
|
||||||
'MotionFormFieldFactory',
|
'MotionForm',
|
||||||
'Category',
|
'Category',
|
||||||
'Config',
|
'Config',
|
||||||
'Mediafile',
|
'Mediafile',
|
||||||
'Tag',
|
'Tag',
|
||||||
'User',
|
'User',
|
||||||
'Workflow',
|
'Workflow',
|
||||||
function($scope, $state, gettext, Motion, MotionFormFieldFactory, Category, Config, Mediafile, Tag, User, Workflow) {
|
function($scope, $state, gettext, Motion, MotionForm, Category, Config, Mediafile, Tag, User, Workflow) {
|
||||||
Category.bindAll({}, $scope, 'categories');
|
Category.bindAll({}, $scope, 'categories');
|
||||||
Mediafile.bindAll({}, $scope, 'mediafiles');
|
Mediafile.bindAll({}, $scope, 'mediafiles');
|
||||||
Tag.bindAll({}, $scope, 'tags');
|
Tag.bindAll({}, $scope, 'tags');
|
||||||
@ -504,7 +508,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
// ... preselect default workflow
|
// ... preselect default workflow
|
||||||
$scope.model.workflow_id = Config.get('motions_workflow').value;
|
$scope.model.workflow_id = Config.get('motions_workflow').value;
|
||||||
// get all form fields
|
// get all form fields
|
||||||
$scope.formFields = MotionFormFieldFactory.getFormFields();
|
$scope.formFields = MotionForm.getFormFields();
|
||||||
for (var i = 0; i < $scope.formFields.length; i++) {
|
for (var i = 0; i < $scope.formFields.length; i++) {
|
||||||
if ($scope.formFields[i].key == "identifier") {
|
if ($scope.formFields[i].key == "identifier") {
|
||||||
$scope.formFields[i].hide = true;
|
$scope.formFields[i].hide = true;
|
||||||
@ -528,12 +532,12 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
'Category',
|
'Category',
|
||||||
'Config',
|
'Config',
|
||||||
'Mediafile',
|
'Mediafile',
|
||||||
'MotionFormFieldFactory',
|
'MotionForm',
|
||||||
'Tag',
|
'Tag',
|
||||||
'User',
|
'User',
|
||||||
'Workflow',
|
'Workflow',
|
||||||
'motion',
|
'motion',
|
||||||
function($scope, $state, Motion, Category, Config, Mediafile, MotionFormFieldFactory, Tag, User, Workflow, motion) {
|
function($scope, $state, Motion, Category, Config, Mediafile, MotionForm, Tag, User, Workflow, motion) {
|
||||||
Category.bindAll({}, $scope, 'categories');
|
Category.bindAll({}, $scope, 'categories');
|
||||||
Mediafile.bindAll({}, $scope, 'mediafiles');
|
Mediafile.bindAll({}, $scope, 'mediafiles');
|
||||||
Tag.bindAll({}, $scope, 'tags');
|
Tag.bindAll({}, $scope, 'tags');
|
||||||
@ -544,7 +548,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
$scope.model = motion;
|
$scope.model = motion;
|
||||||
$scope.model.more = false;
|
$scope.model.more = false;
|
||||||
// get all form fields
|
// get all form fields
|
||||||
$scope.formFields = MotionFormFieldFactory.getFormFields();
|
$scope.formFields = MotionForm.getFormFields();
|
||||||
// override default values for update form
|
// override default values for update form
|
||||||
for (var i = 0; i < $scope.formFields.length; i++) {
|
for (var i = 0; i < $scope.formFields.length; i++) {
|
||||||
if ($scope.formFields[i].key == "identifier") {
|
if ($scope.formFields[i].key == "identifier") {
|
||||||
@ -567,7 +571,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
// get saved workflow id from state
|
// get saved workflow id from state
|
||||||
$scope.formFields[i].defaultValue = motion.state.workflow_id;
|
$scope.formFields[i].defaultValue = motion.state.workflow_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// save motion
|
// save motion
|
||||||
$scope.save = function (motion) {
|
$scope.save = function (motion) {
|
||||||
@ -755,6 +759,17 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
.controller('CategoryListCtrl', function($scope, Category) {
|
.controller('CategoryListCtrl', function($scope, Category) {
|
||||||
Category.bindAll({}, $scope, 'categories');
|
Category.bindAll({}, $scope, 'categories');
|
||||||
|
|
||||||
|
// setup table sorting
|
||||||
|
$scope.sortColumn = 'name';
|
||||||
|
$scope.reverse = false;
|
||||||
|
// function to sort by clicked column
|
||||||
|
$scope.toggleSort = function ( column ) {
|
||||||
|
if ( $scope.sortColumn === column ) {
|
||||||
|
$scope.reverse = !$scope.reverse;
|
||||||
|
}
|
||||||
|
$scope.sortColumn = column;
|
||||||
|
};
|
||||||
|
|
||||||
// delete selected category
|
// delete selected category
|
||||||
$scope.delete = function (category) {
|
$scope.delete = function (category) {
|
||||||
Category.destroy(category.id);
|
Category.destroy(category.id);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<h1>{{ category.name }}</h1>
|
<h1>{{ category.name }}</h1>
|
||||||
|
<h2 translate>Category</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -25,32 +25,29 @@
|
|||||||
<table class="table table-striped table-bordered table-hover">
|
<table class="table table-striped table-bordered table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th ng-click="sortby='prefix';reverse=!reverse">
|
<th ng-click="toggleSort('name')" class="sortable">
|
||||||
<translate>Prefix</translate>
|
|
||||||
<i class="fa" ng-show="sortby == 'prefix'"
|
|
||||||
ng-class="reverse ? 'fa-caret-down' : 'fa-caret-up'"></i>
|
|
||||||
<th ng-click="sortby='name';reverse=!reverse">
|
|
||||||
<translate>Name</translate>
|
<translate>Name</translate>
|
||||||
<i class="fa" ng-show="sortby == 'name'"
|
<i class="pull-right fa" ng-show="sortColumn === 'name' && header.sortable != false"
|
||||||
ng-class="reverse ? 'fa-caret-down' : 'fa-caret-up'"></i>
|
ng-class="reverse ? 'fa-sort-desc' : 'fa-sort-asc'">
|
||||||
<th os-perms="motions.can_manage core.can_manage_projector" class="mini_width" translate>Actions</th>
|
</i>
|
||||||
|
<th ng-click="toggleSort('prefix')" class="sortable">
|
||||||
|
<translate>Prefix</translate>
|
||||||
|
<i class="pull-right fa" ng-show="sortColumn === 'prefix' && header.sortable != false"
|
||||||
|
ng-class="reverse ? 'fa-sort-desc' : 'fa-sort-asc'">
|
||||||
|
</i>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="category in categories | filter: filter.search | orderBy:sortby:reverse">
|
<tr ng-repeat="category in categories | filter: filter.search | orderBy: sortColumn:reverse">
|
||||||
|
<td ng-mouseover="category.hover=true" ng-mouseleave="category.hover=false">
|
||||||
|
<strong>{{ category.name }}</strong>
|
||||||
|
<div class="hoverActions" ng-class="{'hiddenDiv': !category.hover}">
|
||||||
|
<!-- edit -->
|
||||||
|
<a ui-sref="motions.category.detail.update({id: category.id })" translate>Edit</a> |
|
||||||
|
<!-- delete -->
|
||||||
|
<a href="" class="text-danger"
|
||||||
|
ng-bootbox-confirm="{{ 'Are you sure you want to delete this entry?' | translate }}<br>
|
||||||
|
<b>{{ category.name }}</b>"
|
||||||
|
ng-bootbox-confirm-action="delete(category)" translate>Delete</a>
|
||||||
|
</div>
|
||||||
<td>{{ category.prefix }}
|
<td>{{ category.prefix }}
|
||||||
<td><a ui-sref="motions.category.detail({id: category.id})">{{ category.name }}</a>
|
|
||||||
<td os-perms="motions.can_manage" class="nobr minimum">
|
|
||||||
<!-- edit -->
|
|
||||||
<a ui-sref="motions.category.detail.update({id: category.id})" os-perms="motions.can_manage"
|
|
||||||
class="btn btn-default btn-sm"
|
|
||||||
title="{{ 'Edit' | translate }}">
|
|
||||||
<i class="fa fa-pencil"></i>
|
|
||||||
</a>
|
|
||||||
<!-- delete -->
|
|
||||||
<a os-perms="motions.can_manage" class="btn btn-danger btn-sm"
|
|
||||||
ng-bootbox-confirm="Are you sure you want to delete <b>{{ category.name }}</b>?"
|
|
||||||
ng-bootbox-confirm-action="delete(category)"
|
|
||||||
title="{{ 'Delete' | translate }}">
|
|
||||||
<i class="fa fa-trash-o"></i>
|
|
||||||
</a>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<!-- TODO: show list of speakers controls for { motion.agenda_item } -->
|
|
||||||
<div class="submenu">
|
<div class="submenu">
|
||||||
<a ui-sref="motions.motion.list" class="btn btn-sm btn-default">
|
<a ui-sref="motions.motion.list" class="btn btn-sm btn-default">
|
||||||
<i class="fa fa-angle-double-left fa-lg"></i>
|
<i class="fa fa-angle-double-left fa-lg"></i>
|
||||||
<translate>Back to overview</translate>
|
<translate>All motions</translate>
|
||||||
</a>
|
</a>
|
||||||
<a ui-sref="motions_single_pdf({pk: motion.id})" target="_blank" class="btn btn-default btn-sm">
|
<a ui-sref="motions_single_pdf({pk: motion.id})" target="_blank" class="btn btn-default btn-sm">
|
||||||
<i class="fa fa-file-pdf-o fa-lg"></i>
|
<i class="fa fa-file-pdf-o fa-lg"></i>
|
||||||
@ -23,7 +22,7 @@
|
|||||||
<i class="fa fa-video-camera"></i>
|
<i class="fa fa-video-camera"></i>
|
||||||
</a>
|
</a>
|
||||||
<!-- edit -->
|
<!-- edit -->
|
||||||
<a ng-if="motion.isAllowed('update')" ui-sref="motions.motion.detail.update({id: motion.id })"
|
<a ng-if="motion.isAllowed('update')" ng-click="openDialog(motion)"
|
||||||
class="btn btn-default btn-sm"
|
class="btn btn-default btn-sm"
|
||||||
title="{{ 'Edit' | translate}}">
|
title="{{ 'Edit' | translate}}">
|
||||||
<i class="fa fa-pencil"></i>
|
<i class="fa fa-pencil"></i>
|
||||||
@ -33,8 +32,10 @@
|
|||||||
<h2>
|
<h2>
|
||||||
<translate>Motion</translate> {{ motion.identifier }}
|
<translate>Motion</translate> {{ motion.identifier }}
|
||||||
<span ng-if="motion.versions.length > 1" >| Version {{ motion.active_version }}</span>
|
<span ng-if="motion.versions.length > 1" >| Version {{ motion.active_version }}</span>
|
||||||
–
|
<span ng-if="motion.agenda_item.item_number">
|
||||||
<translate>Agenda</translate>: {{ motion.agenda_item.item_number }}
|
–
|
||||||
|
<translate>Agenda</translate>: {{ motion.agenda_item.item_number }}
|
||||||
|
</span>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -86,24 +87,22 @@
|
|||||||
{{ motion.state.name | translate }}
|
{{ motion.state.name | translate }}
|
||||||
</span>
|
</span>
|
||||||
<div ng-if="motion.isAllowed('change_state')" class="spacer">
|
<div ng-if="motion.isAllowed('change_state')" class="spacer">
|
||||||
<div class="btn-group-vertical spacer" role="group">
|
<select ng-if="motion.state.getNextStates().length > 0" ng-model="stateSelect" class="form-control" ng-change="updateState(stateSelect)">
|
||||||
<button ng-repeat="state in motion.state.getNextStates()" ng-click="update_state(state)"
|
<option value="" translate>--- Set next state ---</option>
|
||||||
class="btn btn-default btn-sm">
|
<option ng-repeat="state in motion.state.getNextStates()" value="{{ state.id }}">{{ state.action_word }}</option>
|
||||||
{{state.action_word}}
|
</select>
|
||||||
</button>
|
<button ng-if="motion.isAllowed('reset_state')" ng-click="reset_state()"
|
||||||
<button ng-if="motion.isAllowed('reset_state')" ng-click="reset_state()"
|
class="btn btn-danger btn-xs spacer">
|
||||||
class="btn btn-danger btn-xs">
|
<i class="fa fa-exclamation-triangle"></i>
|
||||||
<i class="fa fa-exclamation-triangle"></i>
|
<translate>Reset state</translate>
|
||||||
<translate>Reset state</translate>
|
</button>
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<h3 ng-if="motion.polls.length > 0" translate>Voting result</h3>
|
<h3 ng-if="motion.polls.length > 0" translate>Voting result</h3>
|
||||||
<ol class="slimlist">
|
<ol class="slimlist">
|
||||||
<li ng-repeat="poll in motion.polls" class="spacer">
|
<li ng-repeat="poll in motion.polls" class="spacer">
|
||||||
<translate>Vote</translate>
|
<translate translate-context="ballot">Vote</translate>
|
||||||
<button os-perms="motions.can_manage" ng-click="$parent.poll.isEditMode=true;"
|
<button os-perms="motions.can_manage" ng-click="$parent.poll.isEditMode=true;"
|
||||||
class="btn btn-default btn-xs">
|
class="btn btn-default btn-xs">
|
||||||
<i class="fa fa-pencil"></i>
|
<i class="fa fa-pencil"></i>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<form name="motionForm" ng-submit="save(model)">
|
<form name="motionForm" ng-submit="save(model)">
|
||||||
<formly-form model="model" fields="formFields">
|
<formly-form model="model" fields="formFields">
|
||||||
<button type="submit" ng-disabled="motionForm.$invalid" class="btn btn-primary" translate>
|
<button type="submit" ng-disabled="motionForm.$invalid" class="btn btn-primary" translate>
|
||||||
Submit
|
Save
|
||||||
</button>
|
</button>
|
||||||
<button ng-click="closeThisDialog()" class="btn btn-default" translate>
|
<button ng-click="closeThisDialog()" class="btn btn-default" translate>
|
||||||
Cancel
|
Cancel
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div class="submenu">
|
<div class="submenu">
|
||||||
<a ng-click="newDialog()" os-perms="motions.can_create" class="btn btn-primary btn-sm">
|
<a ng-click="openDialog()" os-perms="motions.can_create" class="btn btn-primary btn-sm">
|
||||||
<i class="fa fa-plus fa-lg"></i>
|
<i class="fa fa-plus fa-lg"></i>
|
||||||
<translate>New</translate>
|
<translate>New</translate>
|
||||||
</a>
|
</a>
|
||||||
@ -131,17 +131,20 @@
|
|||||||
<td ng-if="!motion.quickEdit">{{ motion.identifier }}
|
<td ng-if="!motion.quickEdit">{{ motion.identifier }}
|
||||||
<td ng-if="!motion.quickEdit" ng-mouseover="motion.hover=true" ng-mouseleave="motion.hover=false">
|
<td ng-if="!motion.quickEdit" ng-mouseover="motion.hover=true" ng-mouseleave="motion.hover=false">
|
||||||
<strong><a ui-sref="motions.motion.detail({id: motion.id})">{{ motion.getTitle() }}</a></strong>
|
<strong><a ui-sref="motions.motion.detail({id: motion.id})">{{ motion.getTitle() }}</a></strong>
|
||||||
|
<span ng-repeat="tag in motion.tags" class="label label-default">
|
||||||
|
{{ tag.name }}{{$last ? '' : ', '}}
|
||||||
|
</span>
|
||||||
<div ng-if="motion.isAllowed('update')" class="hoverActions" ng-class="{'hiddenDiv': !motion.hover}">
|
<div ng-if="motion.isAllowed('update')" class="hoverActions" ng-class="{'hiddenDiv': !motion.hover}">
|
||||||
<span ng-if="motion.isAllowed('update')">
|
<span ng-if="motion.isAllowed('update')">
|
||||||
<a href="" ng-click="editDialog(motion)" translate>Edit</a>
|
<a href="" ng-click="openDialog(motion)" translate>Edit</a>
|
||||||
</span>
|
</span>
|
||||||
<span ng-if="motion.isAllowed('quickedit')">
|
<span ng-if="motion.isAllowed('quickedit')">
|
||||||
| <a href="" ng-click="motion.quickEdit=true" translate>QuickEdit</a> |
|
| <a href="" ng-click="motion.quickEdit=true" translate>QuickEdit</a> |
|
||||||
</span>
|
</span>
|
||||||
<span ng-if="motion.isAllowed('delete')">
|
<span ng-if="motion.isAllowed('delete')">
|
||||||
<!-- TODO: translate confirm message -->
|
|
||||||
<a href="" class="text-danger"
|
<a href="" class="text-danger"
|
||||||
ng-bootbox-confirm="Are you sure you want to delete <b>{{ motion.getTitle() }}</b>?"
|
ng-bootbox-confirm="{{ 'Are you sure you want to delete this entry?' | translate }}<br>
|
||||||
|
<b>{{ motion.getTitle() }}</b>"
|
||||||
ng-bootbox-confirm-action="delete(motion)" translate>Delete</a>
|
ng-bootbox-confirm-action="delete(motion)" translate>Delete</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
<div ng-controller="SlideMotionCtrl" class="content scrollcontent">
|
<div ng-controller="SlideMotionCtrl" class="content scrollcontent">
|
||||||
<h1>{{ motion.getTitle() }}</h1>
|
<h1>{{ motion.getTitle() }}</h1>
|
||||||
<div class="white-space-pre-line">{{ motion.getText() }}</div>
|
<div ng-bind-html="motion.getText()"></div>
|
||||||
|
|
||||||
|
<h2 ng-if="motion.getReason()" translate>Reason</h2>
|
||||||
|
<div ng-bind-html="motion.getReason()"></div>
|
||||||
|
|
||||||
|
<h2 ng-if="motion.submitters" translate>Submitters</h2>
|
||||||
|
<div ng-repeat="submitter in motion.submitters">
|
||||||
|
{{ submitter.get_full_name() }}<br>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -53,16 +53,6 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('users.user.detail.update', {
|
|
||||||
views: {
|
|
||||||
'@users.user': {}
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
groups: function(Group) {
|
|
||||||
return Group.findAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.state('users.user.detail.profile', {
|
.state('users.user.detail.profile', {
|
||||||
views: {
|
views: {
|
||||||
'@users.user': {},
|
'@users.user': {},
|
||||||
@ -275,13 +265,30 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
// Provide generic user form fields for create and update view
|
// Service for generic assignment form (create and update)
|
||||||
.factory('UserFormFieldFactory', [
|
.factory('UserForm', [
|
||||||
'$http',
|
'$http',
|
||||||
'gettextCatalog',
|
'gettextCatalog',
|
||||||
'Group',
|
'Group',
|
||||||
function ($http, gettextCatalog, Group) {
|
function ($http, gettextCatalog, Group) {
|
||||||
return {
|
return {
|
||||||
|
// ngDialog for user form
|
||||||
|
getDialog: function (user) {
|
||||||
|
if (user) {
|
||||||
|
var resolve = {
|
||||||
|
user: function(User) {return User.find(user.id);}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
template: 'static/templates/users/user-form.html',
|
||||||
|
controller: (user) ? 'UserUpdateCtrl' : 'UserCreateCtrl',
|
||||||
|
className: 'ngdialog-theme-default wide-form',
|
||||||
|
closeByEscape: false,
|
||||||
|
closeByDocument: false,
|
||||||
|
resolve: (resolve) ? resolve : null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// angular-formly fields for user form
|
||||||
getFormFields: function () {
|
getFormFields: function () {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@ -336,7 +343,9 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
label: gettextCatalog.getString('Default password'),
|
label: gettextCatalog.getString('Default password'),
|
||||||
addonRight: { text: 'Reset', class: 'fa fa-undo', onClick:
|
addonRight: { text: 'Reset', class: 'fa fa-undo', onClick:
|
||||||
function (options, scope) {
|
function (options, scope) {
|
||||||
$http.post('/rest/users/user/' + scope.model.id + '/reset_password/', {})
|
$http.post(
|
||||||
|
'/rest/users/user/' + scope.model.id + '/reset_password/',
|
||||||
|
{'password': scope.model.default_password})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -385,9 +394,10 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
'$scope',
|
'$scope',
|
||||||
'$state',
|
'$state',
|
||||||
'ngDialog',
|
'ngDialog',
|
||||||
|
'UserForm',
|
||||||
'User',
|
'User',
|
||||||
'Group',
|
'Group',
|
||||||
function($scope, $state, ngDialog, User, Group) {
|
function($scope, $state, ngDialog, UserForm, User, Group) {
|
||||||
User.bindAll({}, $scope, 'users');
|
User.bindAll({}, $scope, 'users');
|
||||||
Group.bindAll({}, $scope, 'groups');
|
Group.bindAll({}, $scope, 'groups');
|
||||||
$scope.alert = {};
|
$scope.alert = {};
|
||||||
@ -404,26 +414,9 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
$scope.sortColumn = column;
|
$scope.sortColumn = column;
|
||||||
};
|
};
|
||||||
|
|
||||||
// open new dialog
|
// open new/edit dialog
|
||||||
$scope.newDialog = function () {
|
$scope.openDialog = function (user) {
|
||||||
ngDialog.open({
|
ngDialog.open(UserForm.getDialog(user));
|
||||||
template: 'static/templates/users/user-form.html',
|
|
||||||
controller: 'UserCreateCtrl',
|
|
||||||
className: 'ngdialog-theme-default wide-form'
|
|
||||||
});
|
|
||||||
};
|
|
||||||
// open edit dialog
|
|
||||||
$scope.editDialog = function (user) {
|
|
||||||
ngDialog.open({
|
|
||||||
template: 'static/templates/users/user-form.html',
|
|
||||||
controller: 'UserUpdateCtrl',
|
|
||||||
className: 'ngdialog-theme-default wide-form',
|
|
||||||
resolve: {
|
|
||||||
user: function(User) {
|
|
||||||
return User.find(user.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
// save changed user
|
// save changed user
|
||||||
$scope.save = function (user) {
|
$scope.save = function (user) {
|
||||||
@ -475,12 +468,19 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
|
|
||||||
.controller('UserDetailCtrl', [
|
.controller('UserDetailCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
|
'ngDialog',
|
||||||
|
'UserForm',
|
||||||
'User',
|
'User',
|
||||||
'user',
|
'user',
|
||||||
'Group',
|
'Group',
|
||||||
function($scope, User, user, Group) {
|
function($scope, ngDialog, UserForm, User, user, Group) {
|
||||||
User.bindOne(user.id, $scope, 'user');
|
User.bindOne(user.id, $scope, 'user');
|
||||||
Group.bindAll({}, $scope, 'groups');
|
Group.bindAll({}, $scope, 'groups');
|
||||||
|
|
||||||
|
// open edit dialog
|
||||||
|
$scope.openDialog = function (user) {
|
||||||
|
ngDialog.open(UserForm.getDialog(user));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
@ -488,12 +488,12 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
'$scope',
|
'$scope',
|
||||||
'$state',
|
'$state',
|
||||||
'User',
|
'User',
|
||||||
'UserFormFieldFactory',
|
'UserForm',
|
||||||
'Group',
|
'Group',
|
||||||
function($scope, $state, User, UserFormFieldFactory, Group) {
|
function($scope, $state, User, UserForm, Group) {
|
||||||
Group.bindAll({where: {id: {'>': 2}}}, $scope, 'groups');
|
Group.bindAll({where: {id: {'>': 2}}}, $scope, 'groups');
|
||||||
// get all form fields
|
// get all form fields
|
||||||
$scope.formFields = UserFormFieldFactory.getFormFields();
|
$scope.formFields = UserForm.getFormFields();
|
||||||
|
|
||||||
// save user
|
// save user
|
||||||
$scope.save = function (user) {
|
$scope.save = function (user) {
|
||||||
@ -514,15 +514,15 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
|
|||||||
'$state',
|
'$state',
|
||||||
'$http',
|
'$http',
|
||||||
'User',
|
'User',
|
||||||
'UserFormFieldFactory',
|
'UserForm',
|
||||||
'Group',
|
'Group',
|
||||||
'user',
|
'user',
|
||||||
function($scope, $state, $http, User, UserFormFieldFactory, Group, user) {
|
function($scope, $state, $http, User, UserForm, Group, user) {
|
||||||
Group.bindAll({where: {id: {'>': 2}}}, $scope, 'groups');
|
Group.bindAll({where: {id: {'>': 2}}}, $scope, 'groups');
|
||||||
// set initial values for form model
|
// set initial values for form model
|
||||||
$scope.model = user;
|
$scope.model = user;
|
||||||
// get all form fields
|
// get all form fields
|
||||||
$scope.formFields = UserFormFieldFactory.getFormFields();
|
$scope.formFields = UserForm.getFormFields();
|
||||||
|
|
||||||
// save user
|
// save user
|
||||||
$scope.save = function (user) {
|
$scope.save = function (user) {
|
||||||
|
@ -52,7 +52,8 @@
|
|||||||
</a>
|
</a>
|
||||||
<!-- delete -->
|
<!-- delete -->
|
||||||
<a os-perms="users.can_manage" class="btn btn-danger btn-sm"
|
<a os-perms="users.can_manage" class="btn btn-danger btn-sm"
|
||||||
ng-bootbox-confirm="Are you sure you want to delete <b>{{ group.name }}</b>?"
|
ng-bootbox-confirm="{{ 'Are you sure you want to delete this entry?' | translate }}<br>
|
||||||
|
<b>{{ group.name }}</b>"
|
||||||
ng-bootbox-confirm-action="delete(group)"
|
ng-bootbox-confirm-action="delete(group)"
|
||||||
title="{{ 'Delete' | translate }}">
|
title="{{ 'Delete' | translate }}">
|
||||||
<i class="fa fa-trash-o"></i>
|
<i class="fa fa-trash-o"></i>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<i class="fa fa-video-camera"></i>
|
<i class="fa fa-video-camera"></i>
|
||||||
</a>
|
</a>
|
||||||
<!-- edit -->
|
<!-- edit -->
|
||||||
<a ui-sref="users.user.detail.update({id: user.id })" os-perms="users.can_manage"
|
<a os-perms="users.can_manage" ng-click="openDialog(user)"
|
||||||
class="btn btn-default btn-sm"
|
class="btn btn-default btn-sm"
|
||||||
title="{{ 'Edit' | translate}}">
|
title="{{ 'Edit' | translate}}">
|
||||||
<i class="fa fa-pencil"></i>
|
<i class="fa fa-pencil"></i>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<form name="userForm" ng-submit="save(model)">
|
<form name="userForm" ng-submit="save(model)">
|
||||||
<formly-form model="model" fields="formFields">
|
<formly-form model="model" fields="formFields">
|
||||||
<button type="submit" ng-disabled="userForm.$invalid" class="btn btn-primary" translate>
|
<button type="submit" ng-disabled="userForm.$invalid" class="btn btn-primary" translate>
|
||||||
Submit
|
Save
|
||||||
</button>
|
</button>
|
||||||
<button ng-click="closeThisDialog()" class="btn btn-default" translate>
|
<button ng-click="closeThisDialog()" class="btn btn-default" translate>
|
||||||
Cancel
|
Cancel
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div class="submenu">
|
<div class="submenu">
|
||||||
<a ng-click="newDialog()" os-perms="users.can_manage" class="btn btn-primary btn-sm">
|
<a ng-click="openDialog()" os-perms="users.can_manage" class="btn btn-primary btn-sm">
|
||||||
<i class="fa fa-user-plus fa-lg"></i>
|
<i class="fa fa-user-plus fa-lg"></i>
|
||||||
<translate>New</translate>
|
<translate>New</translate>
|
||||||
</a>
|
</a>
|
||||||
@ -137,10 +137,10 @@
|
|||||||
<small><i class="fa fa-info-circle"></i> {{ user.comment }}</small>
|
<small><i class="fa fa-info-circle"></i> {{ user.comment }}</small>
|
||||||
</div>
|
</div>
|
||||||
<div os-perms="users.can_manage" class="hoverActions" ng-class="{'hiddenDiv': !user.hover}">
|
<div os-perms="users.can_manage" class="hoverActions" ng-class="{'hiddenDiv': !user.hover}">
|
||||||
<a href="" ng-click="editDialog(user)" translate>Edit</a> |
|
<a href="" ng-click="openDialog(user)" translate>Edit</a> |
|
||||||
<!-- TODO: translate confirm message -->
|
|
||||||
<a href="" class="text-danger"
|
<a href="" class="text-danger"
|
||||||
ng-bootbox-confirm="Are you sure you want to delete <b>{{ user.get_short_name() }}</b>?"
|
ng-bootbox-confirm="{{ 'Are you sure you want to delete this entry?' | translate }}<br>
|
||||||
|
<b>{{ user.get_short_name() }}</b>"
|
||||||
ng-bootbox-confirm-action="delete(user)" translate>Delete</a>
|
ng-bootbox-confirm-action="delete(user)" translate>Delete</a>
|
||||||
</div>
|
</div>
|
||||||
<td class="optional">{{ user.structure_level }}
|
<td class="optional">{{ user.structure_level }}
|
||||||
|
@ -153,9 +153,11 @@ class UserViewSet(ModelViewSet):
|
|||||||
@detail_route(methods=['post'])
|
@detail_route(methods=['post'])
|
||||||
def reset_password(self, request, pk=None):
|
def reset_password(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
View to reset the password (using the default password).
|
View to reset the password using the requested password.
|
||||||
"""
|
"""
|
||||||
user = self.get_object()
|
user = self.get_object()
|
||||||
|
if request.data.get('password'):
|
||||||
|
user.default_password = request.data['password']
|
||||||
user.set_password(user.default_password)
|
user.set_password(user.default_password)
|
||||||
user.save()
|
user.save()
|
||||||
return Response({'detail': _('Password successfully reset.')})
|
return Response({'detail': _('Password successfully reset.')})
|
||||||
|
@ -165,9 +165,24 @@ class UserResetPassword(TestCase):
|
|||||||
user = User.objects.create(username='Test name ooMoa4ou4mohn2eo1ree')
|
user = User.objects.create(username='Test name ooMoa4ou4mohn2eo1ree')
|
||||||
user.default_password = 'new_password_Yuuh8OoQueePahngohy3'
|
user.default_password = 'new_password_Yuuh8OoQueePahngohy3'
|
||||||
user.save()
|
user.save()
|
||||||
response = admin_client.post(reverse('user-reset-password', args=[user.pk]))
|
response = admin_client.post(
|
||||||
|
reverse('user-reset-password', args=[user.pk]),
|
||||||
|
{'password': 'new_password_Yuuh8OoQueePahngohy3_new'})
|
||||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||||
self.assertTrue(User.objects.get(pk=user.pk).check_password('new_password_Yuuh8OoQueePahngohy3'))
|
self.assertTrue(User.objects.get(pk=user.pk).check_password(
|
||||||
|
'new_password_Yuuh8OoQueePahngohy3_new'))
|
||||||
|
|
||||||
|
def test_reset_to_default(self):
|
||||||
|
admin_client = APIClient()
|
||||||
|
admin_client.login(username='admin', password='admin')
|
||||||
|
user = User.objects.create(username='Test name ooMoa4ou4mohn2eo1ree')
|
||||||
|
user.default_password = 'new_password_Yuuh8OoQueePahngohy3'
|
||||||
|
user.save()
|
||||||
|
response = admin_client.post(
|
||||||
|
reverse('user-reset-password', args=[user.pk]), {})
|
||||||
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||||
|
self.assertTrue(User.objects.get(pk=user.pk).check_password(
|
||||||
|
'new_password_Yuuh8OoQueePahngohy3'))
|
||||||
|
|
||||||
|
|
||||||
class GroupReceive(TestCase):
|
class GroupReceive(TestCase):
|
||||||
|
Loading…
Reference in New Issue
Block a user