Repository navigation
Add category order - #2592
Add category order#2592
Conversation
| $c_show = $c_active || FreshRSS_Context::$user_conf->display_categories; | ||
| ?> | ||
| <li class="tree-folder category<?= $c_active ? ' active' : '' ?>" data-unread="<?= $cat->nbNotRead() ?>"> | ||
| <li class="tree-folder category<?= $c_active ? ' active' : '' ?><?= null === $priority ? '' : " priority_$priority"?>" data-unread="<?= $cat->nbNotRead() ?>"> |
There was a problem hiding this comment.
I have not checked in details, but I suggest using data-priority="..."
There was a problem hiding this comment.
The idea here is to be able to target them with a CSS rule. But I can also add some data.
There was a problem hiding this comment.
A [data-priority="1"] or something along those lines would be every so slightly more expensive (unless that changed in recent years) but it's hardly worth worrying about.
There was a problem hiding this comment.
@Frenzie I am not sure I follow you thinking. Could you explain me what you have in mind?
There was a problem hiding this comment.
Sorry, I figured you knew. That's a CSS attribute selector.
It's been supported by all browsers for close to 15 years.
There was a problem hiding this comment.
@Frenzie I knew but I didn't understand what you meant. Now I do :)
There was a problem hiding this comment.
We are already using CSS rules targetting data properties, e.g. https://github.com/FreshRSS/FreshRSS/blob/dev/p/themes/base-theme/template.css#L1023
|
|
||
| public function _attributes($key, $value) { | ||
| if ($key == '') { | ||
| if ('' === $key) { |
There was a problem hiding this comment.
Probably == is better there. It would still be a problem with null and 0 and false
|
Looks good and straightforward 👍 |
|
@Alkarex I think I should do something more user friendly by modifying the priority with drag&drop instead of manual entry. |
|
@aledeg It would surely be better, if you are motivated enough :-P |
|
Sort(ing) order? Position(ing)? |
|
Sounds good! |
|
I would like to call for testing FreshRSS 1.15 tomorrow and release it by the end October. Therefore a first simple version for now would be nice (i.e. more or less what you already have now), keeping the drag & drop improvements for the next release |
|
The thing is that with drag&drop, there will be no use for the category configuration field in UI. Thus making the translation obsolete. We can still remove it later but we have to keep that in mind. |
22f74b7 to
28475e1
Compare
Each category has a new 'priority' attribute. It is used to sort categories in views. Categories with the same priority are sorted alphabetically. Categories with no priority are displayed after those with one. For example, if we have the following categories: - A (priority: 2) - B (no priority) - C (priority: 1) - D (priority: 2) - E (no priority) - F (priority: 1) They will be displayed in the following order: - C - F - A - D - B - E See FreshRSS#190
28475e1 to
042fcd5
Compare
|
Nice, I will try tomorrow morning :-) |
It took too much room and will not be so necessary once we have drag & drop
|
Looks all good :-) I have just shorten a bit the help text as it was not looking so good on different layouts |
I had a bug when some articles in a category were unread. Sometimes, filtering the category displayed all the articles, even with the "Adjust showing" option. A reasonably good guess was to look the last commits that impacted the categories and, indeed, it was introduced by the new category sorting system. The sort function (`usort`) doesn't keep the index association, which is important here. I must admit I don't understand exactly why (I didn't search), but the keys are probably used somewhere. Another fix would be to not rely on these keys anymore. The bug was introduced in 042fcd5 - Ref PR: FreshRSS#2592 - Ref usort: https://www.php.net/manual/en/function.usort.php - Ref uasort: https://www.php.net/manual/en/function.uasort.php
I had a bug when some articles in a category were unread. Sometimes, filtering the category displayed all the articles, even with the "Adjust showing" option. A reasonably good guess was to look the last commits that impacted the categories and, indeed, it was introduced by the new category sorting system. The sort function (`usort`) doesn't keep the index association, which is important here. I must admit I don't understand exactly why (I didn't search), but the keys are probably used somewhere. Another fix would be to not rely on these keys anymore. The bug was introduced in 042fcd5 - Ref PR: #2592 - Ref usort: https://www.php.net/manual/en/function.usort.php - Ref uasort: https://www.php.net/manual/en/function.uasort.php
| $c_show = $c_active || FreshRSS_Context::$user_conf->display_categories; | ||
| ?> | ||
| <li class="tree-folder category<?= $c_active ? ' active' : '' ?>" data-unread="<?= $cat->nbNotRead() ?>"> | ||
| <li class="tree-folder category<?= $c_active ? ' active' : '' ?>"<?= null === $position ? '' : "data-position='$position'" ?> data-unread="<?= $cat->nbNotRead() ?>"> |
Each category has a new 'priority' attribute. It is used to sort categories in
views. Categories with the same priority are sorted alphabetically. Categories
with no priority are displayed after those with one.
For example, if we have the following categories:
They will be displayed in the following order:
See #190