diff --git a/Resources/public/css/views/actions/translate.css b/Resources/public/css/views/actions/translate.css index acb2ff821..bf9ee2b7f 100644 --- a/Resources/public/css/views/actions/translate.css +++ b/Resources/public/css/views/actions/translate.css @@ -67,8 +67,12 @@ top: 0.9em; } -.ez-view-translateactionview .ez-contenttranslation-edit-link, -.ez-view-translateactionview .ez-contenttranslation-delete-link { +.ez-view-translateactionview .ez-contenttranslation:hover .ez-contenttranslation-actions { + display: block; +} + +.ez-view-translateactionview .ez-contenttranslation-actions .ez-contenttranslation-edit-link, +.ez-view-translateactionview .ez-contenttranslation-actions .ez-contenttranslation-delete-link { display: inline-block; padding: 0.1em 0.5em; } diff --git a/Resources/public/js/alloyeditor/buttons/linkedit.js b/Resources/public/js/alloyeditor/buttons/linkedit.js index 99901258c..f3b789d01 100644 --- a/Resources/public/js/alloyeditor/buttons/linkedit.js +++ b/Resources/public/js/alloyeditor/buttons/linkedit.js @@ -312,8 +312,7 @@ YUI.add('ez-alloyeditor-button-linkedit', function (Y) { var editor = this.props.editor.get('nativeEditor'), linkUtils = new CKEDITOR.Link(editor), selection = editor.getSelection(), - bookmarks = selection.createBookmarks(), - scrollY; + bookmarks = selection.createBookmarks(); linkUtils.remove(this.state.element, {advance: true}); @@ -321,14 +320,7 @@ YUI.add('ez-alloyeditor-button-linkedit', function (Y) { this.props.cancelExclusive(); - if (navigator.userAgent.indexOf('Chrome') > -1) { - // Workaround for https://jira.ez.no/browse/EZP-28565 - scrollY = window.pageYOffset; - editor.fire('actionPerformed', this); - window.scroll(window.pageXOffset, scrollY); - } else { - editor.fire('actionPerformed', this); - } + editor.fire('actionPerformed', this); }, /** @@ -361,21 +353,13 @@ YUI.add('ez-alloyeditor-button-linkedit', function (Y) { title: this.state.linkTitle, "data-ez-temporary-link": this.state.isTemporary ? true : null, }, - modifySelection = {advance: true}, - scrollY; + modifySelection = {advance: true}; if (this.state.linkHref) { linkAttrs.href = this.state.linkHref; linkUtils.update(linkAttrs, this.state.element, modifySelection); - if (navigator.userAgent.indexOf('Chrome') > -1) { - // Workaround for https://jira.ez.no/browse/EZP-28565 - scrollY = window.pageYOffset; - editor.fire('actionPerformed', this); - window.scroll(window.pageXOffset, scrollY); - } else { - editor.fire('actionPerformed', this); - } + editor.fire('actionPerformed', this); } // We need to cancelExclusive with the bound parameters in case the diff --git a/Resources/public/js/models/ez-contentmodel.js b/Resources/public/js/models/ez-contentmodel.js index e88c81ff2..c24a5fdfb 100644 --- a/Resources/public/js/models/ez-contentmodel.js +++ b/Resources/public/js/models/ez-contentmodel.js @@ -481,6 +481,7 @@ YUI.add('ez-contentmodel', function (Y) { if ( !this.get('id') ) { return callback(false); } + contentService.removeTranslation(this.get('id'), languageCode, callback); }, }, { diff --git a/Resources/public/js/views/actions/ez-translateactionview.js b/Resources/public/js/views/actions/ez-translateactionview.js index b8ac21a72..8dce8f47d 100644 --- a/Resources/public/js/views/actions/ez-translateactionview.js +++ b/Resources/public/js/views/actions/ez-translateactionview.js @@ -15,7 +15,6 @@ YUI.add('ez-translateactionview', function (Y) { '.ez-newtranslation-button': { 'tap': '_newTranslationLanguageSelectionBox', }, - '.ez-contenttranslation-delete-link': { 'tap': '_deleteTranslation', }, @@ -166,6 +165,14 @@ YUI.add('ez-translateactionview', function (Y) { }; e.preventDefault(); + + /** + * Fired when the translation is deleted + * + * @event deleteTranslation + * @param {e.translation} Language code of translation + * @param {e.contentId} The content Id + */ this.fire('deleteTranslation', data); }, diff --git a/Resources/public/js/views/services/ez-locationviewviewservice.js b/Resources/public/js/views/services/ez-locationviewviewservice.js index 5cf3ce744..30bc48673 100644 --- a/Resources/public/js/views/services/ez-locationviewviewservice.js +++ b/Resources/public/js/views/services/ez-locationviewviewservice.js @@ -569,7 +569,7 @@ YUI.add('ez-locationviewviewservice', function (Y) { }, /** - * Removes translation form content. + * Removes translation from content. * * @method _deleteTranslation * @protected @@ -581,9 +581,17 @@ YUI.add('ez-locationviewviewservice', function (Y) { api: this.get('capi') }; - content.removeTranslation(options, languageCode, Y.bind(function() { + content.removeTranslation(options, languageCode, Y.bind(function(error) { + if (error) { + this._notify( + Y.eZ.trans('failed.delete.content.translation', { language: languageCode }, 'bar'), + 'content-delete-translation-' + content.get('id'), 'error', 0 + ); + return ; + } + this._notify( - Y.eZ.trans('success.delete.content.translation', {}, 'bar'), + Y.eZ.trans('success.delete.content.translation', { language: languageCode }, 'bar'), 'content-delete-translation-' + content.get('id'), 'done', 5 ); @@ -595,7 +603,7 @@ YUI.add('ez-locationviewviewservice', function (Y) { }, /** - * `deleteTranslationAction` event handler, + * `deleteTranslation` event handler, * it asks confirmation to the user before delete the translation item. * * @method _confirmDeleteTranslation @@ -613,6 +621,12 @@ YUI.add('ez-locationviewviewservice', function (Y) { 'content-delete-translation-' + content.get('id'), 'error', 0 ); } else { + /** + * Opens confirmation modal of deleting translation + * + * @event deleteTranslation + * @param {e.config} Modal configuration + */ this.fire('confirmBoxOpen', { config: { title: Y.eZ.trans('confirm.delete.translation', { language: languageCode }, 'bar'), diff --git a/Resources/translations/bar.en.xlf b/Resources/translations/bar.en.xlf index e11f2307e..2b47b976a 100644 --- a/Resources/translations/bar.en.xlf +++ b/Resources/translations/bar.en.xlf @@ -228,17 +228,23 @@ Resources/public/templates/translateaction.hbt - Are you sure you want to delete %language% translation ? - Are you sure you want to delete %language% translation ? + Are you sure you want to delete "%language%" translation? + Are you sure you want to delete "%language%" translation? key: confirm.delete.translation Resources/public/js/views/services/ez-locationviewviewservice.js - Translation %language% has been deleted. - Translation %language% has been deleted. + Translation "%language%" has been deleted. + Translation "%language%" has been deleted. key: success.delete.content.translation Resources/public/js/views/services/ez-locationviewviewservice.js + + Cannot delete translation "%language%" from content. + Cannot delete translation "%language%" from content. + key: failed.delete.content.translation + Resources/public/js/views/services/ez-locationviewviewservice.js + Cannot delete main translation from content. Cannot delete main translation from content.