OSDN Git Service

fix new element dialog
[pettanr/pettanr.git] / app / assets / javascripts / models / license.js.coffee
index 47ec960..7c4799f 100644 (file)
@@ -17,31 +17,19 @@ class Pettanr.License extends Peta.SystemResource
   system_picture: () ->\r
     new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
   \r
-  symbol_option: (cb) ->\r
+  symbol_option: () ->\r
     i = @system_picture()\r
-    i.fetch({cache: true}).done ->\r
-      cb(i.tmb_opt_img_tag())\r
+    i.fetch({cache: true}).done =>\r
+      @symbol_picture = i.tmb_opt_img_tag()\r
+      @trigger('ready:symbol')\r
   \r
   caption_with_group: () ->\r
-    new Pettanr.License.Caption({license: this, license_group: @license_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
     if @id\r
       @url = @url + @id\r
   \r
-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({cache: true}).done ->\r
-      _this.$el.html(_this.license_group.get('caption') + '/' + _this.license.get('caption'))\r
-    this\r
-  \r