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

This commit is contained in:
Damien Metzger
2013-04-23 12:37:09 +02:00
parent ceddfdd8e6
commit 4be1bef203
2 changed files with 15 additions and 9 deletions
@@ -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();
});
});
</script>
@@ -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'];