OSDN Git Service

fix filer
[pettanr/pettanr.git] / app / assets / javascripts / models / license.js.coffee
index 2e18e58..62bfd0c 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.License extends Peta.SystemResource\r
+  url: '/licenses/'\r
+  \r
   @singular: () ->\r
     'License'\r
   \r
@@ -11,11 +13,17 @@ class Pettanr.License extends Peta.SystemResource
   \r
   license_group: () ->\r
     r = new Pettanr.LicenseGroup({id: @get('license_group_id')})\r
-    r.fetch({}).done () ->\r
-      r\r
+  \r
+  system_picture: () ->\r
+    new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
+  \r
+  symbol_option: (cb) ->\r
+    i = @system_picture()\r
+    i.fetch().done ->\r
+      cb(i.tmb_opt_img_tag())\r
   \r
   caption_with_group: () ->\r
-    @license_group().get('caption') + '/' + @get('caption')\r
+    new Pettanr.License.Caption({license: this, license_group: @license_group()})\r
   \r
   initialize: () ->\r
     if @id\r
@@ -24,3 +32,16 @@ class Pettanr.License extends Peta.SystemResource
 class Pettanr.License.Collection extends Backbone.Collection\r
   model: Pettanr.License\r
   url: '/licenses'\r
+\r
+class Pettanr.License.Caption extends Backbone.View\r
+  tagName: 'span'\r
+  initialize: (options) ->\r
+    @license = options.license\r
+    @license_group = options.license_group\r
+    \r
+  render: () ->\r
+    _this = this\r
+    @license_group.fetch().done ->\r
+      _this.$el.html(_this.license_group.get('caption') + '/' + _this.license.get('caption'))\r
+    this\r
+  \r