I want to use the full gamut of Bootstrap Alert ‘types’ (and their associated colors);
primary, secondary, success, danger, warning, info, light and dark.
put_flash(:info, message) displays a Bootstrap ‘info’ alert
put_flash(:error, message) displays a Bootstrap ‘danger’ alert
I’ve tried a put_flash(:success, message) command but it results in no flash message being displayed.
Why does Phoenix translate an :error type to :danger? It results in the coloring I would have expected but wouldn’t it have been easier(?) to set the CSS class in strict accordance with the Bootstrap CSS classes? I realize that not everyone utilizes Bootstrap so they may feel a bit ‘left out in the cold’.
With the above being the case, is there a way to build a transformation process for Phoenix such that, if you are using Bootstrap, use the first argument (an atom) of the put_flash/2 function as the CSS alert-X class to be used for displaying the flash message?
put_flash(:success, "The Message") <p class="alert alert-success" role="alert">The Message</p> put_flash(:warning, "The Message") <p class="alert alert-warning" role="alert">The Message</p>