djangocms-frontend icon indicating copy to clipboard operation
djangocms-frontend copied to clipboard

feat: Adds BS5 modal components

Open mavoIn opened this issue 1 year ago • 9 comments

As discussed in #233 I added a modal component. It works like the cards component. Basic documentation added as well.

mavoIn avatar Aug 30 '24 13:08 mavoIn

Codecov Report

Attention: Patch coverage is 0% with 136 lines in your changes missing coverage. Please review.

Project coverage is 82.96%. Comparing base (f11feee) to head (bc44590). Report is 35 commits behind head on master.

Files with missing lines Patch % Lines
djangocms_frontend/contrib/modal/forms.py 0.00% 47 Missing :warning:
djangocms_frontend/contrib/modal/cms_plugins.py 0.00% 45 Missing :warning:
djangocms_frontend/contrib/modal/models.py 0.00% 26 Missing :warning:
...ms_frontend/contrib/modal/frameworks/bootstrap5.py 0.00% 13 Missing :warning:
djangocms_frontend/contrib/modal/constants.py 0.00% 5 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #234      +/-   ##
==========================================
- Coverage   86.93%   82.96%   -3.97%     
==========================================
  Files         120      125       +5     
  Lines        3107     3252     +145     
  Branches      330      337       +7     
==========================================
- Hits         2701     2698       -3     
- Misses        304      452     +148     
  Partials      102      102              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 30 '24 13:08 codecov[bot]

So coool! 😎 I will look into it! Can you get the pre-commit stuff sorted out meanwhile?

fsbraun avatar Aug 30 '24 13:08 fsbraun

Hi @fsbraun, it is my first pull request ever. Maybe you have to look over the code twice. 😇 I tested it locally. Meanwhile I use the forked version. Best mavoIn

mavoIn avatar Aug 30 '24 14:08 mavoIn

Hey @mavoIn ! Can I ask you to do the following things:

  • pip install ruff (if you haven't done so already) and ruff check --fix djangocms_frontend
  • Add tests in the tests folder. Please feel free to take similar tests as a blueprint. The tests are not very sophisticated but just check if the model and the rendering is working.

I hopefully will be able to test the modal in a pet project tomorrow.

fsbraun avatar Aug 30 '24 17:08 fsbraun

HI @fsbraun , Unfortunately, I have only been able to prepare a few test files for you. They are not complete. I am currently busy learning more. :D

mavoIn avatar Aug 30 '24 18:08 mavoIn

Also, can you take a look at the import issue showing up in tests? And the migrations seem not up-to-date. You may update the initial migration - they are DB no-ops anyways.

fsbraun avatar Sep 11 '24 10:09 fsbraun

Hello @fsbraun, thanks a lot for all your advices. I added the missing migrations and updated the documentation.

There are problems importing the tests because I was only able to insert a code framework from the collapse example. Please let me know so that you can fix the tests or I might have to ask friends for further support.

Best mavoIn

mavoIn avatar Sep 12 '24 06:09 mavoIn

@mavoIn I see you have updated quite a few things! Thank you. Still, the tests are failing. Try running them locally: python ./run_tests.py. There seems to be an import issue, an attribute issue and maybe some tweaking for the migrations required.

fsbraun avatar Nov 10 '24 11:11 fsbraun

I have some concerns about the structure:

  • Modal triggers should be possible anywhere on a page
  • The Modal plugin is not needed as far as I can see. I think the <div class="modal"></div> can go into the modal container.
  • I still would need to understand a use case with a static trigger. Can you give an exmaple?

Hi @fsbraun, what do you exactly mean with static trigger? Do you mean the requirement of the trigger inside the modal component? From my perspective i want to prevent user errors by using the loosely coupled modal trigger like it is done in the collapse example.
Best mavo

mavoIn avatar Nov 12 '24 21:11 mavoIn