OSDN Git Service

fix: show's destroy button
[pettanr/pettanr.git] / app / assets / javascripts / models / writing_format.js.coffee
index df2ad5e..834c18a 100644 (file)
@@ -1,5 +1,4 @@
 class Pettanr.WritingFormat extends Peta.Template\r
-  url: '/writing_formats/'\r
   \r
   @singular: () ->\r
     'WritingFormat'\r
@@ -12,18 +11,16 @@ class Pettanr.WritingFormat 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().done ->\r
-      cb(i.tmb_opt_img_tag())\r
+  symbol_option: () ->\r
+    retriever = @system_picture()\r
+    @listenTo(retriever, 'retrieve', @retrieve_system_picture)\r
+    retriever.retrieve()\r
   \r
-  initialize: () ->\r
-    if @id\r
-      @url = @url + @id\r
+  retrieve_system_picture: (item) -> \r
+    @trigger('ready:symbol', item.tmb_opt_img_tag())\r
+  \r
+  initialize: (attr = {}, options = {}) ->\r
+    super(attr, options)\r
   \r
-class Pettanr.WritingFormat.Collection extends Backbone.Collection\r
-  model: Pettanr.WritingFormat\r
-  url: '/writing_formats'\r
-\r