OSDN Git Service

fix: op upload and destroy
[pettanr/pettanr.git] / app / assets / javascripts / models / ground_color.js.coffee
index 303398a..eff2800 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.GroundColor extends Peta.Element\r
+  url: '/ground_colors/'\r
+  \r
   @singular: () ->\r
     'GroundColor'\r
   \r
@@ -7,65 +9,34 @@ class Pettanr.GroundColor extends Peta.Element
   \r
   defaults: {\r
     id: null,\r
-    code: 0,\r
+    code: 0xeeeeee,\r
+    orientation: 0\r
   } \r
   \r
-  @has_picture: () ->\r
-    false\r
-  \r
-  div_offset: () ->\r
-    if @get('xy')\r
-      @get('xy')\r
-    else\r
-      0\r
+  @pick_item_name: () ->\r
+    'ground_color'\r
   \r
-  div_size: () ->\r
-    if @get('wh')\r
-      @get('wh')\r
-    else\r
-      100 - @div_offset()\r
+  @traceable_item_names: () ->\r
+    []\r
   \r
-  div_x: () ->\r
-    if @get('orientation') == 0\r
-      0\r
-    else\r
-      @div_offset()\r
+  pick: (picked_item) ->\r
+    {\r
+    }\r
   \r
-  div_y: () ->\r
-    if @get('orientation') == 0\r
-      @div_offset()\r
-    else\r
-      0\r
+  @has_picture: () ->\r
+    false\r
   \r
-  div_width: () ->\r
-    if @get('orientation') == 0\r
-      100\r
-    else\r
-      @div_size()\r
+  @pick_item_name: () ->\r
+    ''\r
   \r
-  div_height: () ->\r
-    if @get('orientation') == 0\r
-      @div_size()\r
-    else\r
-      100\r
+  panel: () ->\r
+    new Pettanr.Cache.Retriever(Pettanr.Panel, @get('panel_id'))\r
   \r
-  style: (spot = null, opacity = 20) ->\r
-    r = {\r
-      position: 'absolute', \r
-      'z-index': @get('z'), \r
-      top: Pettanr.to_s(@div_y()) + '%', \r
-      left: Pettanr.to_s(@div_x()) + '%', \r
-      width: Pettanr.to_s(@div_width()) + '%', \r
-      height: Pettanr.to_s(@div_height()) + '%', \r
-      'background-color': '#' + ('000000' + Pettanr.to_s(@get('code'))).slice(-6)\r
-    }\r
-    @merge_opacity(r, opacity) if spot and spot != this\r
-    r\r
+  element_face: () ->\r
+    new Pettanr.Views.GroundColor.ElementFace({element: this})\r
   \r
-  initialize: () ->\r
+  initialize: (attr, options) ->\r
+    super(attr, options)\r
     if @id\r
       @url = @url + @id\r
   \r
-class Pettanr.GroundColor.Collection extends Backbone.Collection\r
-  model: Pettanr.GroundColor\r
-  url: '/ground_colors'\r