Skip to content

Commit

Permalink
EZP-28966: Disable deleting main translation button (ezsystems#960)
Browse files Browse the repository at this point in the history
* EZP-28966 Disable deleting main translation button

* fixup

* fixup

* fixup
  • Loading branch information
konradoboza authored and Łukasz Serwatka committed Mar 30, 2018
1 parent 63e45bd commit 36a4ede
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Resources/config/yui.yml
Expand Up @@ -1238,6 +1238,7 @@ system:
- 'translateactionview-ez-template'
- 'ez-translator'
- 'event-outside'
- 'ez-notequalhelper'
path: "%ez_platformui.public_dir%/js/views/actions/ez-translateactionview.js"
translateactionview-ez-template:
type: 'template'
Expand Down Expand Up @@ -1309,6 +1310,9 @@ system:
ez-strictcomparisonhelper:
requires: ['handlebars']
path: "%ez_platformui.public_dir%/js/helpers/ez-strictcomparisonhelper.js"
ez-notequalhelper:
requires: ['handlebars']
path: "%ez_platformui.public_dir%/js/helpers/ez-notequalhelper.js"
ez-getflagcodehelper:
requires: ['handlebars']
path: "%ez_platformui.public_dir%/js/helpers/ez-getflagcodehelper.js"
Expand Down
16 changes: 16 additions & 0 deletions Resources/public/js/helpers/ez-notequalhelper.js
@@ -0,0 +1,16 @@
/*
* Copyright (C) eZ Systems AS. All rights reserved.
* For full copyright and license information view LICENSE file distributed with this source code.
*/
YUI.add('ez-notequalhelper', function (Y) {
Y.Handlebars.registerHelper('notEqual', function (left, right, options) {
var result = left !== right;

if (result) {
return options.fn(this);
} else {
return options.inverse(this);
}
});

});
6 changes: 3 additions & 3 deletions Resources/public/templates/translateaction.hbt
Expand Up @@ -26,9 +26,9 @@
<a class="ez-contenttranslation-edit-link" href="{{ path "editContent" id=../content.id languageCode=this }}">
{{translate 'translateaction.edit' 'bar'}}
</a>
{{#if ../canDeleteTranslations}}
<a class="ez-contenttranslation-delete-link ez-font-icon" data-translation="{{.}}" href="{{ path "editContent" id=../content.id languageCode=this }}"></a>
{{/if}}
{{#notEqual ../content.mainLanguageCode this }}
<a class="ez-contenttranslation-delete-link ez-font-icon" data-translation="{{ this }}" href="{{ path "editContent" id=../content.id languageCode=this }}"></a>
{{/notEqual}}
</span>
</li>
{{/each}}
Expand Down

0 comments on commit 36a4ede

Please sign in to comment.