OSDN Git Service

fix: sync error
[pettanr/pettanr.git] / app / assets / javascripts / views / resource_pictures / show.js.coffee
index 4d3fe3d..d50ad42 100644 (file)
@@ -12,41 +12,42 @@ class Pettanr.Views.ResourcePicture.Show extends Pettanr.View.Show
     this.$el.append(@header.render().el)\r
     this.$el.append(@authored_by.render().el)\r
     this.$el.append(@img.render().el)\r
-    @item.get_parent('original_picture', this, {\r
-      success: (@original_picture) =>\r
-        @owner = new Pettanr.View.Show.Footer(null, this, {\r
-          actions: {\r
-            replace: {\r
-              item: @original_picture,\r
-              url: @original_picture.edit_url(),\r
-              dic_name: 'original_pictures.show.replace',\r
-              click: () =>\r
-                @trigger('http_get', @original_picture.edit_url())\r
-            }, \r
-            source: {\r
-              item: @original_picture,\r
-              url: @original_picture.show_url(),\r
-              dic_name: 'original_pictures.show.title',\r
-              click: () =>\r
-                @trigger('http_get', @original_picture.show_url())\r
-            }, \r
-            stop: {\r
-              item: @item,\r
-              url: @item.destroy_url(),\r
-              dic_name: 'original_pictures.index.stop',\r
-              click: () =>\r
-                redirect = (url) =>\r
-                  @trigger('http_get', url)\r
-                Pettanr.Proxy.destroy(@item, {redirect: redirect})\r
-            }, \r
-          }, \r
-        })\r
-        @item.get_parent('picture', this, {\r
-          success: (picture) =>\r
-            @add_credit(picture)\r
-            this.$el.append(@owner.render().el)\r
-        })\r
+    @item.get_parent('picture', this, {\r
+      success: (picture) =>\r
+        @add_credit(picture)\r
     })\r
+    if @item.is_own()\r
+      @item.get_parent('original_picture', this, {\r
+        success: (@original_picture) =>\r
+          @owner = new Pettanr.View.Show.Footer(null, this, {\r
+            actions: {\r
+              replace: {\r
+                item: @original_picture,\r
+                url: @original_picture.edit_url(),\r
+                dic_name: 'original_pictures.show.replace',\r
+                click: () =>\r
+                  @trigger('http_get', @original_picture.edit_url())\r
+              }, \r
+              source: {\r
+                item: @original_picture,\r
+                url: @original_picture.show_url(),\r
+                dic_name: 'original_pictures.show.title',\r
+                click: () =>\r
+                  @trigger('http_get', @original_picture.show_url())\r
+              }, \r
+              stop: {\r
+                item: @item,\r
+                url: @item.destroy_url(),\r
+                dic_name: 'original_pictures.index.stop',\r
+                click: () =>\r
+                  redirect = (url) =>\r
+                    @trigger('http_get', url)\r
+                  Pettanr.Proxy.destroy(@item, {redirect: redirect})\r
+              }, \r
+            }, \r
+          })\r
+          this.$el.append(@owner.render().el)\r
+      })\r
     this\r
   \r
   click_pick: () ->\r