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

Set active class in mod_articles_categories when SEF is off #19197

Merged
merged 3 commits into from
Jan 3, 2018

Conversation

csthomas
Copy link
Contributor

@csthomas csthomas commented Dec 28, 2017

Pull Request for Issue #19194 .

Summary of Changes

Do not replace & by & in URL in JRoute::_(...) when comparing to $_SERVER['REQUEST_URI']

Testing Instructions

Test issue #19194

Expected result

When SEF is off.
Active class will appear when we are on the category page.

Actual result

When SEF is off active class in (<li class="active">) is missing.

Documentation Changes Required

None

@joomdonation
Copy link
Contributor

How do you think about using code like this:

  1. Add the code to get necessary variables from input at the beginning of file:
$input  = JFactory::getApplication()->input;
$option = $input->getCmd('option');
$view   = $input->getCmd('view');
$id     = $input->getInt('id');
  1. And then change if command to:
if ($option == 'com_content' && $view == 'category' && $id == $item->id) echo ' class="active"';

@csthomas
Copy link
Contributor Author

@joomdonation Your suggestion is good, thanks.

@joomdonation
Copy link
Contributor

I have tested this item ✅ successfully on f4dce78


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

foreach ($list as $item) : ?>
<li <?php if ($_SERVER['REQUEST_URI'] === JRoute::_(ContentHelperRoute::getCategoryRoute($item->id))) echo ' class="active"'; ?>> <?php $levelup = $item->level - $startLevel - 1; ?>
<li <?php if ($id == $item->id && $view == 'category' && $option == 'com_content') echo ' class="active"'; ?>> <?php $levelup = $item->level - $startLevel - 1; ?>
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the space after <li since there is a space before class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Quy
Copy link
Contributor

Quy commented Dec 28, 2017

I have tested this item ✅ successfully on fc0c98f


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

@ghost
Copy link

ghost commented Dec 28, 2017

@joomdonation can you please retest?

@Quy
Copy link
Contributor

Quy commented Dec 28, 2017

@franz-wohlkoenig It is only coding style to remove an extra space. It does not affect test result.

@joomdonation
Copy link
Contributor

The last change is just code style, so my test is still success. You can mark this PR as RTC

@ghost
Copy link

ghost commented Dec 28, 2017

Ready to Commit after two successful tests.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Dec 28, 2017
@mbabker mbabker added this to the Joomla 3.8.4 milestone Jan 3, 2018
@mbabker mbabker merged commit 9d437e2 into joomla:staging Jan 3, 2018
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jan 3, 2018
@csthomas csthomas deleted the active_mod_articles_categories branch January 3, 2018 07:11
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.

None yet

5 participants