OSDN Git Service

fix new element dialog
[pettanr/pettanr.git] / app / assets / javascripts / models / license.js.coffee
index 19e5b94..7c4799f 100644 (file)
@@ -1,25 +1,35 @@
-class License extends Item\r
-  @single: () ->\r
+class Pettanr.License extends Peta.SystemResource\r
+  url: '/licenses/'\r
+  \r
+  @singular: () ->\r
     'License'\r
   \r
   @plural: () ->\r
     'Licenses'\r
   \r
   defaults: {\r
-    id: 11\r
+    id: null\r
   } \r
   \r
+  license_group: () ->\r
+    r = new Pettanr.LicenseGroup({id: @get('license_group_id')})\r
+  \r
+  system_picture: () ->\r
+    new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
+  \r
+  symbol_option: () ->\r
+    i = @system_picture()\r
+    i.fetch({cache: true}).done =>\r
+      @symbol_picture = i.tmb_opt_img_tag()\r
+      @trigger('ready:symbol')\r
+  \r
+  caption_with_group: () ->\r
+    i = @license_group()\r
+    i.fetch({cache: true}).done =>\r
+      @caption_text = i.escape('caption') + '/' + @escape('caption')\r
+      @trigger('ready:caption')\r
+  \r
   initialize: () ->\r
-    confirm("Welcome to Panel")\r
-  \r
-  @test: () ->\r
-    confirm( @single())\r
-    confirm( @plural() )\r
-    confirm( @class_name() )\r
-    confirm( @element_name() )\r
-    confirm( @table_name() )\r
-    \r
-  \r
-  test: () ->\r
-\r
-@Panel = Panel\r
+    if @id\r
+      @url = @url + @id\r
+  \r