RemoveLanguageActionHandler.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. /*
  3. *+------------------------------------------------------------------------+
  4. *| Licensed Materials - Property of IBM
  5. *| IBM Cognos Products: Content Explorer
  6. *| (C) Copyright IBM Corp. 2018
  7. *|
  8. *| US Government Users Restricted Rights - Use, duplication or disclosure
  9. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *+------------------------------------------------------------------------+
  11. */
  12. define(['../../../lib/@waca/core-client/js/core-client/ui/core/Class'], function (BaseClass) {
  13. 'use strict';
  14. var ActionHandler = BaseClass.extend({
  15. /**
  16. * Menu item handler
  17. */
  18. onSelectItem: function onSelectItem(context) {
  19. var info = context.target.activeObject;
  20. info.translationService.removeTranslations(info.selectedLocale);
  21. },
  22. /**
  23. * Determine when we show/hide the menu item
  24. */
  25. isItemVisible: function isItemVisible(options) {
  26. var info = options.target.activeObject;
  27. var defaultLanguage = info.translationService.getDefaultLanguage();
  28. // Can't remove the default
  29. return defaultLanguage !== info.selectedLocale;
  30. }
  31. });
  32. return ActionHandler;
  33. });
  34. //# sourceMappingURL=RemoveLanguageActionHandler.js.map