jimsynz / hamlbars

Some extensions to HAML to allow generation of Handlebars templates.
https://github.com/jamesotron/hamlbars.git
MIT License
179 stars 43 forks source link

New {{action}} syntax in Ember #29

Closed joliss closed 12 years ago

joliss commented 12 years ago

The syntax of the {{action}} helper was recently changed (83b7a61a), so Hamlbars doesn't work with Ember master anymore.

Should we just update it to use the context option as the first argument to {{action}}?

I'm honestly a bit unhappy with the verbosity of our current syntax, so I wonder if we should improve it along with this change.

Right now we have

event: {action: 'edit', context: 'model'}

to yield

{{action edit context="model"}} // old
{{action edit model}} // new

How about this instead?

action: 'edit model'

So there's no surrounding event. We lose the ability to have multiple actions, but at least in Ember, this isn't supported anyway to my understanding.

Options could be inline, like so:

action: 'edit model href=true'
joliss commented 12 years ago

I'm volunteering a PR btw. Let me know what you think.

jimsynz commented 12 years ago

That sounds great. It's pretty easy to support both the old and proposed syntaxes by just testing for hashiness. Go for it :)

artzte commented 12 years ago

There is an unfortunate collision with form action attributes with this. How about calling it ember-action or just use the old event keyword with a plain string with the new syntax?