Subcategories not working as expected.


  • I'm bumping this. Issue was closed but I don't think it's working as expected and I've found a bug.

    First the bug : If you create a category with a parent and then disable it, it will show on front and link to a 404 page.
    Also you can't remove a category parent on ACP.

    Then what's bugging me with the actual subcategories.
    Children should have the same information as a category concerning the activity (last posts) because right now subcategories are just links and you don't have any information on it before opening it.

    I give you an example of my problem in the context.

    What I'm trying to do is very simple (no sub-sub-categories)

    What I'm working on is displaying parent categories on home by hiding categories with {categories.parent.name} not empty.


    As you can see there's no posting information as it should be like here

    And the problem is exactly the same in a category page

    The first thing I'm trying to do is mimic a theme for categories but since Home and Category are two separate templates there's no problem with that. If the children have the exact same information as parents + their personal information I think that will fix the issue.

    One more thing but I think this one is not as important cause more rare but if you want subcategories on subcategories there's a new problem pointing out, subcategories don't have any information about their children (problem is that it could be infinite nesting of json tables).

    I 've open an issue on Github linking to this post.
    https://github.com/NodeBB/NodeBB/issues/2080

  • GNU/Linux Admin

    I've commented on the issue, please let me know if I've missed anything.


  • @julian you didn't miss anything. Thank you for the fixes I'll try that out tomorrow.

  • GNU/Linux Admin

    Keep in mind that I implemented the display of subcategories inside of the category view, so this may have been a duplication of some of the work you did.


  • @julian Finally tested it out. It's perfect in term of organization it's so much better.
    I still have a request though :
    Is it possible for subcategories to have this information :

    It could be in the clidren object as a table like it is for a category on home.
    And the unread-class attribute too.

    Why I'm asking this for is because I think the feature of viewing what's said in a category on the homepage should be present also on the categories pages. The reason is simple. If someone post in a subcategory the information doesn't go to the parent (which is perfectly normal) but when you're viewing what's inside you should be able to see if there's new content in a subcategory without loading it like it's done on the homepage.
    I don't realize if this is a lot of work cause I think basically it's copying information that was previously here but unusable (subcategories that were displayed on home had this information).

    Thanks a bunch for what you've already done and I'm happy if I had provide some help.

    I think we're near the best thing for subcategories now and that was a needed feature for future versions of NodeBB πŸ˜„

  • NodeBB

    Once merged into 0.5.1 this should do what you want.


  • @baris Looking forward for it, funny that this is in master branch when the subcategories are in 0.5.1.


  • @julian said:

    Keep in mind that I implemented the display of subcategories inside of the category view, so this may have been a duplication of some of the work you did.

    I didn't see such "display of subcategories inside of the category viewβ€œ after I installed 0.5.1.....
    (may be the following code is not the latest?)
    category.tpl
    <div class="subcategories">
    <!-- BEGIN children -->
    <!-- IMPORT partials/category_child.tpl -->
    <!-- END children -->
    </div>

  • GNU/Linux Admin

    @miluo said:

    <div class="subcategories">
    <!-- BEGIN children -->
    <!-- IMPORT partials/category_child.tpl -->
    <!-- END children -->
    </div>
    

    This is all I added, so if that works for you, then great! πŸ™‚


  • @julian said:

    @miluo said:

    <div class="subcategories">
    <!-- BEGIN children -->
    <!-- IMPORT partials/category_child.tpl -->
    <!-- END children -->
    </div>
    

    This is all I added, so if that works for you, then great! πŸ™‚

    I'm currently working on a way of displaying the sub categories on the home page too. If I come up with something that looks ok. I'll PR it for your approval.

    Something like this, but better. Maybe have them before first post teaser instead.

    Untitled.png

  • NodeBB

    @a_5mith IMO they should go under the category name and description, since they are sub categories πŸ™‚ having them above the main category makes them look like they are more important.


  • @baris said:

    @a_5mith IMO they should go under the category name and description, since they are sub categories πŸ™‚ having them above the main category makes them look like they are more important.

    Look at Baris with his logical approach to things. πŸ˜› I'll see what can be done.

    EDIT: Still a bit of styling left to do. But something like this?

    Untitled.png

  • NodeBB

    Yeah that looks better. I wouldn't text-align:center them since everything else is left aligned in that box πŸ™‚

  • NodeBB

    Also @psychobunny fixed the weird arrow css so if you update lavender to 0.1.4 you should get those fixes.


  • The funny thing is, I haven't. πŸ˜† I'm not sure what's going on with that. I'll look into it.

    I'm making those edits to NodeBBs forum at the minute through the console. Did notice a forum update. So will copy it over to my testing server and edit there.


  • @Developers, is there a reason why the template gets parsed on a cold load, but not when you then go back to the home page?

    Code I'm using is basically the same as it is in category.tpl, except I'm calling a new file called category_child_home.tpl instead of editing core template.

    EDIT: See here http://a5mith.kd.io:4567/


  • @a_5mith @baris @julian when user read the posts for a category A, maybe better include those posts from subcategories of A ?


  • @miluo said:

    when user read the posts for a category A, maybe better include those posts from subcategories of A ?

    So you mean when a user hovers on a sub category on the homepage, it switches the preview to posts in those child categories? Not sure teasers are included in in the child categories. Could get a bit confusing.


  • @a_5mith said:

    @miluo said:

    when user read the posts for a category A, maybe better include those posts from subcategories of A ?

    So you mean when a user hovers on a sub category on the homepage, it switches the preview to posts in those child categories? Not sure teasers are included in in the child categories. Could get a bit confusing.

    No -- I mean when user click on a category X and go to the page for that category -- there are 2 parts - 1) list of sub categories ; (2) list of topics for category X ( I mean should the topics include topics created in the subcategories of categoryX?).

    from UI perspective, it's fine for homepage use lavender theme style, but for the category page with subcategories, the style of many boxes on top of list of topics seems not good.... better make the list of sub-categories very light for example just a list of text links.....

  • GNU/Linux Admin

    @miluo That seems a good compromise -- the code itself is working, just needs theme designers to add their magic touch πŸ™‚

Suggested Topics

| |