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

support for referencing view in ViewState by path #365

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
5 participants
@tchak
Member

tchak commented Jan 9, 2012

No description provided.

if (typeof view === 'string') {
view = getPath(view);
if (view) {
this.set('view', view);

This comment has been minimized.

@pangratz

pangratz Jan 9, 2012

Member

why are you setting the view again when it is removed a few lines below?

This comment has been minimized.

@tchak

tchak Jan 9, 2012

Member

For caching purpose. If later I reenter the state, the reference for view is there

This comment has been minimized.

@pangratz

pangratz Jan 9, 2012

Member

ok, I was just confused. because the view is already set in enter state ...

This comment has been minimized.

@tchak

tchak Jan 9, 2012

Member

hmm, this is true :) You are probably right...

This comment has been minimized.

@pangratz

pangratz Jan 9, 2012

Member

i was just curious. it's a useful addition btw. i was thinking about adding a templateName property. if specified, a new Ember.View.create({ templateView: ... }) is created, so there's no overhead of creating a view where you just want to specify a template on the stateView.

This comment has been minimized.

@tchak

tchak Jan 9, 2012

Member

I could probably integrate this in to this patch. Or you prefer add it yourself?

This comment has been minimized.

@pangratz

pangratz Jan 9, 2012

Member

I think @kselden has a point with his comment.

@krisselden

This comment has been minimized.

Member

krisselden commented Jan 9, 2012

Generally things are set by path to aid templating (like itemViewClass in CollectionView for example).

If you need the view to be defined after the state is created (not sure of the use case), why not just bind it to that path?

@tchak

This comment has been minimized.

Member

tchak commented Jan 10, 2012

I almost agree, but :

App.states = Em.StateManager.create({
  viewBinding: 'App.MyView'
});

App.MyView = Em.View.create();

This will fail or I will have to use App.set...
This is juste some sugar so I understand if it is rejected.

and to answer @kselden I have some states declared this way in my core app, but the corresponding views are loaded on demand in modules initialized on state enter

@wycats

This comment has been minimized.

Member

wycats commented Jan 21, 2012

@tchak can you show some code in a simplified use case?

@tchak

This comment has been minimized.

Member

tchak commented Jan 21, 2012

Her is an example alongside with a new implementation proposition (including proposition #413 from @devinus)
https://gist.github.com/1654139

Obviously this is not how I manage my modules, but it gives an idea

@tchak

This comment has been minimized.

Member

tchak commented Jan 26, 2012

closing this for now. I will make another PR with a new proposal

@tchak tchak closed this Jan 26, 2012

@devinus

This comment has been minimized.

Member

devinus commented Jan 26, 2012

For the record, I'm interested in this too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment