Skip to content

Commit

Permalink
Fix for old media JS paths, so we don't use the old .media/com_fabrik…
Browse files Browse the repository at this point in the history
…/js/foo-min.js, we correctly use the dist/foo.js.
  • Loading branch information
cheesegrits committed May 26, 2016
1 parent 0bac206 commit a7c02dc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 16 additions & 0 deletions components/com_fabrik/helpers/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,22 @@ public static function script($file, $onLoad = '', $minSuffix = '-min.js')
{
if (!(JString::stristr($file, 'http://') || JString::stristr($file, 'https://')))
{
/**
* Fix for new media compressed JS paths, which we switched from ./js/foo-mins.js to ./js/dist/foo.js.
* Some code feeds us the new dist path, but some still uses just media/com_fabrik/js. So, if we're
* not in debug mode, and the path is media/com_fabrik/js and doesn't have /dist, add it.
**/
if (!self::isDebug())
{
if (strpos($file, 'media/com_fabrik/js/') !== false)
{
if (strpos($file, 'media/com_fabrik/js/dist/') === false)
{
$file = str_replace('media/com_fabrik/js/', 'media/com_fabrik/js/dist/', $file);
}
}
}

if (JFile::exists(COM_FABRIK_BASE . $file))
{
$compressedFile = str_replace('.js', $ext, $file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,10 @@ private function iniJs()
$js[] = "" . $model->getFilterJs();
$js = implode("\n", $js);

$mediaFolder = FabrikHelperHTML::getMediaFolder();

$srcs = FabrikHelperHTML::framework();
$srcs['FbListFilter'] = 'media/com_fabrik/js/listfilter.js';
$srcs['FbListFilter'] = $mediaFolder . '/listfilter.js';
$srcs['fabrikFullcalendar'] = 'plugins/fabrik_visualization/fullcalendar/fullcalendar.js';

$shim = $model->getShim();
Expand Down

0 comments on commit a7c02dc

Please sign in to comment.