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

marionette behaviors #88

Open
linus-amg opened this issue Oct 2, 2015 · 5 comments
Open

marionette behaviors #88

linus-amg opened this issue Oct 2, 2015 · 5 comments

Comments

@linus-amg
Copy link

hey, first off.. we use backbone.modal really a lot, its so easy and has so much awesomeness, we build everything with marionette, so we are using the marionette region version of backbone.modal, I would like to know if anybody of the contributors sees an easy way to have marionette behaviors possible to define inside a new modal view, i saw that the Backbone.Modal https://github.com/awkward/backbone.modal/blob/master/src/backbone.modal.coffee#L10 extends from Backbone.View, i tried to extend from Marionette.ItemView and Marionette.LayoutView but could not make it work. any ideas?

@linus-amg
Copy link
Author

it would also be convenienent to have the marionette modelEvents, collectionEvents etc.

@linus-amg
Copy link
Author

i dont call for any change, since its a Backbone Plugin, i'm rather looking for advice to customize Backbone.Modal to accept Marionette.View instead of Backbone.View

@jeff-h
Copy link

jeff-h commented Feb 15, 2016

The project website talks about usage within Marionette, which to me implies that when using Marionette it would extend Marionette's view rather than Backbone's view. So I guess contrary to @elgubenis comment above, I do humbly ask for a change :)

Perhaps provide an optional Marionette.Modal object (which is otherwise identical, except that it extends Marionette's itemView) if Marionette is found? This would introduce no breaking changes or anything but would allow us to use all the usual Marionette goodness in our Modal views :)

Thanks again for the awesome plugin.

@emudojo
Copy link

emudojo commented Feb 29, 2016

I guess I'm in the same boat, I was thinking on Creating a VIewCollection, but it won't work due to the hardcoded backbone.view dependency

@jimf
Copy link
Contributor

jimf commented Oct 3, 2017

FWIW, I'm not thrilled with the fact that this plugin directly extends from Backbone.View. For the reasons cited here, it just makes things difficult when you need functionality from specialized Backbone views. I'm a fan of a mixin pattern that adds functionality into an existing, arbitrary instance:

const MyView = SomeArbitraryBackboneView.extend({
    initialize() {
        // Add methods/properties for modal behavior:
        Backbone.Modal.mixin(this);
    }
    // ...
});

I'd have to think some more about the specifics (for example, how dealing with naming conflicts should work), but my gut tells me such an approach should work and doesn't necessitate breaking changes.

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

4 participants