OSDN Git Service

fix:retrive
[pettanr/pettanr.git] / app / assets / javascripts / models / speech_balloon_template.js.coffee
index 9fcc603..9bdc6b6 100644 (file)
@@ -1,5 +1,4 @@
 class Pettanr.SpeechBalloonTemplate extends Peta.Template\r
-  url: '/speech_balloon_templates/'\r
   \r
   @singular: () ->\r
     'SpeechBalloonTemplate'\r
@@ -12,20 +11,17 @@ class Pettanr.SpeechBalloonTemplate extends Peta.Template
   } \r
   \r
   system_picture: () ->\r
-    new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
+    new Pettanr.Cache.Retriever(Pettanr.SystemPicture, @get('system_picture_id'))\r
   \r
-  symbol_option: (cb) ->\r
-    i = @system_picture()\r
-    i.fetch({cache: true}).done ->\r
-      cb(i.tmb_opt_img_tag())\r
+  symbol_option: () ->\r
+    @get_parent('system_picture', this, {\r
+      success: (system_picture) => \r
+        @trigger('ready:symbol', system_picture.tmb_opt_img_tag())\r
+    })\r
   \r
   parsed_settings: () ->\r
     JSON.parse(@get('settings'))\r
   \r
-  initialize: () ->\r
-    if @id\r
-      @url = @url + @id\r
-    \r
-class Pettanr.SpeechBalloonTemplate.Collection extends Backbone.Collection\r
-  model: Pettanr.SpeechBalloonTemplate\r
-  url: '/speech_balloon_templates'\r
+  initialize: (attr = {}, options = {}) ->\r
+    super(attr, options)\r
+  \r