Skip to content
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

Pass id and class name from mark-up to view creator function #21

Closed
joholo opened this issue May 22, 2014 · 2 comments
Closed

Pass id and class name from mark-up to view creator function #21

joholo opened this issue May 22, 2014 · 2 comments

Comments

@joholo
Copy link

joholo commented May 22, 2014

The template of the parent view has the placeholder div, and is responsible to place the div in the correct place in parent view. That is, the parent view owns the styling of the placeholder div itself, and the subview owns the mark-up and styling of anything inside the subview. (Separation of concern.)

Backbone allows this by the special options, e.g. id, and class, that can be passed and attached to the subview upon creation.

For backbone.subviews, it would be great if we, in a more declarative way, can allow the placeholderDiv to accept the id and class attributes and pass them to the creator function.

@dgbeck
Copy link
Member

dgbeck commented May 22, 2014

Hi @joholo , thanks for the PR! There have been several other people who want access to the place holder div in the subview creator function, see #12 and #18. We have resisted adding this functionality as we do not think it is the cleanest pattern but it seems to be in high demand. I don't want to hold people back from doing things the way they see fit. We'll do a patch shortly that incorporates this functionality and also allows you to override how subviews are created as described in #20 (and currently available on https://github.com/rotundasoftware/backbone.subviews/tree/override-creator).

Thanks very much for your feedback and contribution.

@joholo
Copy link
Author

joholo commented May 23, 2014

Great! That would take care of passing the ID and class (along with anything else) to the subview creator function.

Thank you for providing such a great plugin. With the new patch we can stop rolling our own way of creating subviews.

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

No branches or pull requests

2 participants