diff --git a/actions/structures.xml b/actions/structures.xml
index ca0cf1e0..29ac397a 100644
--- a/actions/structures.xml
+++ b/actions/structures.xml
@@ -70,7 +70,7 @@
-
+
diff --git a/views/js/controller/tests/action.js b/views/js/controller/tests/action.js
index 24a673dd..2f2469ed 100644
--- a/views/js/controller/tests/action.js
+++ b/views/js/controller/tests/action.js
@@ -18,17 +18,60 @@
*/
define([
'i18n',
- 'layout/actions/binder',
+ 'module',
'uri',
+ 'layout/actions',
+ 'layout/actions/binder',
+ 'layout/section',
+ 'form/translation',
+ 'services/translation',
'ui/feedback',
'core/logger',
- 'taoTests/previewer/factory',
- 'module'
-], function (__, binder, uri, feedback, loggerFactory, previewerFactory, module) {
+ 'taoTests/previewer/factory'
+], function (
+ __,
+ module,
+ uri,
+ actionManager,
+ binder,
+ section,
+ translationFormFactory,
+ translationService,
+ feedback,
+ loggerFactory,
+ previewerFactory
+) {
'use strict';
const logger = loggerFactory('taoTests/controller/action');
+ binder.register('translateTest', function (actionContext) {
+ section.current().updateContentBlock('
');
+ const $container = $('.main-container', section.selected.panel);
+ const { rootClassUri, id: resourceUri } = actionContext;
+ translationFormFactory($container, { rootClassUri, resourceUri, allowDeletion: true })
+ .on('edit', (id, language) => {
+ return actionManager.exec('test-authoring', {
+ id,
+ language,
+ rootClassUri,
+ originResourceUri: resourceUri,
+ translation: true,
+ actionParams: ['originResourceUri', 'language', 'translation']
+ });
+ })
+ .on('delete', function onDelete(id, language) {
+ return translationService.deleteTranslation(resourceUri, language).then(() => {
+ feedback().success(__('Translation deleted'));
+ return this.refresh();
+ });
+ })
+ .on('error', error => {
+ logger.error(error);
+ feedback().error(__('An error occurred while processing your request.'));
+ });
+ });
+
binder.register('testPreview', function testPreview(actionContext) {
const config = module.config();
const previewerConfig = Object.fromEntries(