OSDN Git Service

work
authoryasushiito <yas@pen-chan.jp>
Tue, 17 Dec 2013 02:35:37 +0000 (11:35 +0900)
committeryasushiito <yas@pen-chan.jp>
Tue, 17 Dec 2013 02:35:37 +0000 (11:35 +0900)
app/assets/javascripts/manifest/work/lists.js.coffee.erb
app/models/original_picture.rb
lib/manifest/list.rb
public/manifest.json

index b5c9165..6a325df 100644 (file)
       public_list: {\r
         type: 'public',\r
       },\r
+      private_list: {\r
+        type: 'private',\r
+      },\r
       by_license: {\r
         type: 'filter',\r
         from: 'license',\r
index 3004bb5..f29212c 100644 (file)
@@ -53,7 +53,8 @@ class OriginalPicture < Pettanr::Content
   end
   
   def revision
-    self.history.first.revision
+    head = self.history.first
+    head ? head.revision : 'unpublished'
   end
   
   def unpublished?
index b47fbda..59c0dfd 100644 (file)
@@ -40,7 +40,15 @@ module Pettanr
       end
       
       def includes
-        @owner_model ? {@owner_model.item_name => {}} : {}
+        if @owner_model
+          if @owner_model.owner_model
+            {@owner_model.item_name => {@owner_model.owner_model.item_name => {}}}
+          else
+            {@owner_model.item_name => {}}
+          end
+        else
+          {}
+        end
       end
       
       def order
@@ -69,10 +77,17 @@ module Pettanr
         when :artist
           operator = @operators.artist
         end
-        t = @owner_model ? @owner_table_name : @table_name
+        t = if @owner_model
+          if @owner_model.owner_model
+            @owner_model.owner_model.table_name
+          else
+            @owner_model.table_name
+          end
+        else
+          @table_name
+        end
         [t + '.' + @model.owner_type.to_s + '_id = ?', operator.id]
       end
-     
     end
     
     class HasManyList < BaseList
index d8cc207..7cf7b8e 100644 (file)
         "public_list": {\r
           "type": "public"\r
         },\r
+        "private_list": {\r
+          "type": "private"\r
+        },\r
         "scroll_panels": {\r
           "type": "has_many",\r
           "association_name": "scroll_panels"\r
         "public_list": {\r
           "type": "public"\r
         },\r
+        "private_list": {\r
+          "type": "private"\r
+        },\r
         "by_panel": {\r
           "type": "filter",\r
           "from": "panel",\r
         "public_list": {\r
           "type": "public"\r
         },\r
+        "private_list": {\r
+          "type": "private"\r
+        },\r
         "by_panel": {\r
           "type": "filter",\r
           "from": "panel",\r
         "public_list": {\r
           "type": "public"\r
         },\r
+        "private_list": {\r
+          "type": "private"\r
+        },\r
         "by_panel": {\r
           "type": "filter",\r
           "from": "panel",\r
         "public_list": {\r
           "type": "public"\r
         },\r
+        "private_list": {\r
+          "type": "private"\r
+        },\r
         "by_panel": {\r
           "type": "filter",\r
           "from": "panel",\r
         "public_list": {\r
           "type": "public"\r
         },\r
+        "private_list": {\r
+          "type": "private"\r
+        },\r
         "by_license": {\r
           "type": "filter",\r
           "from": "license",\r