OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / assets / javascripts / models / picture.js.coffee
index cec6aa9..45924e5 100644 (file)
@@ -49,10 +49,8 @@ class Pettanr.Picture extends Peta.Content
     ln = Pettanr.to_s(@license().get('caption'))\r
     lgn + '[' + ln + ']'\r
   \r
-  symbol_option: (cb) ->\r
-    _this = this\r
-    this.fetch({cache: true}).done ->\r
-      cb(_this.tmb_opt_img_tag())\r
+  symbol_option: () ->\r
+    @tmb_opt_img_tag()\r
   \r
   is_enable: () ->\r
     if @head().resource_picture()\r
@@ -80,6 +78,22 @@ class Pettanr.Picture extends Peta.Content
     return true if @is_own(operators)\r
     #@is_enable() and @is_head()\r
   \r
+  credit_icon_view: () ->\r
+    new Pettanr.Views.Picture.CreditIcon({item: this})\r
+  \r
+  credit_view: (with_icon = true) ->\r
+    new Pettanr.Views.Picture.Credit({item: this, with_icon: with_icon})\r
+  \r
+  fetch: (options) ->\r
+    if @id\r
+      @credit_icon = @credit_icon_view()\r
+      @credit = null\r
+      f = (data, status) =>\r
+        @credit = data\r
+        @trigger('ready')\r
+      $.get(@url + '/credit', null, f, 'html')\r
+    super(options)\r
+  \r
   initialize: () ->\r
     if @id\r
       @url = @url + @id\r