// Remove "core" for the themes translations in the translation tool

This commit is contained in:
Damien Metzger committed 2013-04-23 12:37:09 +02:00
1 parent ceddfdd8e6
commit 4be1bef203
2 files changed
+15 -9

No files matched your search

@@ -33,22 +33,29 @@
document.getElementById('typeTranslationForm').submit(); document.getElementById('typeTranslationForm').submit();
} }
function addThemeSelect(el) function addThemeSelect()
{ {
var list_type_for_theme = [{foreach $translations_type_for_theme as $type}'{$type}', {/foreach}]; var list_type_for_theme = ['front', 'modules', 'pdf', 'mails'];
var type = el.value; var type = $('select[name=type]').val();
$('select[name=theme]').hide(); $('select[name=theme]').hide();
for (i=0; i < list_type_for_theme.length; i++) for (i=0; i < list_type_for_theme.length; i++)
if (list_type_for_theme[i] == type) if (list_type_for_theme[i] == type)
{
$('select[name=theme]').show(); $('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 else
$('select[name=theme]').val('{$theme_default}'); $('select[name=theme]').val('{$theme_default}');
} }
$(document).ready(function(){ $(document).ready(function(){
addThemeSelect();
$('select[name=type]').change(function() { $('select[name=type]').change(function() {
addThemeSelect(this); addThemeSelect();
}); });
}); });
</script> </script>
@@ -52,9 +52,6 @@ class AdminTranslationsControllerCore extends AdminController
/** @var array : List of theme by translation type : FRONT, BACK, ERRORS... */ /** @var array : List of theme by translation type : FRONT, BACK, ERRORS... */
protected $translations_informations = array(); 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 */ /** @var array : List of all languages */
protected $languages; protected $languages;
@@ -199,7 +196,6 @@ class AdminTranslationsControllerCore extends AdminController
'token' => $this->token, 'token' => $this->token,
'languages' => $this->languages, 'languages' => $this->languages,
'translations_type' => $this->translations_informations, 'translations_type' => $this->translations_informations,
'translations_type_for_theme' => $this->translations_type_for_theme,
'packs_to_install' => $packs_to_install, 'packs_to_install' => $packs_to_install,
'packs_to_update' => $packs_to_update, 'packs_to_update' => $packs_to_update,
'url_submit' => self::$currentIndex.'&token='.$this->token, 'url_submit' => self::$currentIndex.'&token='.$this->token,
@@ -1591,7 +1587,10 @@ class AdminTranslationsControllerCore extends AdminController
public function initFormFront() public function initFormFront()
{ {
if (!$this->theme_exists(Tools::getValue('theme'))) 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(); $missing_translations_front = array();
$name_var = $this->translations_informations[$this->type_selected]['var']; $name_var = $this->translations_informations[$this->type_selected]['var'];