Skip to content

Conversation

@sebn
Copy link

@sebn sebn commented Aug 22, 2014

This PR allows you to define flash messages in templates, and to render them with whatever controller you want.

This has some advantages:

  • You can put custom markup in your templates: images, titles, links...
  • You can bind some template tags to custom controller actions (e.g. "undo")
  • If you think flash is a "view" thing (as I do), you can move it from the control layer to the view one
  • You can still put a simple text message with some helper handling all the default markup

Of course, the text-oriented API still works.

I have a working implementation, but it may deserve some refactoring:

  • Extract a message model, maybe with some isTextMessage() method?
  • Maybe find a better name to the flash() method... flashTemplate()? Any idea?
  • DRY the route mixin
  • Don't have to create a custom object when calling from a controller... by providing some mixin too?

WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant