class Pettanr.SpeechBalloon extends Peta.Element url: '/speech_balloons/' @singular: () -> 'SpeechBalloon' @plural: () -> 'SpeechBalloons' defaults: { id: null, z: null, t: null } @pick_item_name: () -> 'speech_balloon_template' @traceable_item_names: () -> ['speech', 'balloon'] trace_from_speech: () -> trace_from_balloon: () -> 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') } panel: () -> new Pettanr.Cache.Retriever(Pettanr.Panel, @get('panel_id')) speech_balloon_template: () -> new Pettanr.Cache.Retriever(Pettanr.SpeechBalloonTemplate, @get('speech_balloon_template_id')) @has_picture: () -> false symbol_option: () -> retriever = @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()) filer_caption: () -> retriever = @retriever() @listenTo(retriever, 'retrieve', @retrieve_filer_caption) retriever.retrieve() retrieve_filer_caption: (item) -> caption = item.escape('caption') @trigger('ready:caption', caption) plain_scenario: () -> @get('caption') element_face: () -> new Pettanr.Views.SpeechBalloon.ElementFace({element: this}) initialize: (attr, options) -> super(attr, options) if @id @url = @url + @id