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: () -> sb = @speech_balloon() sb.fetch({cache: true}).done => sbt = sb.speech_balloon_template() sbt.fetch({cache: true}).done => sp = sbt.system_picture() sp.fetch({cache: true}).done => @symbol_picture = sp.tmb_opt_img_tag() @trigger('ready:symbol') initialize: () -> if @id @url = @url + @id @bind('change:width', () -> console.log('cng') )