Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanups, fixes and a bit of optimizations for site/components batch #3 #12292

Merged
merged 9 commits into from
Dec 18, 2016
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@
<?php if ($this->params->get('list_show_author', 1)) : ?>
<td <?php echo $headerAuthor; ?> class="list-author">
<?php if (!empty($article->author) || !empty($article->created_by_alias)) : ?>
<?php $author = $article->author ?>
<?php $author = $article->created_by_alias ?: $author; ?>
<?php $author = $article->created_by_alias ?: $article->author; ?>
<?php if (!empty($article->contact_link) && $this->params->get('link_author') == true) : ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', $article->contact_link, $author)); ?>
<?php else: ?>
Expand Down
18 changes: 11 additions & 7 deletions components/com_content/views/category/tmpl/default_children.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,24 @@
$class = ' class="last"';
endif;
?>

<?php
$childNumItems = $child->getNumItems(true);
$childChildren = $child->getChildren();
$childChildrenCount = count($childChildren);
?>
Copy link
Contributor

@andrepereiradasilva andrepereiradasilva Oct 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the $childNumItems = $child->getNumItems(true); is only used if the language isRtland if $this->params->get('show_cat_num_articles', 1) so it should be inside that if.

the other two are only use if $this->maxLevel > 1 so should only be processed then.

so i don't agree with this change since will run this in all cases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as for the rest imo is fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄 yes, got confused by the template code... will revert...

<div<?php echo $class; ?>>
<?php $class = ''; ?>
<?php if ($lang->isRtl()) : ?>
<h3 class="page-header item-title">
<?php if ( $this->params->get('show_cat_num_articles', 1)) : ?>
<span class="badge badge-info tip hasTooltip" title="<?php echo JHtml::tooltipText('COM_CONTENT_NUM_ITEMS_TIP'); ?>">
<?php echo $child->getNumItems(true); ?>
<?php echo $childNumItems; ?>
</span>
<?php endif; ?>
<a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($child->id));?>">
<?php echo $this->escape($child->title); ?></a>

<?php if ($this->maxLevel > 1 && count($child->getChildren()) > 0) : ?>
<?php if ($this->maxLevel > 1 && $childChildrenCount > 0) : ?>
<a href="#category-<?php echo $child->id;?>" data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a>
<?php endif;?>
</h3>
Expand All @@ -45,11 +49,11 @@
<?php echo $this->escape($child->title); ?></a>
<?php if ( $this->params->get('show_cat_num_articles', 1)) : ?>
<span class="badge badge-info tip hasTooltip" title="<?php echo JHtml::tooltipText('COM_CONTENT_NUM_ITEMS_TIP'); ?>">
<?php echo $child->getNumItems(true); ?>
<?php echo $childNumItems; ?>
</span>
<?php endif; ?>

<?php if ($this->maxLevel > 1 && count($child->getChildren()) > 0) : ?>
<?php if ($this->maxLevel > 1 && $childChildrenCount > 0) : ?>
<a href="#category-<?php echo $child->id;?>" data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a>
<?php endif;?>
<?php endif;?>
Expand All @@ -62,10 +66,10 @@
<?php endif; ?>
<?php endif; ?>

<?php if ($this->maxLevel > 1 && count($child->getChildren()) > 0) :?>
<?php if ($this->maxLevel > 1 && $childChildrenCount > 0) :?>
<div class="collapse fade" id="category-<?php echo $child->id;?>">
<?php
$this->children[$child->id] = $child->getChildren();
$this->children[$child->id] = $childChildren;
$this->category = $child;
$this->maxLevel--;
echo $this->loadTemplate('children');
Expand Down