OSDN Git Service

fix event names
[pettanr/pettanr.git] / app / assets / javascripts / models / scroll_panel.js.coffee
index 96debaf..c5d83cd 100644 (file)
@@ -1,7 +1,7 @@
 class Pettanr.ScrollPanel extends Peta.Leaf\r
   url: ''\r
   \r
-  @single: () ->\r
+  @singular: () ->\r
     'ScrollPanel'\r
   \r
   @plural: () ->\r
@@ -9,12 +9,31 @@ class Pettanr.ScrollPanel extends Peta.Leaf
   \r
   defaults: {\r
     id: null,\r
+    scroll_id: null,\r
+    panel_id: null,\r
+    t: null\r
   } \r
   \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.Scroll({id: @get('scroll_id')})\r
+  \r
+  panel: () ->\r
+    # get with elm in case play mode\r
+    new Pettanr.Panel.WithElements({id: @get('panel_id')})\r
+  \r
+  has_panel: () ->\r
+    if @get('panel_id')\r
+      true\r
+    else\r
+      false\r
+  \r
   initialize: () ->\r
     if @id\r
       @url = @url + @id\r
   \r
-class Pettanr.ScrollPanel.Collection extends Backbone.Collection\r
-  model: Pettanr.ScrollPanel\r
-  url: '/scroll_panels'\r