X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fspeech.js.coffee;h=cfe1da7c45f37a89a889e86c0b0c84dbad1a32f7;hb=810b67011df66ced6300f0891d38c8db0ed12803;hp=3a131e63df53ab8aa7bcaee94ab068ae4543ce99;hpb=bb97922e3c1f43e4af22fc8a7c8ebd202e64be82;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/models/speech.js.coffee b/app/assets/javascripts/models/speech.js.coffee index 3a131e63..cfe1da7c 100644 --- a/app/assets/javascripts/models/speech.js.coffee +++ b/app/assets/javascripts/models/speech.js.coffee @@ -15,30 +15,47 @@ class Pettanr.Speech extends Peta.Element 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'), + speech_balloon_template_settings: speech_balloon_template.get('settings') + writing_format_id: writing_format.get('id'), + writing_format_module_name: writing_format.get('module_name'), + writing_format_template_settings: writing_format.get('settings') + } + speech_balloon: () -> new Pettanr.SpeechBalloon({id: @get('speech_balloon_id')}) + writing_format: () -> + new Pettanr.WritingFormat({id: @get('writing_format_id')}) + @text_align_texts: () -> ['left', 'left', 'right', 'center'] symbol_option: (cb) -> sb = @speech_balloon() - sb.fetch({cache: true}).done -> + sb.fetch({cache: true}).done => sbt = sb.speech_balloon_template() - sbt.fetch({cache: true}).done -> + sbt.fetch({cache: true}).done => sp = sbt.system_picture() - sp.fetch({cache: true}).done -> - cb(sp.tmb_opt_img_tag()) + sp.fetch({cache: true}).done => + @trigger('ready:symbol', sp.tmb_opt_img_tag()) text_align_text: () -> Pettanr.Speech.text_align_texts()[@get('text_align')] scenario: () -> @boosts('read') - @render(@get('content')) + @render(@escape('content')) - initialize: () -> + initialize: (attr, options) -> + super(attr, options) if @id @url = @url + @id