OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / assets / javascripts / models / balloon.js.coffee
index 1c69934..0ed171f 100644 (file)
@@ -19,31 +19,25 @@ class Pettanr.Balloon extends Peta.Element
   speech_balloon: () ->\r
     new Pettanr.SpeechBalloon({id: @get('speech_balloon_id')})\r
   \r
-  url: () ->\r
+  system_picture: () ->\r
+    new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
+  \r
+  r_url: () ->\r
     '/system_pictures/' + @system_picture().filename()\r
   \r
-  symbol_option: (cb) ->\r
+  symbol_option: () ->\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
-  \r
-  style: () ->\r
-    {\r
-      width: Pettanr.to_s(@get('width')) + 'px', \r
-      height: Pettanr.to_s(@get('height')) + 'px',\r
-      top: Pettanr.to_s(@get('y')) + 'px',\r
-      left: Pettanr.to_s(@get('x')) + 'px'\r
-    }\r
+        sp.fetch({cache: true}).done =>\r
+          @trigger('ready:symbol', sp.tmb_opt_img_tag())\r
   \r
   initialize: () ->\r
     if @id\r
       @url = @url + @id\r
+    @bind('change:width', () ->\r
+      console.log('cng')\r
+    )\r
   \r
-class Pettanr.Balloon.Collection extends Backbone.Collection\r
-  model: Pettanr.Balloon\r
-  url: '/balloons'\r
-\r