OSDN Git Service

fix op summary
[pettanr/pettanr.git] / app / assets / javascripts / models / original_picture.js.coffee
index 871af07..d373bfe 100644 (file)
@@ -12,6 +12,9 @@ class Pettanr.OriginalPicture extends Peta.Content
     artist_id: null\r
   } \r
   \r
+  picture: () ->\r
+    new Pettanr.Picture({id: @get('picture_id')})\r
+  \r
   is_visible: (operators) ->\r
     @is_own(operators)\r
   \r
@@ -37,7 +40,7 @@ class Pettanr.OriginalPicture extends Peta.Content
   \r
   symbol_option: (cb) ->\r
     _this = this\r
-    this.fetch().done ->\r
+    this.fetch({cache: true}).done ->\r
       cb(_this.tmb_opt_img_tag())\r
   \r
   revision: () ->\r
@@ -60,6 +63,17 @@ class Pettanr.OriginalPicture extends Peta.Content
   is_published: () ->\r
     @get('published_at') != null\r
   \r
+  state: () ->\r
+    switch true\r
+      when @is_unpublished()\r
+        'unpublished'\r
+      when @is_unlicensed()\r
+        'unlicensed'\r
+      when @is_stopped()\r
+        'stopped'\r
+      when @is_published()\r
+        'published'\r
+  \r
   initialize: () ->\r
     if @id\r
       @url = @url + @id\r
@@ -79,7 +93,7 @@ class Pettanr.OriginalPicture.Head extends Backbone.View
   \r
   render: () ->\r
     _this = this\r
-    @pictures.fetch().done ->\r
+    @pictures.fetch({cache: true}).done ->\r
       head = _this.pictures.models[0]\r
       value = if head\r
         head.get('revision')\r