OSDN Git Service

fix:
[pettanr/pettanr.git] / app / assets / javascripts / models / speech.js.coffee
index 9bdffa1..cfe1da7 100644 (file)
@@ -15,29 +15,47 @@ class Pettanr.Speech extends Peta.Element
     height: 100\r
   } \r
   \r
+  pick: (templates) ->\r
+    # \r
+    speech_balloon_template = templates.speech_balloon_template\r
+    writing_format = templates.writing_format\r
+    {\r
+      speech_balloon_template_id: speech_balloon_template.get('id'),\r
+      speech_balloon_template_module_name: speech_balloon_template.get('module_name'),\r
+      speech_balloon_template_settings: speech_balloon_template.get('settings')\r
+      writing_format_id: writing_format.get('id'),\r
+      writing_format_module_name: writing_format.get('module_name'),\r
+      writing_format_template_settings: writing_format.get('settings')\r
+    }\r
+  \r
   speech_balloon: () ->\r
     new Pettanr.SpeechBalloon({id: @get('speech_balloon_id')})\r
   \r
+  writing_format: () ->\r
+    new Pettanr.WritingFormat({id: @get('writing_format_id')})\r
+  \r
   @text_align_texts: () -> \r
     ['left', 'left', 'right', 'center']\r
   \r
   symbol_option: (cb) ->\r
     sb = @speech_balloon()\r
-    sb.fetch().done ->\r
+    sb.fetch({cache: true}).done =>\r
       sbt = sb.speech_balloon_template()\r
-      sbt.fetch().done ->\r
+      sbt.fetch({cache: true}).done =>\r
         sp = sbt.system_picture()\r
-        sp.fetch().done ->\r
-          cb(sp.tmb_opt_img_tag())\r
+        sp.fetch({cache: true}).done =>\r
+          @trigger('ready:symbol', sp.tmb_opt_img_tag())\r
   \r
   text_align_text: () ->\r
     Pettanr.Speech.text_align_texts()[@get('text_align')]\r
   \r
   scenario: () ->\r
     @boosts('read')\r
-    @render()\r
+    @render(@escape('content'))\r
+    \r
   \r
-  initialize: () ->\r
+  initialize: (attr, options) ->\r
+    super(attr, options)\r
     if @id\r
       @url = @url + @id\r
   \r