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 2795754..b1d85c3 100644 (file)
@@ -10,6 +10,11 @@ class Pettanr.Picture extends Peta.Content
     id: null\r
   } \r
   \r
+  @trace_routes: () ->\r
+    {\r
+      resource_picture: ['resource_picture_picture', 'resource_picture']\r
+    }\r
+  \r
   is_visible: (operators = Pettanr.cache.operators) ->\r
     return true\r
   \r
@@ -25,16 +30,21 @@ class Pettanr.Picture extends Peta.Content
   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
+    else\r
+      @model_name()\r
+    {\r
+      title: title\r
+      alt: @model_name()\r
+    }\r
+  \r
   opt_img_tag: () ->\r
-    {src: @r_url(), width: @get('width'), height: @get('height')}\r
+    @picture_file()\r
   \r
   tmb_opt_img_tag: () ->\r
-    new Pettanr.Image.SymbolPicture({\r
-      attr: {\r
-        src: @r_url()\r
-      },\r
-      picture: this\r
-    })\r
+    @symbol_file()\r
   \r
   tail_opt_img_tag: (img) ->\r
     {src: img, width: @get('width'), height: @get('height')}\r
@@ -48,8 +58,11 @@ class Pettanr.Picture extends Peta.Content
     ln = Pettanr.to_s(@license().get('caption'))\r
     lgn + '[' + ln + ']'\r
   \r
-  symbol_option: () ->\r
-    @tmb_opt_img_tag()\r
+  symbol_option: (context, options) ->\r
+    @retrieve(this, {\r
+      success: (symbol_item) => \r
+        options.success.call(context, symbol_item.to_symbol())\r
+    })\r
   \r
   is_enable: () ->\r
     if @head().resource_picture()\r
@@ -80,22 +93,6 @@ class Pettanr.Picture extends Peta.Content
   history_view: () ->\r
     new Pettanr.Views.Picture.History({item: this})\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: (attr = {}, options = {}) ->\r
     super(attr, options)\r
   \r