Skip to content

Commit

Permalink
Merge pull request #15245 from matthieu-rolland/jquery-migrate
Browse files Browse the repository at this point in the history
Update jQuery to 3.4.1 in the legacy Back Office pages
  • Loading branch information
matthieu-rolland committed Oct 9, 2019
2 parents 7170a5f + d159dbc commit d7eb44f
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 24 deletions.
13 changes: 12 additions & 1 deletion classes/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,16 @@ public static function getMediaPath($mediaUri, $cssMediaType = null)
*
* @param mixed $version
*
* @return string
* @return array
*
* @deprecated 1.7.7 jQuery is always included, this method should no longer be used
*/
public static function getJqueryPath($version = null, $folder = null, $minifier = true)
{
@trigger_error(
'Media::getJqueryPath() is deprecated since version 1.7.7.0, jquery is always included',
E_USER_DEPRECATED
);
$addNoConflict = false;
if ($version === null) {
$version = _PS_JQUERY_VERSION_;
Expand Down Expand Up @@ -771,6 +777,11 @@ public static function addJsDefL($params, $content, $smarty = null, &$repeat = f
}
}

/**
* @param $output
*
* @return string|string[]|null
*/
public static function deferInlineScripts($output)
{
/* Try to enqueue in js_files inline scripts with src but without conditionnal comments */
Expand Down
7 changes: 6 additions & 1 deletion classes/controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2702,7 +2702,12 @@ public function setMedia($isNewTheme = false)
$this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/vendor/titatoggle-min.css', 'all', 0);
$this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/public/theme.css', 'all', 0);

$this->addJquery();
// add Jquery 3 and its migration script
$this->addJs(_PS_JS_DIR_ . 'jquery/jquery-3.4.1.min.js');
$this->addJs(_PS_JS_DIR_ . 'jquery/jquery-migrate-3.1.0.min.js');
// implement $.browser object, that has been removed since jquery 1.9
$this->addJs(_PS_JS_DIR_ . 'jquery/jquery.browser-0.1.0.min.js');

$this->addJqueryPlugin(array('scrollTo', 'alerts', 'chosen', 'autosize', 'fancybox'));
$this->addJqueryPlugin('growl', null, false);
$this->addJqueryUI(array('ui.slider', 'ui.datepicker'));
Expand Down
7 changes: 6 additions & 1 deletion classes/controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,15 @@ public function removeJS($js_uri, $check_path = true)
* @param string|null $version jQuery library version
* @param string|null $folder jQuery file folder
* @param bool $minifier if set tot true, a minified version will be included
*
* @deprecated 1.7.7 jQuery is always included, this method should no longer be used
*/
public function addJquery($version = null, $folder = null, $minifier = true)
{
$this->addJS(Media::getJqueryPath($version, $folder, $minifier), false);
@trigger_error(
'Controller->addJquery() is deprecated since version 1.7.7.0, jQuery is always included',
E_USER_DEPRECATED
);
}

/**
Expand Down
12 changes: 0 additions & 12 deletions classes/controller/FrontController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1183,18 +1183,6 @@ public function removeJS($js_uri, $check_path = true)
}
}

/**
* @deprecated 1.7 This function has no effect in PrestaShop 1.7 theme. jQuery2 is register by the core on every theme.
* Have a look at the /themes/_core folder.
*/
public function addJquery($version = null, $folder = null, $minifier = true)
{
/*
This is deprecated in PrestaShop 1.7 and has no effect in PrestaShop 1.7 theme.
jQuery2 is register by the core on every theme. Have a look at the /themes/_core folder.
*/
}

/**
* Adds jQuery UI component(s) to queued JS file list.
*
Expand Down
9 changes: 0 additions & 9 deletions controllers/admin/AdminLegacyLayoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,4 @@ public function display()

$this->outPutHtml;
}

/**
* {@inheritdoc}
*/
public function addJquery($version = null, $folder = null, $minifier = true)
{
// jQuery is already included, so do nothing
@trigger_error(__FUNCTION__ . 'is deprecated and has no effect in the New Theme since version 1.7.6.0.', E_USER_DEPRECATED);
}
}
2 changes: 2 additions & 0 deletions js/jquery/jquery-3.4.1.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions js/jquery/jquery-migrate-3.1.0.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions js/jquery/jquery.browser-0.1.0.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d7eb44f

Please sign in to comment.