Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Using a popover's contentViewClass with ember-cli #103

Open
jkatsnelson opened this issue Sep 4, 2014 · 5 comments
Open

Using a popover's contentViewClass with ember-cli #103

jkatsnelson opened this issue Sep 4, 2014 · 5 comments

Comments

@jkatsnelson
Copy link

Hi there,

As it is currently written, ember-widgets resolves views in a way that isn't very compatible with ember-cli:

from popover-link-popover.hbs:

<div class="popover-content">
  {{view view._contentViewClass}}
</div>

from popover_link.coffee:

  _contentViewClass: Ember.computed ->
    contentViewClass = @get 'contentViewClass'
    if typeof contentViewClass is 'string'
      return Ember.get contentViewClass
    contentViewClass
  .property 'contentViewClass'

I couldn't figure out any way to resolve an ember-cli view via Ember.get contentViewClass

But, there is a very easy workaround...here is an example:

{{#popover-link-component tagName="button"
  class="btn btn-primary" placement="bottom-left"
  _contentViewClass="custom-popover-content"}}
  Show Popover Button-Left
{{/popover-link-component}}

The key thing to notice is that I am overriding the computed property and just telling the component explicitly where to find the view using {{view 'custom-popover-content'}}

If the maintainers would like, I could add this to the README as a gotcha...

@jkatsnelson
Copy link
Author

Also, it appears that there is no support for the 'content' key at all?

@azirbel
Copy link
Contributor

azirbel commented Sep 4, 2014

Thanks for the post and for the workaround! Glad you were able to figure it out.

Someone recently fixed this issue in our related ember-table project: Addepar/ember-table#200. I think we should do the same thing here instead of adding a workaround to the README. Do you agree?

@alexdiliberto
Copy link

Just started using that workaround on my app for the select widget. Thanks!

@azirbel From a quick first pass, that workaround code would work fine here as well. Using a container.lookupFactory() works on any EmberCLI project and it falls back to the old global lookup in other cases.

@denispeplin
Copy link

Could please somebody provide more complete workaround example? I'm now use contentViewClass="App.OvertimeEditView", spent some time trying other variants, no success.

@denispeplin
Copy link

Ok, I got it.
So steps are:

In my case, I replaced contentViewClass="App.OvertimeEditView" with _contentViewClass="overtime-edit". It works now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants