Skip to content
This repository was archived by the owner on May 3, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Resources/public/js/models/ez-contentmodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,25 @@ YUI.add('ez-contentmodel', function (Y) {
}
contentService.deleteContent(this.get('id'), callback);
},

/**
* Removes translation
*
* @method removeTranslation
* @param {Object} options
* @param {Object} options.api (required) the JS REST client instance
* @param {String} languageCode
* @param {Function} callback
*/
removeTranslation: function (options, languageCode, callback) {
var capi = options.api,
contentService = capi.getContentService();

if ( !this.get('id') ) {
return callback(false);
}
contentService.removeTranslation(this.get('contentId'), languageCode, callback);
},
}, {
REST_STRUCT_ROOT: "Content",
ATTRS_REST_MAP: [
Expand Down
22 changes: 21 additions & 1 deletion Resources/public/js/views/actions/ez-translateactionview.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ YUI.add('ez-translateactionview', function (Y) {
var events = {
'.ez-newtranslation-button': {
'tap': '_newTranslationLanguageSelectionBox',
}
},

'.ez-contenttranslation-delete-link': {
'tap': '_deleteTranslation',
},
};

/**
Expand Down Expand Up @@ -147,6 +151,22 @@ YUI.add('ez-translateactionview', function (Y) {
this._hideView();
},

/**
* Tap event handler on
*
* @method
* @private
* @param {EventFacade} e
*/
_deleteTranslation: function (e) {
var data = {
translation: e.target.getAttribute('data-translation'),
contentId: this.get('content').get('contentId'),
}
e.preventDefault();
this.fire('deleteTranslation', data);
},

/**
* Fires `translate` event after making a selection on LanguageSelectionBox
*
Expand Down
16 changes: 16 additions & 0 deletions Resources/public/js/views/services/ez-locationviewviewservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ YUI.add('ez-locationviewviewservice', function (Y) {
this.on('*:translateContent', this._translateContent);
this.on('*:sortUpdate', this._updateSorting);
this.on('*:updatePriority', this._updatePriority);
this.on('*:deleteTranslation', this._deleteTranslation);
this.after('*:requestChange', this._setLanguageCode);

this._setLanguageCode();
Expand Down Expand Up @@ -505,6 +506,21 @@ YUI.add('ez-locationviewviewservice', function (Y) {
this.set('languageCode', this.get('request').params.languageCode);
},

/**
*
*
* @method _deleteTranslation
* @protected
*/
_deleteTranslation: function (e) {
var loadOptions = {
api: this.get('capi')
};



},

_getViewParameters: function () {
return {
content: this.get('content'),
Expand Down
3 changes: 3 additions & 0 deletions Resources/public/templates/translateaction.hbt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
<a class="ez-contenttranslation-edit-link" href="{{ path "editContent" id=../content.id languageCode=this }}">
{{translate 'translateaction.edit' 'bar'}}
</a>
<a class="ez-contenttranslation-delete-link" data-translation="{{.}}" href="{{ path "editContent" id=../content.id languageCode=this }}">
{{translate 'translateaction.delete' 'bar'}}
</a>
</li>
{{/each}}
</ul>
Expand Down