User tests: Successful: Unsuccessful:
This PR adds the Information to the parent category of the article before the category and offers a direct link to edit it.
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!
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_content |
Labels |
Added:
?
|
There shouldnt be any queries in a template file.
For the template file please look your code and make sure that it is in a nested structure
You should probably update the featured articles view as well
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
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
I thought i am doing that check - is it done wrong?
There shouldnt be any queries in a template file.
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:
https://github.com/coolcat-creations/joomla-cms/blob/2334e0d888129ba2b4f42ec056b9cfe2086098ed/components/com_content/models/articles.php#L242-L244
For permission check to work you need to get permissions for each category. Currently, $canEdit
and $canEditOwn
variables hold permissions of article.
ROOT check should be performed against category ID as opposed to category title because it's possible to create a category titled ROOT
.
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:
// Join over the categories.
$query->select('c.title AS category_title, c.created_user_id as category_uid')
->join('LEFT', '#__categories AS c ON c.id = a.catid');
// Join over the parent categories.
$query->select('parent.title AS parent_title, parent.id AS parent_id, parent.created_user_id AS parent_uid')
->join('LEFT', '#__categories AS parent ON parent.id = c.parent_id');
This also removes some unnecessary selects, e.g. category ID is already selected as catid
.
Thank you! Done :)
Remove blank lines between lines 200-241.
@coolcat-creations is this PR ready for Test??
@franz-wohlkoenig yes ready to test, @Quy thanks for reviewing the Code Style!
I have tested this item
Test successful works with categories/child categories, shows the correct stuff, has Brians suggestion implemented (nice suggestion Brian). Successful test.
Has this been tested in RTL?
@infograf768 I am afraid - no - and seems thats a good point to keep care of, I'll make some changes! Thanks!!!
Perfect, thank you, I was not aware of rtl but will keep that always in mind from now!
Just a small update: I have Issues installing a new language in staging, I will have to reinstall everything and then implement the rtl stuff. I shall find some time next week!
You do not need to install a new language to test something in RTL
\administrator\language\en-GB\en-GB.xml
change
<rtl>0</rtl>
to
<rtl>1</rtl>
You do not need to install a new language to test something in RTL
Not in this case as the rtl word category with : in RTL displays differently. I tested.
Test can be done with English, than keeping the page in its window and opening a new window displaying admin installed languages and switching to Arabic or Persian, then reloading the other window, etc.
I changed everything to work in rtl - can you check and test? Thanks @uglyeoin @infograf768
Nice. It works.
Some suggestions : I would use hmtlentities for «
»
. A matter of choice I guess.
Code style in the default.php
blank lines before the if (
move { and } to the next line.
I let @Quy propose solutions for that.
More important: please do the same for the Featured articles view.
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.
I have tested this item
Sorry Elisa, this one failed. See this image for details:
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.
@infograf768 sorry missed, that, will test again
I have tested this item
Successfully tested in Persian
I have tested this item
@coolcat-creations Codestyle failures:
FILE: ...mla/joomla-cms/administrator/components/com_content/models/featured.php
--------------------------------------------------------------------------------
FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
111 | WARNING | Line exceeds 150 characters; contains 176 characters
--------------------------------------------------------------------------------
UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...mla/joomla-cms/administrator/components/com_content/models/articles.php
--------------------------------------------------------------------------------
FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
213 | WARNING | Line exceeds 150 characters; contains 176 characters
--------------------------------------------------------------------------------
UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY
--------------------------------------------------------------------------------
Well thought. Indeed drone is there to remind us.. :)
Status | Pending | ⇒ | Ready to Commit |
Ready to Commit after two successful tests.
rtc, after the cs is corrected. :)
@coolcat-creations
Can you correct the cs so that the PR is complete?
Labels |
Added:
?
|
I corrected the lines, do I have to use the other rtl method too?
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 JFactory::getLanguage()->isRtl()
You decide.
Ok I used the more common method :)
Thank you all for testing and supporting, I learned a lot with this PR.
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-06-29 01:50:32 |
Closed_By | ⇒ | mbabker | |
Labels |
Added:
?
Removed: ? |
Do we need to do something like just displaying the last x elements in the category tree if it is very long