Skip to content

Commit

Permalink
removing 2.5 rquirejs loading of calendarjs - caused errors if not in…
Browse files Browse the repository at this point in the history
… fabrik page, and loading of the two files should be sequential which is not guarenteed by loading with requirejs
  • Loading branch information
pollen8 committed Feb 6, 2014
1 parent 2ab57c0 commit 9c9ec9d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions components/com_fabrik/jhelpers/2.5/behavior.php
Expand Up @@ -642,36 +642,44 @@ public static function calendar()
{
return;
}

JHtml::_('stylesheet', 'system/calendar-jos.css', array(' title' => JText::_('JLIB_HTML_BEHAVIOR_GREEN'), ' media' => 'all'), true);
$translation = JHtmlBehavior::_calendartranslation();
$document = JFactory::getDocument();
$tag = JFactory::getLanguage()->getTag();

$app = JFactory::getApplication();
if ($app->isAdmin())
$option = $app->input->get('option');

// Bah - not sure why we were trying to load the calendar via requirejs
$isFabrik = $option == 'com_fabrik' || !is_null($app->input->get('fabrik_sticky_filters'));
$isFabrik = false;

if ($app->isAdmin() || !$isFabrik)
{
$tag = JFactory::getLanguage()->getTag();
JHtml::_('script', $tag . '/calendar.js', false, true);
JHtml::_('script', $tag . '/calendar-setup.js', false, true);

if ($translation)
{
$document->addScriptDeclaration($translation);
}
}
else
{

$f = array();
$f[] = JHtml::_('script', $tag . '/calendar.js', false, true, true);
$f[] = JHtml::_('script', $tag . '/calendar-setup.js', false, true, true);

if ($translation)
{
// In any event its not right as the 2 scrips would need to be loaded one after the other
$translation = "requirejs(" . json_encode($f) . ", function () { $translation });\n";
$document->addScriptDeclaration($translation);
}
}


self::$loaded[__METHOD__] = true;
}

Expand Down

0 comments on commit 9c9ec9d

Please sign in to comment.