machty / emblem.js

Emblem.js - Ember-friendly, indented syntax alternative for Handlebars.js
http://emblemjs.com
MIT License
1.04k stars 81 forks source link

View documentation incorrect as of Ember 1.8 / views possibly unsupported? #178

Closed lwisne closed 6 years ago

lwisne commented 9 years ago

Before Ember 1.8 came out, I could do:

Ember.Select content=options value=value

And this is how all the emblem guides suggest I should do things. Now, doing that gives a deprecation warning:

"Resolved the view "Ember.Select" on the global context. Pass a view name to be looked up on the container instead, such as {{view "select"}}. http://emberjs.com/guides/deprecations#toc_global-lookup-of-views-since-1-8"

I read the guide on this, but I simply cannot get the new syntax to work in any way within emblem. I'm not even sure it's supported at all. Please advise - I can't be using a tempting engine that gives scary deprecation warnings on such basic functionality.

machty commented 9 years ago

@lwisne can you try

= view 'select' content=options value=value
lwisne commented 9 years ago

That actually works. My example was not a terribly good one, because I'm actually having this problem with Ember.TextField or any custom view. Didn't realize it works for vanilla selects (I use a subclass with some modifications).

Sorry about that. Here's something that gives the same deprecation but doesn't appear to have an obvious resolution:

Ember.TextField value=value

I know the suggested Ember way to do this for a while has been with the input view helper, but that doesn't work in emblem because of clash with the native input tag. The obvious solution in emblem,

= view 'input' value=value

doesn't work.

machty commented 9 years ago

I think it'd be

= input value=value

Lines preceded with = are always interpreted as helper invocations.

lwisne commented 9 years ago

That works. I think this covers all the cases I was having trouble with. Probably worth updating the documentation!

Old:

Ember.Select content=options value=value

New:

= view 'select' content=options value=value

Old:

Ember.TextField value=value

New:

= input value=value

Old:

Ember.Checkbox value=value

New:

= input type="checkbox" value=value

Old:

MyCustomView param1=value

New:

= view 'my-custom' param1=value

Note on the last case: I think this change actually made it impossible to have a view class without the suffix "-View". This is an Ember, not Emblem thing. Really fun to figure that one out with trial and error for those of us who subclassed Ember.Select with something like Ember.CustomSelect.

machty commented 9 years ago

@lwisne while it's fresh on your brain could you please put in a PR to https://github.com/machty/emblem-site for some of these docs?

lwisne commented 9 years ago

done. Thanks for the help, and for maintaining the gem!

thec0keman commented 6 years ago

Closing in favor of #281