-
Notifications
You must be signed in to change notification settings - Fork 47
EZP-27914: As an Editor I want to remove permanently a language from a content item #949
Conversation
if ( !this.get('id') ) { | ||
return callback(false); | ||
} | ||
contentService.removeTranslation(this.get('id'), languageCode, callback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an empty line for readability
@@ -14,7 +14,11 @@ YUI.add('ez-translateactionview', function (Y) { | |||
var events = { | |||
'.ez-newtranslation-button': { | |||
'tap': '_newTranslationLanguageSelectionBox', | |||
} | |||
}, | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed empty line
}; | ||
|
||
e.preventDefault(); | ||
this.fire('deleteTranslation', data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing doc
@@ -567,6 +568,60 @@ YUI.add('ez-locationviewviewservice', function (Y) { | |||
this.set('languageCode', this.get('request').params.languageCode); | |||
}, | |||
|
|||
/** | |||
* Removes translation form content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be ...from content.
}; | ||
|
||
content.removeTranslation(options, languageCode, Y.bind(function() { | ||
this._notify( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any error handling for remove translation or I missed that. This assumes it will be always the success.
}, | ||
|
||
/** | ||
* `deleteTranslationAction` event handler, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleteTranslation
this is the name of the event.
'content-delete-translation-' + content.get('id'), 'error', 0 | ||
); | ||
} else { | ||
this.fire('confirmBoxOpen', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc
|
||
content.removeTranslation(options, languageCode, Y.bind(function() { | ||
this._notify( | ||
Y.eZ.trans('success.delete.content.translation', {}, 'bar'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In translation there is a placeholder for language
I don't see it here.
PR updated according to @dew326 suggestions 😉 |
|
||
linkUtils.remove(this.state.element, {advance: true}); | ||
|
||
selection.selectBookmarks(bookmarks); | ||
|
||
this.props.cancelExclusive(); | ||
|
||
if (navigator.userAgent.indexOf('Chrome') > -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like I've deleted it by accident. Thanks for vigilance
* Fired when the translation is deleted | ||
* | ||
* @event deleteTranslation | ||
* @param {e.translation} Language code of translation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data.translation
Y.eZ.trans('failed.delete.content.translation', { language: languageCode }, 'bar'), | ||
'content-delete-translation-' + content.get('id'), 'error', 0 | ||
); | ||
return ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed space
/** | ||
* Opens confirmation modal of deleting translation | ||
* | ||
* @event deleteTranslation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirmBoxOpen
contentService = capi.getContentService(); | ||
|
||
if ( !this.get('id') ) { | ||
return callback(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be displayed as a success, I'm not sure if we want this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. There is no checking of id in other methods (besides delete
) so I've removed this condition (API should return 404 in this case).
feb1daf
to
197807b
Compare
@adamwojs No rush on this one, but tests are failing here while they are passing on 1.13 now. |
…e from a content item
Got geen light from @SylvainGuittard on this on friday, so adding this to 1.13.1-rc2 for testing. |
Description
Impl. of EZP-27914: As an Editor I want to remove permanently a language from a content item
Note: