// BO : product page JS fixes

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12571 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2012-01-19 17:45:51 +00:00
parent ef79a74fd6
commit c8e2addee2
3 changed files with 62 additions and 39 deletions
@@ -27,10 +27,9 @@
{extends file="helper/form/form.tpl"} {extends file="helper/form/form.tpl"}
{block name="autoload_tinyMCE"} {block name="autoload_tinyMCE"}
// Execute when tab Informations has finished loading
onTabLoad('Informations', function(){
// change each by click to load only on click // change each by click to load only on click
$("#product-tab-content-Informations").bind('loaded', function(){
$(".autoload_rte").each(function(e){ $(".autoload_rte").each(function(e){
tinySetup({ tinySetup({
mode :"exact", mode :"exact",
@@ -62,8 +61,7 @@
} }
}); });
}); });
}); });
$("#product-tab-content-Informations").trigger('loaded');
{/block} {/block}
{block name="defaultForm"} {block name="defaultForm"}
@@ -2082,6 +2082,12 @@ class AdminProductsControllerCore extends AdminController
$this->tpl_form_vars['token'] = $this->token; $this->tpl_form_vars['token'] = $this->token;
$this->tpl_form_vars['combinationImagesJs'] = $this->getCombinationImagesJs(); $this->tpl_form_vars['combinationImagesJs'] = $this->getCombinationImagesJs();
// autoload rich text editor (tiny mce)
$this->tpl_form_vars['tinymce'] = true;
$iso = $this->context->language->iso_code;
$this->tpl_form_vars['iso'] = file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en';
$this->tpl_form_vars['ad'] = dirname($_SERVER['PHP_SELF']);
if (Validate::isLoadedObject(($this->object))) if (Validate::isLoadedObject(($this->object)))
$id_product = $this->object->id; $id_product = $this->object->id;
else else
@@ -3015,12 +3021,6 @@ class AdminProductsControllerCore extends AdminController
{ {
$data = $this->createTemplate($this->tpl_form); $data = $this->createTemplate($this->tpl_form);
// autoload rich text editor (tiny mce)
$iso = $this->context->language->iso_code;
$this->tpl_form_vars['iso'] = file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en';
$this->tpl_form_vars['ad'] = dirname($_SERVER['PHP_SELF']);
$this->tpl_form_vars['tinymce'] = true;
$currency = $this->context->currency; $currency = $this->context->currency;
$data->assign('languages', $this->_languages); $data->assign('languages', $this->_languages);
$data->assign('currency', $currency); $data->assign('currency', $currency);
+25
View File
@@ -335,6 +335,28 @@ function handleSaveForPack()
enableSave(); enableSave();
} }
function enableProductName()
{
$('.copy2friendlyUrl').removeAttr('disabled');
}
/**
* Execute a callback function when a specific tab has finished loading or right now if the tab is already loaded
*
* @param tab_name name of the tab that is checked for loading
* @param callback_function function to call
*/
function onTabLoad(tab_name, callback_function)
{
var target_tab = $('#product-tab-content-' + tab_name);
if (!target_tab)
return false;
if (target_tab.hasClass('not-loaded'))
target_tab.bind('loaded', callback_function);
else
callback_function();
}
/* function autocomplete */ /* function autocomplete */
urlToCall = null; urlToCall = null;
@@ -348,4 +370,7 @@ $(document).ready(function() {
code = (e.keyCode ? e.keyCode : e.which); code = (e.keyCode ? e.keyCode : e.which);
return (code == 13) ? false : true; return (code == 13) ? false : true;
}); });
// Enable writing of the product name when the friendly url field in tab SEO is loaded
onTabLoad('Seo', enableProductName);
}); });