OSDN Git Service

fix: fetch fail
[pettanr/pettanr.git] / app / assets / javascripts / models / ground_picture.js.coffee
index 2f112d4..07dd815 100644 (file)
@@ -1,5 +1,4 @@
 class Pettanr.GroundPicture extends Peta.Element\r
-  url: '/ground_pictures/'\r
   \r
   @singular: () ->\r
     'GroundPicture'\r
@@ -17,42 +16,30 @@ class Pettanr.GroundPicture extends Peta.Element
   @repeat_texts: () -> \r
     ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']\r
   \r
-  picture: () ->\r
-    new Pettanr.Picture({id: @get('picture_id')})\r
+  @pick_item_name: () ->\r
+    'resource_picture'\r
   \r
-  has_picture: () ->\r
-    true\r
+  @traceable_item_names: () ->\r
+    ['panel_picture', 'picture']\r
   \r
-  style: (spot = null, opacity = 20) ->\r
-    r = {\r
-      position: 'absolute', \r
-      top: '0px', \r
-      left: '0px',\r
-      'z-index': @get('z'), \r
-      'background-image': 'url(' + @picture().r_url() + ')', \r
-      'background-repeat': @repeat_text(), \r
-      'background-position': Pettanr.to_s(@get('x')) + 'px ' + Pettanr.to_s(@get('y')) + 'px'\r
-    }\r
-    @merge_opacity(r, opacity) if spot and spot != this\r
-    r\r
+  pick: (picked_item) ->\r
+    {picture_id: picked_item.get('picture_id')}\r
   \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
+  @trace_routes: () ->\r
+    {\r
+      resource_picture: ['picture', 'resource_picture_picture', 'resource_picture'],\r
+      symbol: 'picture'\r
+    }\r
   \r
-  symbol_option: (cb) ->\r
-    i = @picture()\r
-    _this = this\r
-    i.fetch().done ->\r
-      cb(_this.tmb_opt_img_tag(i))\r
+  @has_picture: () ->\r
+    true\r
   \r
   repeat_text: () ->\r
     Pettanr.GroundPicture.repeat_texts()[@get('repeat')]\r
   \r
-  initialize: () ->\r
-    if @id\r
-      @url = @url + @id\r
+  element_face: () ->\r
+    new Pettanr.Views.GroundPicture.ElementFace({element: this})\r
+  \r
+  initialize: (attr, options) ->\r
+    super(attr, options)\r
   \r
-class Pettanr.GroundPicture.Collection extends Backbone.Collection\r
-  model: Pettanr.GroundPicture\r
-  url: '/ground_pictures'\r