|
|
|
|
|
by MatthewPhillips
5419 days ago
|
|
Their framework is intended solely for coffeescript devs. Here's their example in javascript: (function() {
var Shopify;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
Shopify = (function() {
function Shopify() {
Shopify.__super__.constructor.apply(this, arguments);
}
__extends(Shopify, Batman.App);
Shopify.root('products#index');
Shopify.resources('products');
return Shopify;
})();
Shopify.Product = (function() {
function Product() {
Product.__super__.constructor.apply(this, arguments);
}
__extends(Product, Batman.Model);
Product.persist(Batman.RestStorage);
return Product;
})();
Shopify.ProductsController = (function() {
function ProductsController() {
ProductsController.__super__.constructor.apply(this, arguments);
}
__extends(ProductsController, Batman.Model);
ProductsController.prototype.index = function() {
return this.redirect({
action: 'show',
id: 1
});
};
ProductsController.prototype.show = function(params) {
return this.product = Shopify.Product.find(params.id);
};
return ProductsController;
})();
}).call(this); |
|