diff --git a/admin-dev/themes/default/template/controllers/translations/helpers/view/main.tpl b/admin-dev/themes/default/template/controllers/translations/helpers/view/main.tpl index a5a6cc20e..89748e739 100644 --- a/admin-dev/themes/default/template/controllers/translations/helpers/view/main.tpl +++ b/admin-dev/themes/default/template/controllers/translations/helpers/view/main.tpl @@ -33,22 +33,29 @@ document.getElementById('typeTranslationForm').submit(); } - function addThemeSelect(el) + function addThemeSelect() { - var list_type_for_theme = [{foreach $translations_type_for_theme as $type}'{$type}', {/foreach}]; - var type = el.value; + var list_type_for_theme = ['front', 'modules', 'pdf', 'mails']; + var type = $('select[name=type]').val(); $('select[name=theme]').hide(); for (i=0; i < list_type_for_theme.length; i++) if (list_type_for_theme[i] == type) + { $('select[name=theme]').show(); + if (type == 'front') + $('select[name=theme]').children('option[value=""]').attr('disabled', true) + else + $('select[name=theme]').children('option[value=""]').attr('disabled', false) + } else $('select[name=theme]').val('{$theme_default}'); } $(document).ready(function(){ + addThemeSelect(); $('select[name=type]').change(function() { - addThemeSelect(this); + addThemeSelect(); }); }); diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 496c34b0d..4fb9dd5a7 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -52,9 +52,6 @@ class AdminTranslationsControllerCore extends AdminController /** @var array : List of theme by translation type : FRONT, BACK, ERRORS... */ protected $translations_informations = array(); - /** @var array : List of theme by translation type : FRONT, BACK, ERRORS... */ - protected $translations_type_for_theme = array('front', 'modules', 'pdf', 'mails'); - /** @var array : List of all languages */ protected $languages; @@ -199,7 +196,6 @@ class AdminTranslationsControllerCore extends AdminController 'token' => $this->token, 'languages' => $this->languages, 'translations_type' => $this->translations_informations, - 'translations_type_for_theme' => $this->translations_type_for_theme, 'packs_to_install' => $packs_to_install, 'packs_to_update' => $packs_to_update, 'url_submit' => self::$currentIndex.'&token='.$this->token, @@ -1591,7 +1587,10 @@ class AdminTranslationsControllerCore extends AdminController public function initFormFront() { if (!$this->theme_exists(Tools::getValue('theme'))) - throw new PrestaShopException(sprintf(Tools::displayError('Invalid theme "%s"'), Tools::getValue('theme'))); + { + $this->errors[] = sprintf(Tools::displayError('Invalid theme "%s"'), Tools::getValue('theme')); + return; + } $missing_translations_front = array(); $name_var = $this->translations_informations[$this->type_selected]['var'];