Skip to content

Instantly share code, notes, and snippets.

@mauler
Created November 14, 2012 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauler/4075039 to your computer and use it in GitHub Desktop.
Save mauler/4075039 to your computer and use it in GitHub Desktop.
(function(){
var Model = {}
Model.make = function(model_name) {
var model = {}
model.getByID = function(id, fn) {
JSONP.getByID(model_name, id, fn);
}
model.list = function(params, fn){
// NOTE: brasiltotal
params.exclude__codigonoticia__exact = '';
params.exclude__codigonoticia__isnull= true;
if (params.destino != null)
{
params.destino__nome = params.destino;
params.destino = null;
}
JSONP.list(model_name, params, fn)
}
return model;
}
window.Hotel = Model.make("hotel");
window.Passeio = Model.make("passeio");
window.Pacote = Model.make("pacote");
window.Ingresso = Model.make("ingresso");
window.Restaurante = Model.make("restaurante");
window.Transfer = Model.make("transfer");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment