-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
Handlebars helper or component that yields inside a specified outlet anywhere in the hierarchy #28
Comments
I really dislike this idea. It breaks the component's isolated nature and can lead to very confusing "bugs" in the application. |
I believe the fill-outlet, if it even needs to be a component, would need to break that isolated nature in order for this to work. However, the yielded data inside would be in the correct context. This seems a specific enough case to cover with unit tests such that these bugs you speak of are not a factor. |
It would be wonderful to have an elegant solution to modals in Ember. It is one of the more awkward parts of apps I've worked on. This API seems like a pretty good solution to me. |
@lukemelia check out the API for modals in liquid-fire. We could break it out as a separate thing (not dependent on any animation stuff) if there's interest. |
I've been pondering the concept of modals lately. @kcgolden or @lukemelia could you tell me why your modals needs to be rendered into a special outlet on the page? I wrote the "cookbook" on this that is in the guides, but now I'm not sure why I opted to render modals into a special outlet. I think I was mislead by the documentation that I read for disconnectOutlet @kcgolden here is what I propose for your use case. Let me know what you think: http://emberjs.jsbin.com/cisoko/6/edit
I think this pattern is more more flexible than what I originally wrote up for the guides:
I figure I'm just overlooking something, but I've not been able to think of a good reason that modals need to be rendered into a top level outlet. If there is a reason that you need your modal in a special outlet then the component & service approach seems like it would work for your use case. That's essentially what @ef4 has implemented in Liquid Fire. |
@mitchlloyd - I think the main reason my team puts modals into a single outlet at the application level is so modals of a similar priority level can overwrite each other. A user workflow dialogue only displays one at a time, error modals render above that, but only display one at a time as opposed to stacking the modals. We don't stack them in any way. |
@kcgolden I can see how that "overwriting" behavior could be useful for certain use cases. Thanks for the follow up! |
@mitchlloyd another potential shortcoming of your jsbin's approach, unless I'm missing something (quite possible), is z-index conflicts. If the containing element of the |
@davewasmer I've never heard of anything quite like the z-index conflicts you're talking about, but I've definitely been surprised by CSS more than a few times :) My current understanding is that using It might take some JSBin effort to really put this to the test, but one interesting data point is that Boostrap renders their modals right in-line from where they are launched: http://getbootstrap.com/javascript/#modals. It is interesting however that they also first put a 'backdrop' right before the |
@mitchlloyd I think you are correct that Here's a JSBin to demonstrate what I mean. It seems that CSS takes a "breadth-first" approach (for lack of a better term) to stacking, but only for elements that "qualify", i.e. In that layout, the only way to guarantee that the |
@davewasmer Wow, thanks for that great JSBin! That CSS looks like a totally valid use case. I went to see how Bootstrap handled this with their modals and I can reproduce the same issue that you're showing in your JSBin. Thanks for taking the time to put that together. I learned something here! |
We have released a solution to this problem in for ember 1.10 and higher. https://github.com/yapplabs/ember-modal-dialog/ The README has more details. |
I'm calling this feature 'wormholes' after yapp-labs :P, and am using it for https://github.com/paddle8/ember-document-title |
closing in favor of @lukemelia's comment. Thanks. |
Add support for app.import(…, {outputFile: …})
My use case is as follows:
I implemented a jsbin kind of hacking my way through what I wanted:
http://emberjs.jsbin.com/wavepo/6/edit?html,js,output
I also mentioned this to @wycats and @rwjblue in IRC where content_for from Rails was brought up, as well as a helper/component that could be placed into a component (or view) template in order to yield some content into a target outlet:
{{#fill-outlet "someOutsideOutlet"}}stuff in the current context{{/fill-outlet}}
were I to use the above implementation, I would do something like this in my component's template:
The text was updated successfully, but these errors were encountered: