Skip to content

Commit

Permalink
Moved JS to the right place
Browse files Browse the repository at this point in the history
  • Loading branch information
smz committed Dec 19, 2014
1 parent 1354bce commit e829fe3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 12 additions & 0 deletions components/com_content/views/categories/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
JHtml::_('behavior.caption');

JFactory::getDocument()->addScriptDeclaration("
jQuery(function($) {
$('.categories-list').find('[id^=category-btn-]').each(function(index, btn) {
var btn = $(btn);
btn.on('click', function() {
btn.find('span').toggleClass('icon-plus');
btn.find('span').toggleClass('icon-minus');
});
});
});");

echo JLayoutHelper::render('joomla.content.categories_default', $this);
echo $this->loadTemplate('items');
?>
Expand Down
11 changes: 0 additions & 11 deletions layouts/joomla/content/categories_default.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@

defined('_JEXEC') or die;

JFactory::getDocument()->addScriptDeclaration("
jQuery(function($) {
$('.categories-list').find('[id^=category-btn-]').each(function(index, btn) {
var btn = $(btn);
btn.on('click', function() {
btn.find('span').toggleClass('icon-plus');
btn.find('span').toggleClass('icon-minus');
});
});
});");

?>
<div class="categories-list<?php echo $displayData->pageclass_sfx;?>">
<?php if ($displayData->params->get('show_page_heading')) : ?>
Expand Down

0 comments on commit e829fe3

Please sign in to comment.