OSDN Git Service

fix sign in,out
[pettanr/pettanr.git] / app / assets / javascripts / models / ground_picture.js.coffee
index 6817bb3..a699cce 100644 (file)
@@ -17,47 +17,36 @@ class Pettanr.GroundPicture extends Peta.Element
   @repeat_texts: () -> \r
     ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']\r
   \r
+  panel: (options = {}) ->\r
+    new Pettanr.Panel({id: @get('panel_id')}, options)\r
+  \r
   picture: () ->\r
     new Pettanr.Picture({id: @get('picture_id')})\r
   \r
-  has_picture: () ->\r
+  @has_picture: () ->\r
     true\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
-  \r
   tmb_opt_img_tag: (picture) ->\r
-    new Pettanr.Picture.SymbolPicture({\r
+    new Pettanr.Image.SymbolPicture({\r
       attr: {\r
         src: picture.r_url(), \r
-        alt: @get('caption')\r
+        alt: @escape('caption')\r
       },\r
       picture: picture\r
     })\r
   \r
-  symbol_option: (cb) ->\r
+  symbol_option: () ->\r
     i = @picture()\r
-    _this = this\r
-    i.fetch().done ->\r
-      cb(_this.tmb_opt_img_tag(i))\r
+    i.fetch({cache: true}).done =>\r
+      @trigger('ready:symbol', i.tmb_opt_img_tag())\r
   \r
   repeat_text: () ->\r
     Pettanr.GroundPicture.repeat_texts()[@get('repeat')]\r
   \r
+  element_face: () ->\r
+    new Pettanr.Views.GroundPicture.ElementFace({element: this})\r
+  \r
   initialize: () ->\r
     if @id\r
       @url = @url + @id\r
   \r
-class Pettanr.GroundPicture.Collection extends Backbone.Collection\r
-  model: Pettanr.GroundPicture\r
-  url: '/ground_pictures'\r