Sha256: 326ae4c1d652b5f4a2a4d0cf17c89983fce3b5e60883ece83f87d853eb05d003
Contents?: true
Size: 1.17 KB
Versions: 84
Compression:
Stored size: 1.17 KB
Contents
var EntityMap = function(data){ this.id = data.id this.name = data.id this.type = data.type this.column = data.column this.full_type = function(){ return this.type } this.url = function(){ var url = "/entity_map/" + this.full_type() + "/" + clean_element(this.column) + "/" + clean_element(this.id) return url } this.get = function(){ var url = this.url() url = add_parameter(url, '_format', 'json') return rbbt.ajax({url: url, method: 'GET'}) } } var FavouriteMaps = function(by_type){ for (type in by_type){ this[type] = by_type[type] } } FavouriteMaps.get = function(){ return rbbt.ajax({method: 'GET', url: '/favourite_entity_maps', type: FavouriteMaps, deserialize: FavouriteMaps.deserialize}) } FavouriteMaps.deserialize = function(data){ data = JSON.parse(data) favourite_maps = {} forHash(data, function(type, type_data){ favourite_maps[type] = {} forHash(type_data, function(column, column_data){ forArray(column_data, function(id){ var info = {} info.id = id info.column = column info.type = type favourite_maps[type][id] = new EntityMap(info) }) }) }) return favourite_maps }
Version data entries
84 entries across 84 versions & 1 rubygems