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
Merged

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

merged 9 commits into from
Dec 18, 2016

Conversation

frankmayer
Copy link
Contributor

  • com_content

Note: This is a single commit bundling all types of changes, since PR #12261 which had detailed commits, was rejected as a whole

- com_content

Note: This is a single commit bundling all types of changes, since PR #12261 which had detailed commits, was rejected as a whole
$results = array ('select' => $select, 'join' => $join);

return $results;
return array ('select' => $select, 'join' => $join);
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove the space here?

{
$this->_children = ArrayHelper::sortObjects($this->_children, 'title', ($params->get('orderby_pri') == 'alpha') ? 1 : (-1));
$this->_children = ArrayHelper::sortObjects($this->_children, 'title', ($params->get('orderby_pri') === 'alpha') ? 1 : (-1));
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we getting orderby_pri param again here?

{
if ($associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $data['id']))
{
foreach ($associations as $tag => $associated)
{
$associations[$tag] = (int) $associated->id;
}

$data['associations'] = $associations;
Copy link
Contributor

Choose a reason for hiding this comment

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

if you remove one if block you should remove one tab inside the if.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted as in other PR

@@ -177,7 +177,7 @@
<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 ? $article->created_by_alias : $author);?>
<?php $author = ($article->created_by_alias ?: $author);?>
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.

why not remove the parenthisis here?
Also can you add an extra space before the php end tag?

@@ -143,7 +143,7 @@ public function display($tpl = null)

// For blog layouts, preprocess the breakdown of leading, intro and linked articles.
// This makes it much easier for the designer to just interrogate the arrays.
if (($params->get('layout_type') == 'blog') || ($this->getLayout() == 'blog'))
if (($params->get('layout_type') === 'blog') || ($this->getLayout() === 'blog'))
Copy link
Contributor

Choose a reason for hiding this comment

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

why not remove the parenthisis here too?

Made some changes as pointed out by @andrepereiradasilva
@@ -177,7 +177,7 @@
<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 ? $article->created_by_alias : $author);?>
<?php $author = $article->created_by_alias ?: $author; ?>
Copy link
Contributor

Choose a reason for hiding this comment

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

looking at this one again ...
why not , instead of too lines, use just:

<?php $author = $article->created_by_alias ?: $article->author; ?>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Found a bit more to refactor... coming up soon...

$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...

@andrepereiradasilva
Copy link
Contributor

I have tested this item ✅ successfully on c0b68fc

on code review


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12292.

@@ -286,7 +286,6 @@ protected function getReturnPage()
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
Copy link
Contributor

Choose a reason for hiding this comment

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

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, you are right. I didn't follow the trail, there. Thanks

@andrepereiradasilva
Copy link
Contributor

I have tested this item ✅ successfully on acd28f7

just a change at george request. still fine


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12292.

# Conflicts:
#	components/com_content/helpers/association.php
#	components/com_content/helpers/route.php
#	components/com_content/router.php
#	components/com_content/views/article/tmpl/default.php
#	components/com_content/views/categories/tmpl/default_items.php
#	components/com_content/views/category/tmpl/blog_children.php
#	components/com_content/views/category/tmpl/default_articles.php
#	components/com_content/views/category/tmpl/default_children.php
#	components/com_content/views/featured/tmpl/default.php
#	components/com_content/views/featured/view.feed.php
#	components/com_content/views/form/tmpl/edit.php
Copy link
Contributor

@andrepereiradasilva andrepereiradasilva left a comment

Choose a reason for hiding this comment

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

some cs suggestions

@@ -458,9 +458,10 @@ public function &getChildren()
{
$params = $this->getState()->get('params');

if ($params->get('orderby_pri') == 'alpha' || $params->get('orderby_pri') == 'ralpha')
$orderByPri = $params->get('orderby_pri');
if ($orderByPri === 'alpha' || $orderByPri === 'ralpha')
Copy link
Contributor

Choose a reason for hiding this comment

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

cs: can we have an aempty line before the if statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

of course :)

<?php endif; ?>
<?php if ($this->maxLevel > 1 && count($child->getChildren()) > 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;?>
Copy link
Contributor

Choose a reason for hiding this comment

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

cs: please don't remove the empty space after the ; in php closing tags

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, this happened while merging...

<?php endif; ?>
<?php if ($this->maxLevel > 1 && count($child->getChildren()) > 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;?>
Copy link
Contributor

Choose a reason for hiding this comment

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

cs: please don't remove the empty space after the ; in php closing tags

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, this happened while merging...

@@ -35,8 +35,8 @@
<a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($child->id)); ?>">
<?php echo $this->escape($child->title); ?></a>

<?php if (count($child->getChildren()) > 0 && $this->maxLevel > 1) : ?>
<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>
Copy link
Contributor

Choose a reason for hiding this comment

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

cs: still one here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is there?

Copy link
Contributor

Choose a reason for hiding this comment

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

you removed the space between ; and ?>

@@ -49,8 +49,8 @@
</span>
<?php endif; ?>

<?php if (count($child->getChildren()) > 0 && $this->maxLevel > 1) : ?>
<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>
Copy link
Contributor

Choose a reason for hiding this comment

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

cs: still one here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is there?

Copy link
Contributor

Choose a reason for hiding this comment

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

you removed the space between ; and ?>
(see lines below)

@andrepereiradasilva
Copy link
Contributor

I have tested this item ✅ successfully on 0e94075

code review


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12292.

# Conflicts:
#	components/com_content/helpers/query.php
#	components/com_content/helpers/route.php
#	components/com_content/models/articles.php
#	components/com_content/views/category/tmpl/default_articles.php
#	components/com_content/views/featured/view.feed.php
@frankmayer
Copy link
Contributor Author

Fixed some conflicts that had occurred in the meantime.
Having merged the changes of above referenced PR's made this PR lighter and easier to test.
It is essentially ready to be merged, when the team finds the time and PR is OK.

*
* @since 1.6
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean revert the removal?

Copy link
Contributor

Choose a reason for hiding this comment

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

@wilsonge wilsonge merged commit 22ea525 into joomla:staging Dec 18, 2016
@wilsonge wilsonge added this to the Joomla 3.7.0 milestone Dec 18, 2016
@frankmayer frankmayer deleted the site-com_content-com_contenthistory branch December 25, 2016 21:55
@wojsmol
Copy link
Contributor

wojsmol commented Jul 8, 2017

@frankmayer
Please look at #16757.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants