|
'proposed module structure |
|
|
|
1. widgets are modules |
|
2. widgets have resources(models/views/controllers) that are owned by the widget (other modules cant access because they are declared privately) |
|
3. widgets can share resources when they are declared and registered via a "manager" (mint.widget,mint.model). shared resources are declared outside of the scope of the module |
|
4. dependency management can include modules which include their resources and their resources dependencies |
|
5. at the mint level, each store has a directory which holds widget overrides for a widget, or a widget resource.' |
|
|
|
proposed structure: |
|
|
|
.. src |
|
`-- models // shared resources |
|
`-- store_widgets |
|
| `-- homemint |
|
| `--checkout_form |
|
| `-- models |
|
| `-- model.coupon.js |
|
| |
|
`-checkout_form |
|
`--models |
|
`--- model.coupon.js |
|
`--views |
|
`-- view.coupon.js |
|
`--controllers |
|
`forms.js |
|
|
|
|
|
// src/widgets/checkout_form/models/model.coupon.js |
|
exp.CouponModel = ready.model.Base.extend({ |
|
initialize:function(){} |
|
}); |
|
|
|
// src/store_widgets/homemint/checkout_form/models/model.coupon.js |
|
exp.CouponModel = CouponModel.extend({ |
|
initialize:function(){ alert("hello world")} |
|
}); |
|
|
|
// src/widgets/checkout_form/form.js |
|
mint.widget.register('checkout-form',{ |
|
dependencies:{ |
|
model:{ |
|
Base:"model/model.Base.js" |
|
} |
|
}, |
|
init:function(){ this.loadDependencies();} |
|
ready:function(errors,data){ |
|
var resources = populate(data); |
|
this.CouponModel = new resources.CouponModel(); |
|
} |
|
}); |
|
|
|
|
|
// js.php turns a modules directory into something like. |
|
(function(){ |
|
var populate = function(ready){ |
|
var exp = {}; |
|
exp.CouponModel = ready.model.Base.extend({ ... |
|
.... |
|
exp.CouponView = Backbone.View.extend({... |
|
.... |
|
|
|
// start store specific loading of resources |
|
exp.CouponModel = CouponModel.extend({ ... |
|
.... |
|
|
|
return exp; |
|
} |
|
|
|
mint.widget.register('checkout-form',{ ..... |
|
..... |
|
ready:function(errors,data){ |
|
var resources = populate(this,data); |
|
|
|
// should alert "hello world" from mint specific overwritten resource |
|
this.CouponModel = new resources.CouponModel(); |
|
|
|
} |
|
..... |
|
}); |
@8bitDesigner would likely play out very differently depending on how we implemented decorators and / or widgets on a page... I was envisioning a view file looking something like:
And in
xmint/util/carousel.js
:Which I realize seems verbose, but also means that we can mix and match features by mint without having to modify code too much, and common views like a row or image caption could be reused. Also what we wouldn't see any more are essentially duped templates for every mint (though Jeremy probably already helped quite a bit with that).