Editing change recommendations
This commit is contained in:
parent
14d00cc404
commit
fd82ae348e
@ -605,9 +605,12 @@ img {
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
.diff-box .action-row .btn-delete {
|
.diff-box .action-row .btn-delete {
|
||||||
margin-left: 10px;
|
margin-left: 5px;
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
.diff-box .action-row .btn-edit {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
.diff-box .status-row {
|
.diff-box .status-row {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
color: gray;
|
color: gray;
|
||||||
|
@ -304,6 +304,10 @@ angular.module('OpenSlidesApp.motions.motionservices', ['OpenSlidesApp.motions',
|
|||||||
version = _version;
|
version = _version;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
obj.editDialog = function(change_recommendation) {
|
||||||
|
ngDialog.open(ChangeRecommendationForm.getEditDialog(change_recommendation));
|
||||||
|
};
|
||||||
|
|
||||||
obj.init = function (_scope, _motion) {
|
obj.init = function (_scope, _motion) {
|
||||||
$scope = _scope;
|
$scope = _scope;
|
||||||
motion = _motion;
|
motion = _motion;
|
||||||
|
@ -311,6 +311,20 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
getEditDialog: function(change) {
|
||||||
|
return {
|
||||||
|
template: 'static/templates/motions/change-recommendation-form.html',
|
||||||
|
controller: 'ChangeRecommendationUpdateCtrl',
|
||||||
|
className: 'ngdialog-theme-default wide-form',
|
||||||
|
closeByEscape: false,
|
||||||
|
closeByDocument: false,
|
||||||
|
resolve: {
|
||||||
|
change: function() {
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
// angular-formly fields for motion form
|
// angular-formly fields for motion form
|
||||||
getFormFields: function (line_from, line_to) {
|
getFormFields: function (line_from, line_to) {
|
||||||
return [
|
return [
|
||||||
@ -1231,6 +1245,39 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
.controller('ChangeRecommendationUpdateCtrl', [
|
||||||
|
'$scope',
|
||||||
|
'MotionChangeRecommendation',
|
||||||
|
'ChangeRecommendationForm',
|
||||||
|
'change',
|
||||||
|
function ($scope, MotionChangeRecommendation, ChangeRecommendationForm, change) {
|
||||||
|
$scope.alert = {};
|
||||||
|
$scope.model = angular.copy(change);
|
||||||
|
|
||||||
|
// get all form fields
|
||||||
|
$scope.formFields = ChangeRecommendationForm.getFormFields(change.line_from, change.line_to);
|
||||||
|
// save motion
|
||||||
|
$scope.save = function (change) {
|
||||||
|
// inject the changed change recommendation (copy) object back into DS store
|
||||||
|
MotionChangeRecommendation.inject(change);
|
||||||
|
// save changed change recommendation object on server
|
||||||
|
MotionChangeRecommendation.save(change, { method: 'PATCH' }).then(
|
||||||
|
function(success) {
|
||||||
|
$scope.closeThisDialog();
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
MotionChangeRecommendation.refresh(change);
|
||||||
|
var message = '';
|
||||||
|
for (var e in error.data) {
|
||||||
|
message += e + ': ' + error.data[e] + ' ';
|
||||||
|
}
|
||||||
|
$scope.alert = {type: 'danger', msg: message, show: true};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
.controller('ChangeRecommendationCreateCtrl', [
|
.controller('ChangeRecommendationCreateCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'Motion',
|
'Motion',
|
||||||
|
@ -30,6 +30,11 @@
|
|||||||
title="{{ 'Delete' | translate }}">
|
title="{{ 'Delete' | translate }}">
|
||||||
<i class="fa fa-trash"></i>
|
<i class="fa fa-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button class="btn btn-default btn-sm pull-right btn-edit" ng-click="createChangeRecommendation.editDialog(change)"
|
||||||
|
title="{{ 'Edit' | translate }}">
|
||||||
|
<i class="fa fa-pencil"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="status-row" ng-if="!motion.isAllowed('can_manage') && change.rejected">
|
<div class="status-row" ng-if="!motion.isAllowed('can_manage') && change.rejected">
|
||||||
<translate>Rejected</translate>
|
<translate>Rejected</translate>
|
||||||
|
Loading…
Reference in New Issue
Block a user