class Pettanr.Speech extends Peta.Element url: '/speeches/' @singular: () -> 'Speech' @plural: () -> 'Speeches' defaults: { id: null, x: 0, y: 0, width: 100, height: 100 } pick: (templates) -> # speech_balloon_template = templates.speech_balloon_template writing_format = templates.writing_format { speech_balloon_template_id: speech_balloon_template.get('id'), speech_balloon_template_module_name: speech_balloon_template.get('module_name'), writing_format_id: writing_format.get('id'), writing_format_module_name: writing_format.get('module_name'), } speech_balloon: () -> new Pettanr.Cache.Retriever(Pettanr.SpeechBalloon, @get('speech_balloon_id')) writing_format: () -> new Pettanr.Cache.Retriever(Pettanr.WritingFormat, @get('writing_format_id')) @text_align_texts: () -> ['left', 'left', 'right', 'center'] 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()) text_align_text: () -> Pettanr.Speech.text_align_texts()[@get('text_align')] scenario: () -> @boosts('read') @render(@escape('content')) initialize: (attr, options) -> super(attr, options) if @id @url = @url + @id