it would be great if you could add some examples / best practice on how to use backbone.epoxy with framewoks like marionett.js to your readme. i think that would help a lot to get started.
here is my approach (thanks to Dan), which is kind of complex... but you can strip it down further:
initiate a new user form view with:
view = new App.UserApp.Fields.View(model: user)
App.UserApp.Fields.View is a specific form view for the user scope and extends from the the common used App.Views.FieldsView
i'm going to use Backbone.Epoxy only in my form views, that's why i have specific Fields.View. You could easily extend a base Views.ItemViewto include epoxy in all of your itemviews.
i think another solution would be to overwrite the marionette.view.js to extend directly from Backbone.Epoxy.View. Not sure if that would work...
another idea could be to provide a Backbone.Marionette.EpoxyView class, similar to spin.js provides a jquery plugin. an example is Marionette.BossView.js which would be as simple as:
Which can be used as: new Backbone.Marionette.EpoxyView() (i did not test this, but it should work...)
Maybe you can give me some feedback in case i missed something...
Same for Backbone.Model if you can't extend from Backbone.Epoxy.Model directly
class Model.Base extends Supermodel.Model
constructor: ->
# make sure you call **constructor** from extended class if overridden
Supermodel.Model.prototype.constructor.apply(@, arguments)
@epoxify()
epoxify: ->
Backbone.Epoxy.Model.mixin(@)
@initComputeds()
Hey
it would be great if you could add some examples / best practice on how to use backbone.epoxy with framewoks like
marionett.js
to your readme. i think that would help a lot to get started.here is my approach (thanks to Dan), which is kind of complex... but you can strip it down further:
initiate a new user form view with:
App.UserApp.Fields.View
is a specific form view for the user scope and extends from the the common usedApp.Views.FieldsView
We define
App.Views.FieldsView
to be used in our app which includes backbone.epoxy fuctionality.i'm going to use Backbone.Epoxy only in my form views, that's why i have specific
Fields.View
. You could easily extend a baseViews.ItemView
to include epoxy in all of your itemviews.i think another solution would be to overwrite the marionette.view.js to extend directly from
Backbone.Epoxy.View
. Not sure if that would work...another idea could be to provide a
Backbone.Marionette.EpoxyView
class, similar to spin.js provides a jquery plugin. an example is Marionette.BossView.js which would be as simple as:Which can be used as:
new Backbone.Marionette.EpoxyView()
(i did not test this, but it should work...)Maybe you can give me some feedback in case i missed something...
Same for
Backbone.Model
if you can't extend fromBackbone.Epoxy.Model
directly