OSDN Git Service

fix: fetch fail
[pettanr/pettanr.git] / app / assets / javascripts / models / picture.js.coffee
index b1d85c3..4cbe1a3 100644 (file)
@@ -27,31 +27,12 @@ class Pettanr.Picture extends Peta.Content
   mime_type: () ->\r
     'image/' + @get('ext')\r
   \r
-  r_url: () ->\r
-    '/pictures/' + @filename()\r
-  \r
-  img_option: () ->\r
-    title = if @['get']  # is instance?\r
-      @model_name() + ' ID:' + Pettanr.to_s(@get('id'))\r
+  r_url: (subdir = null) ->\r
+    q = if subdir\r
+      '?subdir=' + subdir\r
     else\r
-      @model_name()\r
-    {\r
-      title: title\r
-      alt: @model_name()\r
-    }\r
-  \r
-  opt_img_tag: () ->\r
-    @picture_file()\r
-  \r
-  tmb_opt_img_tag: () ->\r
-    @symbol_file()\r
-  \r
-  tail_opt_img_tag: (img) ->\r
-    {src: img, width: @get('width'), height: @get('height')}\r
-  \r
-  tail_tmb_opt_img_tag: (img) ->\r
-    wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))\r
-    {src: img, width: wh[0], height: wh[1]}\r
+      ''\r
+    '/pictures/' + @filename() + q\r
   \r
   alt_name: () ->\r
     lgn = Pettanr.to_s(@license().license_group().get('caption'))\r
@@ -62,6 +43,8 @@ class Pettanr.Picture extends Peta.Content
     @retrieve(this, {\r
       success: (symbol_item) => \r
         options.success.call(context, symbol_item.to_symbol())\r
+      fail: (response, opt) =>\r
+        options.fail.call(context, response, opt)\r
     })\r
   \r
   is_enable: () ->\r
@@ -90,9 +73,6 @@ class Pettanr.Picture extends Peta.Content
     return true if @is_own(operators)\r
     #@is_enable() and @is_head()\r
   \r
-  history_view: () ->\r
-    new Pettanr.Views.Picture.History({item: this})\r
-  \r
   initialize: (attr = {}, options = {}) ->\r
     super(attr, options)\r
   \r