b310-digital / mindwendel

Create a challenge. Ready? Brainstorm. mindwendel helps you to easily brainstorm and upvote ideas and thoughts within your team.
https://www.mindwendel.com
GNU Affero General Public License v3.0
79 stars 13 forks source link

Upgrade to functional views #356

Closed JannikStreek closed 1 month ago

JannikStreek commented 1 month ago

Further Notes

closes #357

To be migrated

The error view was removed so only the template is now left, see config.exs:

# Configures the endpoint
config :mindwendel, MindwendelWeb.Endpoint,
  render_errors: [
    view: MindwendelWeb.ErrorView,
    accepts: ~w(html json),
    layout: false
  ],

After Merge Checklist

JannikStreek commented 1 month ago

@PragTob if you want you can help here, as it's a lot of work. Unfortunately it wasn't so simple to just convert one view, merge it, create another PR for the next view. Views and the new functional components need different syntax so if code is shared everything explodes. So we have to do this imho as a whole. We do not need the perfect version, but throwing out views should be the goal.

My strategy: First, get everything working somehow so do not create fancy components for everything, just get it working for now with the new syntax. To do this, the functional components e.g. for forms and links have to be used. CSS can be added later. Also important, the Route helper is gone and the protected route feature has to be used (~p"/brainstormings")

Currently I am in the middle of the live/admin/brainstorming_live/edit.html.heex file. I already completed refactoring of the layout to the functional components code and as well the landing page (static page). You can have a look at my existing refactorings or also see all the links I have provided in the PR and the issue as documentation is sometimes a bit hard to find.

PragTob commented 1 month ago

If we wanted to get to fixing the tests the error page is probably one of the next biggest things up, as lots of tests fail with:

** (UndefinedFunctionError) function Routes.brainstorming_show_path/3 is undefined (module Routes is not available)

which is because of the error page and so I think either this hides the real error or we need tow ork on the tests not asserting against the error page :)