Migrate history modal to components
This commit is contained in:
parent
33fd84c990
commit
6387acc649
|
@ -1,17 +1,10 @@
|
|||
import ModalBodyView from "discourse/views/modal-body";
|
||||
import ClickTrack from 'discourse/lib/click-track';
|
||||
import { selectedText } from 'discourse/lib/utilities';
|
||||
|
||||
export default ModalBodyView.extend({
|
||||
templateName: 'modal/history',
|
||||
title: I18n.t('history'),
|
||||
export default Ember.Component.extend({
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
|
||||
resizeModal: function(){
|
||||
const viewPortHeight = $(window).height();
|
||||
this.$(".modal-body").css("max-height", Math.floor(0.8 * viewPortHeight) + "px");
|
||||
}.on("didInsertElement"),
|
||||
|
||||
_inserted: function() {
|
||||
this.$().on('mouseup.discourse-redirect', '#revisions a', function(e) {
|
||||
// bypass if we are selecting stuff
|
||||
const selection = window.getSelection && window.getSelection();
|
||||
|
@ -26,11 +19,10 @@ export default ModalBodyView.extend({
|
|||
|
||||
return ClickTrack.trackClick(e);
|
||||
});
|
||||
},
|
||||
|
||||
}.on('didInsertElement'),
|
||||
|
||||
// This view is being removed. Shut down operations
|
||||
_destroyed: function() {
|
||||
willDestroyElement() {
|
||||
this._super();
|
||||
this.$().off('mouseup.discourse-redirect', '#revisions a');
|
||||
}.on('willDestroyElement')
|
||||
}
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
<div class="modal-body">
|
||||
{{#d-modal-body title="history" maxHeight="80%"}}
|
||||
<div>
|
||||
<div id="revision-controls">
|
||||
{{d-button action="loadFirstVersion" icon="fast-backward" title="post.revisions.controls.first" disabled=loadFirstDisabled}}
|
||||
|
@ -89,9 +89,9 @@
|
|||
|
||||
{{plugin-outlet "post-revisions"}}
|
||||
|
||||
<div class="row">
|
||||
{{#links-redirect class="row"}}
|
||||
{{{bodyDiff}}}
|
||||
</div>
|
||||
{{/links-redirect}}
|
||||
|
||||
{{#if displayRevert}}
|
||||
{{d-button action="revertToVersion" icon="undo" label="post.revisions.controls.revert" class="btn-danger" disabled=loading}}
|
||||
|
@ -103,4 +103,4 @@
|
|||
{{d-button action="showVersion" icon="eye" label="post.revisions.controls.show" disabled=loading}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/d-modal-body}}
|
||||
|
|
Loading…
Reference in New Issue