class Pettanr.Balloon extends Peta.Element url: '/balloons/' @singular: () -> 'Balloon' @plural: () -> 'Balloons' defaults: { id: null, x: 0, y: 0, width: 100, height: 100, r: 0 } speech_balloon: () -> new Pettanr.SpeechBalloon({id: @get('speech_balloon_id')}) system_picture: () -> new Pettanr.SystemPicture({id: @get('system_picture_id')}) r_url: () -> '/system_pictures/' + @system_picture().filename() symbol_option: (cb) -> sb = @speech_balloon() sb.fetch().done -> sbt = sb.speech_balloon_template() sbt.fetch().done -> sp = sbt.system_picture() sp.fetch().done -> cb(sp.tmb_opt_img_tag()) initialize: () -> if @id @url = @url + @id class Pettanr.Balloon.Collection extends Backbone.Collection model: Pettanr.Balloon url: '/balloons'