wheely / ember-dialog

An Ember Addon able you to easily create routable dialog windows
http://wheely.github.io/ember-dialog/
MIT License
37 stars 12 forks source link

Fixing template property deprecation, so the addon can work with latest ember v2.10.0 #88

Closed waleedq closed 7 years ago

waleedq commented 7 years ago

Hello,

It appears that the component's template property is deprecated from v1.x api but there was no any deprecation messages about using it, and it have been replace with the layout property. to fix this issue in v2.10.0 the partial helper should be used to render the given template inside the dialog layout

this PR should fix this issue https://github.com/wheely/ember-dialog/issues/87

Thank You,

ivandokov commented 7 years ago

Maybe you should also change the README file to show the layout changes

ajile commented 7 years ago

Recently I do not have spare time to review and apply PR. I will try to do that tomorrow. I'm sorry about it.

ajile commented 7 years ago

I tried to run some examples from the dummy (in russian version) and found a problem - partial helper is not working with precompiled template. Occurs an internal exception:

Error while processing route: index Could not find a partial named "[object Object]"
Error: Could not find a partial named "[object Object]"

That happens because the partial helper expects a string, but gets an object (precompiled template). You can reproduce it so:

import Ember from "ember";
import hbs from 'htmlbars-inline-precompile';

export default Ember.Controller.extend({
  init() {
    this.get("dialog").alert(hbs`Hello world`);
    return this._super(...arguments);
  }
});

I need time to research Glimmer to find way to fix it. For now I don't know how Glimmer works.

ajile commented 7 years ago

I've reproduced problem on ember-twiddle.

ajile commented 7 years ago

After talking with community in slack, I've found solution to paste prerendered template into the presenter's body. I've created one more component (presenter-body) that gets template as layout. From now if template is a string - it's introduced into the presenter's body as a partial, otherwise it introduced as a presenter-body component.

@waleedq, could you review and accept PR waleedq/ember-dialog#6 if all fine.

waleedq commented 7 years ago

@ajile Sorry for being late, i've tested the PR and it works totally fine it's merged now, please check it out and let me know

ajile commented 7 years ago

@waleedq thank you! Everything works well. I'm going to merge PR and release stable version.