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
(UX) Add link to edit categories and show parent category #20740
(UX) Add link to edit categories and show parent category #20740
Conversation
Do we need to do something like just displaying the last x elements in the category tree if it is very long |
There shouldnt be any queries in a template file. Finally you are making all the categories a link - shouldnt the link be disabled if the user does not have permission to edit the category |
it's just the parent of the last one... because i think it could indeed be very long |
I thought i am doing that check - is it done wrong? |
Can someone give me advise where and how to put the query in ? |
I only had a chance to read the code and with the current formatting it's very hard to spot everything. Hence my earlier mistaken comments. If you could do a quick update on just the code formatting it will make it easier |
Query should be in articles model. See frontend articles model for example: |
For permission check to work you need to get permissions for each category. Currently, ROOT check should be performed against category ID as opposed to category title because it's possible to create a category titled |
Thank you both! I will work on it. |
I put the query into the model, next steps will be the other improvements (acl and levelindicator) thanks again for your review! Edit: levelidicator is done, Now my articletitle is messed up ;) will fix it. |
The joins for category authors is unnecessary. The 4 category related blocks can be replaced with these 2:
This also removes some unnecessary selects, e.g. category ID is already selected as |
Thank you! Done :) |
href="<?php echo JRoute::_('index.php?option=com_categories&task=category.edit&id=' . $item->parent_category_id . '&extension=com_content'); ?>" | ||
title="<?php echo JText::_('JACTION_EDIT') . ' ' . JText::_('JCATEGORY'); ?>"> | ||
|
||
<?php endif ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add semicolon
|
||
<?php endif ?> | ||
|
||
<?php echo '' . $item->parent_category_title . ''; ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove ''
. They are empty strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But there must be a space before the category?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see now what you meant ;)
<?php echo JText::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?> | ||
<?php echo JText::_('JCATEGORY') . ':' ?> | ||
|
||
<?php if ($item->parent_category_id != '1') : ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra space before :
Remove blank lines between lines 200-241. |
@@ -190,7 +197,48 @@ | |||
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?> | |||
</span> | |||
<div class="small"> | |||
<?php echo JText::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?> | |||
<?php echo JText::_('JCATEGORY') . ':' ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add semicolon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder
|
||
<?php if ($canEditParCat || $canEditOwnParCat) : ?> | ||
|
||
<a class="hasTooltip" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra space
|
||
<?php if ($canEditCat || $canEditOwnCat) : ?> | ||
|
||
<a class="hasTooltip" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra space
While it is convenient, how often are categories updated? Usually, they are set up and forget. This PR will add extra markup to the page that will probably not be used majority of the time. |
@Quy Explaining Joomla to others and giving training brought me to that point. While you can jump to the articles from the Categories you can't access the Category from the Article. The intention is to enable the User to keep more care of the categories and als not to setup and forget. The extra Level brings sureness that they edit the right thing. Sometimes it's not clear just from one level. I think the markup is not blown very much. |
Add Feature to Featured Articles Manager
I have tested this item 🔴 unsuccessfully on ef35014 https://www.dropbox.com/s/1nusc6o3iqp0ui9/elisa-categories-pull-request.png?dl=0 Looks like a small amendment. Let me know and I will test again. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20740. |
@uglyeoin |
@infograf768 sorry missed, that, will test again |
I have tested this item ✅ successfully on ef35014 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20740. |
endif; | ||
endif; | ||
|
||
if ($this->document->direction == "ltr") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use isRtl()
method to check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Quy
can't we use use both document->direction
or
if (JFactory::getLanguage()->isRtl())
?
I have tested this item ✅ successfully on ef35014 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20740. |
@coolcat-creations Codestyle failures:
|
Well thought. Indeed drone is there to remind us.. :) |
Ready to Commit after two successful tests. |
rtc, after the cs is corrected. :) |
@coolcat-creations |
I corrected the lines, do I have to use the other rtl method too? |
We use both methods in core. the most commonly used one is indeed |
Ok I used the more common method :) |
Milestoned to 3.9.0. |
Summary of Changes
This PR adds the Information to the parent category of the article before the category and offers a direct link to edit it.
Testing Instructions
Small change, big UX improvement
-> access the categories easier and faster
-> Some pages have similar named subcategories so its better to know the parent too
Please test coding style and everything, I did it how I thought it might work... thanks a lot!