diff --git a/app/assets/javascripts/directives/views/conflictResolutionModal.js b/app/assets/javascripts/directives/views/conflictResolutionModal.js deleted file mode 100644 index a5f2859ef..000000000 --- a/app/assets/javascripts/directives/views/conflictResolutionModal.js +++ /dev/null @@ -1,85 +0,0 @@ -import template from '%/directives/conflict-resolution-modal.pug'; - -class ConflictResolutionCtrl { - /* @ngInject */ - constructor($element) { - this.$element = $element; - } - - $onInit() { - this.contentType = this.item1.content_type; - this.item1Content = this.createContentString(this.item1); - this.item2Content = this.createContentString(this.item2); - }; - - createContentString(item) { - const data = Object.assign({ - created_at: item.created_at, - updated_at: item.updated_at - }, item.content); - return JSON.stringify(data, null, 2); - } - - keepItem1() { - this.application.alertService.confirm({ - text: `Are you sure you want to delete the item on the right?`, - destructive: true, - onConfirm: () => { - this.application.deleteItem({item: this.item2}); - this.triggerCallback(); - this.dismiss(); - } - }); - } - - keepItem2() { - this.application.alertService.confirm({ - text: `Are you sure you want to delete the item on the left?`, - destructive: true, - onConfirm: () => { - this.application.deleteItem({item: this.item1}); - this.triggerCallback(); - this.dismiss(); - } - }); - } - - keepBoth() { - this.triggerCallback(); - this.dismiss(); - } - - export() { - this.application.getArchiveService().downloadBackupOfItems( - [this.item1, this.item2], - true - ); - } - - triggerCallback() { - this.callback && this.callback(); - } - - dismiss() { - const elem = this.$element; - const scope = elem.scope(); - scope.$destroy(); - elem.remove(); - } -} - -export class ConflictResolutionModal { - constructor() { - this.restrict = 'E'; - this.template = template; - this.controller = ConflictResolutionCtrl; - this.controllerAs = 'ctrl'; - this.bindToController = true; - this.scope = { - item1: '=', - item2: '=', - callback: '=', - application: '=' - }; - } -} diff --git a/app/assets/stylesheets/_modals.scss b/app/assets/stylesheets/_modals.scss index cc3d50476..90691c4f9 100644 --- a/app/assets/stylesheets/_modals.scss +++ b/app/assets/stylesheets/_modals.scss @@ -58,26 +58,6 @@ } } -#conflict-resolution-modal { - #items { - display: flex; - height: 100%; - } - - .item { - width: 50%; - height: 100%; - flex-grow: 1; - } - - .border { - height: 100%; - background-color: var(--sn-stylekit-border-color); - width: 1px; - margin: 0 15px; - } -} - .header .subtitle { font-size: 1.1rem; } diff --git a/app/assets/templates/directives/conflict-resolution-modal.pug b/app/assets/templates/directives/conflict-resolution-modal.pug deleted file mode 100644 index 9a4d4fdf5..000000000 --- a/app/assets/templates/directives/conflict-resolution-modal.pug +++ /dev/null @@ -1,31 +0,0 @@ -.sn-component - #conflict-resolution-modal.sk-modal.large - .sk-modal-background - .sk-modal-content - .sk-panel - .sk-panel-header - h1.sk-panel-header-title Conflicted items — choose which version to keep - .sk-horizontal-group - a.sk-a.info.close-button(ng-click="ctrl.keepItem1()") Keep left - a.sk-a.info.close-button(ng-click="ctrl.keepItem2()") Keep right - a.sk-a.info.close-button(ng-click="ctrl.keepBoth()") Keep both - a.sk-a.info.close-button(ng-click="ctrl.export()") Export - a.sk-a.info.close-button( - ng-click="ctrl.dismiss(); $event.stopPropagation()" - ) Close - .sk-panel-content.selectable - .sk-panel-section - h3 - strong Content type: - | {{ctrl.contentType}} - p - | You may wish to look at the "created_at" and "updated_at" fields - | of the items to gain better context in deciding which to keep. - #items - #item1.sk-panel.static.item - p.normal(style="white-space: pre-wrap; font-size: 16px;") - | {{ctrl.item1Content}} - .border - #item2.sk-panel.static.item - p.normal(style="white-space: pre-wrap; font-size: 16px;") - | {{ctrl.item2Content}}