OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / assets / javascripts / models / scroll_panel.js.coffee
index 059d2dc..c5d83cd 100644 (file)
@@ -1,15 +1,39 @@
 class Pettanr.ScrollPanel extends Peta.Leaf\r
-  @single: () ->\r
+  url: ''\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
+  @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
-    confirm("Welcome to Panel")\r
+    if @id\r
+      @url = @url + @id\r
   \r
-\r