Team-Tea-Time / laravel-forum

A slim, lean forum package designed for quick and easy integration in Laravel projects
https://laravel-forum.teamteatime.net/
MIT License
601 stars 165 forks source link

Blade-bootstrap preset not working #373

Closed froid24 closed 4 months ago

froid24 commented 4 months ago

Hi, I've installed the forum (6.0.7) with the blade-bootstrap UI preset and it is not working properly. When editing a category, I get the following error when saving:

Class "TeamTeaTime\Forum\Actions\UpdateCategory" not found

Also, the Edit category popup does not look as in your demo, there is no light/dark colors, only one color which, by the way, does not get saved when the category is created.

When I try to create a first discussion in a new category (and when I try to view/show it afterwards), I get the following error: Undefined variable $threadDestinationCategories in \resources\forum\blade-bootstrap\views\thread\show.blade

Also, there was a js problem after installing npm dependencies as vuedraggable should now be included as vuedraggable@next, apparently. That solved the js error.

I hope you can help me overcome the edit category problem. Could it be that the preset files are not fully updated?

Thank you!

Riari commented 4 months ago

Hey,

I've just merged some PRs that should fix most of these issues. You can get them with the new release, 6.0.8.

The only issue I couldn't replicate was the one concerning creating the first discussion in a new category. Can you provide more details? Does this happen when you have only one category, for example?

Edit: Also, to clarify, the two Blade presets (Bootstrap and Tailwind) don't ship with any dark mode functionality, so they only expose one color (color_light_mode) for the categories.

froid24 commented 4 months ago

Hi,

Thank you so much for the help!

I upgraded to 6.0.8 and re-installed the blade-bootstrap UI preset (for changes made to the views).

  1. The problem when saving a category after edit is now fixed (no more error). However, the color problem is not solved, but actually the color picker disappeared (see attached printscreen) in the new/edit modal.

  2. The problem when creating a new discussion was actually happening after creation (the discussion gets created), when it was trying to show the thread (that's why I also mentioned the show operation giving the same error); here attached is a printscreen of the error when trying to display any thread.

  3. I see the categories can be nested (have subcategories), yet when creating/editing I see no way to specify this relationship between categories. Am I wrong?

I hope this helps fixing the issues. I'm looking forward to your reply.

Many thanks!

image

image

Riari commented 4 months ago

Sure, happy to help!

For the first issue, have you cleared cached views and rebuilt the frontend? I modified the views, but also the JS files that ship with the presets so that the Pickr init code would target the updated colour inputs.

For the second issue, I wasn't able to replicate that at all. I created a new thread and got redirected to it without any errors, so there must be something different about your setup. I can try to dig deeper over the weekend, but any potentially relevant details that you haven't included so far would be useful.

For the third one, you can't specify a category's position in the tree when creating or editing it, but the creation is context aware (or should be - if you use the category creation modal while viewing a category, it will insert the new one as a child of the one you're viewing). For more detailed control, there's the page for managing/reordering categories.

I'm definitely open to improving UI/UX around that though!

froid24 commented 4 months ago

Regarding the color picker, you were right, I forgot to run "npm run build". Color is saved now, so this is solved.

The thread show still doesn't work though (so unrelated to creating it; just click on any thread to view it gives the error). The variable $threadDestinationCategories is not passed on to the view from the ThreadController (as shown in the 2 printscreens attached). The controller passes on a 'categories' variable, while the show blade expects 'threadDestinationCategories' to be set. I tried renaming the variable in the show blade file, and the error goes away as expected, but nothing is shown in the page, the thread show page is empty (only the breadcrumbs are shown, see 3rd screenshot), because there seems to be a js error (see printscreen 4).

Regarding the reordering of categories, they are not draggable in the Manage page. Should they be, like in the livewire demo on your site?

Thank you.

image

image

image

image

Riari commented 4 months ago

I don't doubt there is a problem in the code somewhere, but like I said, I wasn't able to replicate the error despite testing with the same version of the controller and view in question. I'll have to take a closer look.

The Manage view should allow you to drag and drop the categories, yes - I'll investigate both of these issues tonight and get back to you!

Riari commented 4 months ago

OK, good news! It turns out I was testing with the blade-tailwind preset, which doesn't have these issues. Tested with blade-bootstrap and was able to replicate and fix the issues relating to the thread.show view.

The drag and drop on the Manage page does work for me in the blade-bootstrap preset, so I'm not sure what's causing it not to work for you. I did fix an issue with the Vue selector for the navbar being incorrect, but that had no effect on the Manage component in my tests.

Anyway, I've pushed another patch release with the other fixes. Be sure to do npm run build again after updating. Let me know how it goes.

froid24 commented 4 months ago

Great! The php/laravel error is gone, indeed. The page shows up just fine now (at first, I forgot to re-install the preset after update, but now it works).

Edited again, it seems the categories are draggable, I was misled by the fact that the pointer did not change in any way (my brain was expecting it to change to a little hand or something :) ). The only inconvenient (but not really a problem) is that you cannot make a category a subcategory of another by drag'n'drop (once you take a subcategory out of its parent, you cannot bring it in again).

All good! I'm very happy with how it works! Thank you so much for the help!

Riari commented 4 months ago

Great, I'm glad it's working for you now!

I've just pushed one more release with some improvements to the 'Manage' view for both blade-bootstrap and blade-tailwind. It should now work correctly and be easier to use overall.

I'll close this now, but feel free to open another issue if you run into any further problems.