bootstrap.txt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. 1 Bootstrap
  2. -----------
  3. 1.1 Add css or js file
  4. ~~~~~~~~~~~~~~~~~~~~~~
  5. You can add you .js file or .css file with flask-assets
  6. .. code-block:: python
  7. maple = Bootstrap(css=('style/xxx.css',),js=('style/xxx.js',))
  8. maple.init_app(app)
  9. Or you can add js or css in **templates**
  10. .. code-block:: html
  11. {% block style -%}
  12. {{super()}}
  13. You css file
  14. {% endblock -%}
  15. {% block script -%}
  16. {{super()}}
  17. You js file
  18. {% endblock -%}
  19. 1.2 use auth extension
  20. ~~~~~~~~~~~~~~~~~~~~~~
  21. If you want use maple auth extension,you need set
  22. .. code-block:: python
  23. Bootstrap(app,use_auth=True)
  24. But before it,you need register csrf,beacuse ajax need csrf.
  25. .. code-block:: python
  26. from flask_wtf.csrf import CsrfProtect
  27. csrf = CsrfProtect()
  28. csrf.init_app(app)
  29. 1.3 Other block
  30. ~~~~~~~~~~~~~~~
  31. .. code-block:: html
  32. {% block title -%}
  33. {% endblock -%}
  34. 1.4 Custom footer
  35. ~~~~~~~~~~~~~~~~~
  36. The footer file in **templates/maple/footer.html**,you can custom it.
  37. .. code-block:: html
  38. <div class="footer text-center">
  39. custom content
  40. </div>