OSDN Git Service

fix filer
[pettanr/pettanr.git] / app / assets / javascripts / models / ground_picture.js.coffee
index 1a18c15..2f112d4 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.GroundPicture extends Peta.Element\r
+  url: '/ground_pictures/'\r
+  \r
   @singular: () ->\r
     'GroundPicture'\r
   \r
@@ -16,7 +18,7 @@ class Pettanr.GroundPicture extends Peta.Element
     ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']\r
   \r
   picture: () ->\r
-    @get('picture')\r
+    new Pettanr.Picture({id: @get('picture_id')})\r
   \r
   has_picture: () ->\r
     true\r
@@ -34,12 +36,15 @@ class Pettanr.GroundPicture extends Peta.Element
     @merge_opacity(r, opacity) if spot and spot != this\r
     r\r
   \r
-  tmb_opt_img_tag: () ->\r
-    wh = Pettanr.Imager.thumbnail_size(@picture().get('width'), @picture().get('height'))\r
-    {src: @picture().r_url(), width: wh[0], height: wh[1], alt: @get('caption')}\r
+  tmb_opt_img_tag: (picture) ->\r
+    wh = Pettanr.Imager.thumbnail_size(picture().get('width'), picture().get('height'))\r
+    new Pettanr.AppHelperImg({src: picture.r_url(), size: Math.abs(wh[0]), alt: @get('caption')})\r
   \r
-  symbol_option: () ->\r
-    @tmb_opt_img_tag()\r
+  symbol_option: (cb) ->\r
+    i = @picture()\r
+    _this = this\r
+    i.fetch().done ->\r
+      cb(_this.tmb_opt_img_tag(i))\r
   \r
   repeat_text: () ->\r
     Pettanr.GroundPicture.repeat_texts()[@get('repeat')]\r