OSDN Git Service

fix: show's destroy button
[pettanr/pettanr.git] / app / assets / javascripts / models / scroll_panel.js.coffee
index 059d2dc..a1fcd70 100644 (file)
@@ -1,15 +1,36 @@
 class Pettanr.ScrollPanel extends Peta.Leaf\r
-  @single: () ->\r
+  \r
+  @singular: () ->\r
     'ScrollPanel'\r
   \r
   @plural: () ->\r
     'ScrollPanels'\r
   \r
   defaults: {\r
-    id: 11\r
+    id: null,\r
+    scroll_id: null,\r
+    panel_id: null,\r
+    t: null\r
   } \r
   \r
-  initialize: () ->\r
-    confirm("Welcome to Panel")\r
+  @licensed_pictures: (scroll_panels) ->\r
+    panels = _.filter(scroll_panels, (sp) ->\r
+      sp.has_panel()\r
+    )\r
+    Pettanr.Panel.licensed_pictures(panels)\r
+  \r
+  scroll: () ->\r
+    new Pettanr.Cache.Retriever(Pettanr.Scroll, @get('scroll_id'))\r
+  \r
+  panel: () ->\r
+    new Pettanr.Cache.Retriever(Pettanr.Panel, @get('panel_id'))\r
+  \r
+  has_panel: () ->\r
+    if @get('panel_id')\r
+      true\r
+    else\r
+      false\r
+  \r
+  initialize: (attr = {}, options = {}) ->\r
+    super(attr, options)\r
   \r
-\r