hovel / pybbm

Django forum solution. Tested, documented, shipped with example project.
BSD 2-Clause "Simplified" License
225 stars 151 forks source link

missing CSS and HTML when app used as part of a larger project #282

Closed FlorianDietz closed 6 years ago

FlorianDietz commented 6 years ago

I tested the example_thirdparty and everything worked fine and looked great.

When installing the app in my existing project, I can use it, but several things are off. At first I thought I was just missing CSS, but it actually looks like the classes do not get set at all.

In example_thirdparty, there are classes like markItUpContainer and markItUpHeader. These classes are missing entirely in the larger project.

Also, perhaps relatedly (?), I can't use smileys when using pybbm as an app in my larger project. Clicking on them does nothing, whereas clicking on them causes the corresponding character sequence to be added to the text when I do so in example_thirdparty. Could this be because Javascript is not working properly? My browser's console does not display any error messages, though.

lampslave commented 6 years ago

https://docs.djangoproject.com/en/1.11/topics/forms/media/

FlorianDietz commented 6 years ago

I'm sorry, but I don't understand what I need to do. I read that website, but I don't understand why I need it. I thought pybbm was going to work out of the box after following the instructions here https://pybbm.readthedocs.io/en/latest/install.html

Is there a tutorial describing what else I need to do? I couldn't find any further information anywhere.

lampslave commented 6 years ago

Base template from example_thirdparty extends template from pinax-theme-bootstrap<6.0 which contains some css and js.

Also read this: https://pybbm.readthedocs.io/en/latest/markup.html (I guess your base template doesn't contain {{ form.media }}).

lampslave commented 6 years ago

Another example project: https://github.com/hovel/pybbm_org

FlorianDietz commented 6 years ago

Thanks, I think this will help a lot. One question though: The documentation on markup says "To get it working in your templates include {{ form.media }} or {{ form.media.css }} / {{ form.media.js }} in proper place in every template where you use post form."

What is 'the proper place'? I just put that tag at the beginning of the document and that got the smileys working. Is there something else that only starts working if I put it in specific places, and if so, where should I put those tags and how can I do so automatically?

lampslave commented 6 years ago

https://stackoverflow.com/questions/6625773/where-should-i-put-the-css-and-javascript-code-in-an-html-webpage

FlorianDietz commented 6 years ago

so {{ form.media }} just turns into a js/css import? I thought it was code that needs to be applied to each form element. Thanks!

lampslave commented 6 years ago

Not for each form element (<form>), but for each form in template context ({{ login_form }} {{ post_form }}, etc.) if you have it.