-
-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support flash messages [integrate #62] #43
Comments
Definitely yes! I skipped this for now because I wasn't ready to design good flash helpers myself. Any more good precedents very welcome. |
Another precedent that might be of interest is Django's messages framework. Below is my quick summary of that page. Messages have three main parts: The body of the message, which is a string, the level ( The two functions application developers are expected to use to manage messages look like:
the latter gives you a list of messages to iterate over. There are also convenience functions for creating messages at a particular level (e.g. By default all of the flash messages get cleared when a response is processed (so they only show up once) but the framework allows app developers to mark a message so that it won't be cleared. I'm interested in helping with this issue, if I can. That could mean continuing to research other precedents or putting together a prototype PR for discussion. |
Thanks @jsthomas, that saved a lot of research time for me! I would welcome a prototype PR. |
@jsthomas The example now has a writeup, is in the playground, and I finished up the docs for the feature. Thanks again for actually implementing it in #62! |
Awesome! This comment in the example is helpful, I learned something new here:
|
Flash messages are a common way to display success or error notifications to users in server-side rendered applications.
Dream already has a middleware to support sessions, which Flash messages are a specialization of, so it would be great to have a middleware and a set of API to support flash messages.
Additionnally, helpers to add flash messages in Eml templates would be really useful. For reference, here's Phoenix documentation on this: https://hexdocs.pm/phoenix/controllers.html#flash-messages. The templates look like this:
The text was updated successfully, but these errors were encountered: