backbone.modal icon indicating copy to clipboard operation
backbone.modal copied to clipboard

marionette behaviors

Open linus-amg opened this issue 10 years ago • 5 comments

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 avatar Oct 02 '15 12:10 linus-amg

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

linus-amg avatar Oct 02 '15 12:10 linus-amg

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

linus-amg avatar Oct 02 '15 12:10 linus-amg

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.

jeff-h avatar Feb 15 '16 02:02 jeff-h

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

emudojo avatar Feb 29 '16 21:02 emudojo

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.

jimf avatar Oct 03 '17 01:10 jimf