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 } pick: (templates) -> # speech_balloon_template = templates.speech_balloon_template { speech_balloon_template_id: speech_balloon_template.get('id'), speech_balloon_template_module_name: speech_balloon_template.get('module_name'), speech_balloon_template_settings: speech_balloon_template.get('settings') } speech_balloon: () -> new Pettanr.Cache.Retriever(Pettanr.SpeechBalloon, @get('speech_balloon_id')) system_picture: () -> new Pettanr.Cache.Retriever(Pettanr.SystemPicture, @get('system_picture_id')) r_url: () -> '/system_pictures/' + @system_picture().filename() symbol_option: () -> retriever = @speech_balloon() @listenTo(retriever, 'retrieve', @retrieve_speech_balloon) retriever.retrieve() retrieve_speech_balloon: (speech_balloon) -> retriever = speech_balloon.speech_balloon_template() @listenTo(retriever, 'retrieve', @retrieve_speech_balloon_template) retriever.retrieve() retrieve_speech_balloon_template: (speech_balloon_template) -> retriever = speech_balloon_template.system_picture() @listenTo(retriever, 'retrieve', @retrieve_system_picture) retriever.retrieve() retrieve_system_picture: (system_picture) -> @trigger('ready:symbol', system_picture.tmb_opt_img_tag()) initialize: (attr, options) -> super(attr, options) if @id @url = @url + @id @bind('change:width', () -> console.log('cng') )