mirror of
https://github.com/documize/community.git
synced 2025-07-23 15:19:42 +02:00
Revision history will respect doc lifecycle stage
Protected documents cannot be rolled back!
This commit is contained in:
parent
c152d029f2
commit
d499888cfd
2 changed files with 31 additions and 22 deletions
|
@ -11,12 +11,13 @@
|
||||||
|
|
||||||
import { computed, set } from '@ember/object';
|
import { computed, set } from '@ember/object';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import Component from '@ember/component';
|
|
||||||
import ModalMixin from '../../mixins/modal';
|
import ModalMixin from '../../mixins/modal';
|
||||||
|
import Component from '@ember/component';
|
||||||
|
|
||||||
export default Component.extend(ModalMixin, {
|
export default Component.extend(ModalMixin, {
|
||||||
documentService: service('document'),
|
documentService: service('document'),
|
||||||
revision: null,
|
revision: null,
|
||||||
|
revisions: null,
|
||||||
diff: '',
|
diff: '',
|
||||||
hasRevisions: computed('revisions', function() {
|
hasRevisions: computed('revisions', function() {
|
||||||
return this.get('revisions').length > 0;
|
return this.get('revisions').length > 0;
|
||||||
|
@ -24,6 +25,14 @@ export default Component.extend(ModalMixin, {
|
||||||
hasDiff: computed('diff', function() {
|
hasDiff: computed('diff', function() {
|
||||||
return this.get('diff').length > 0;
|
return this.get('diff').length > 0;
|
||||||
}),
|
}),
|
||||||
|
canRollback: computed('permissions.documentEdit', 'document.protection', function() {
|
||||||
|
let constants = this.get('constants');
|
||||||
|
|
||||||
|
if (this.get('document.protection') === constants.ProtectionType.Lock) return false;
|
||||||
|
|
||||||
|
return this.get('permissions.documentEdit') &&
|
||||||
|
this.get('document.protection') === constants.ProtectionType.None;
|
||||||
|
}),
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<div class="mt-5">
|
<div class="mt-5">
|
||||||
{{#if hasRevisions}}
|
{{#unless hasRevisions}}
|
||||||
|
<p>No revisions made</p>
|
||||||
|
{{else}}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -18,7 +20,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if permissions.documentEdit}}
|
{{#if canRollback}}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -26,23 +28,21 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="document-rollback-modal" class="modal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">Restore Document Section</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<p>Are you sure you want to roll back to this revision?</p>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="button" class="btn btn-success" onclick={{action 'onRollback'}}>Restore</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{/unless}}
|
||||||
<p>No revisions made</p>
|
</div>
|
||||||
{{/if}}
|
|
||||||
|
<div id="document-rollback-modal" class="modal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">Restore Section</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>Are you sure you want to restore this revision?</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="button" class="btn btn-success" onclick={{action 'onRollback'}}>Restore</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
Loading…
Add table
Add a link
Reference in a new issue