OSDN Git Service

manifest list
authoryasushiito <yas@pen-chan.jp>
Sun, 23 Feb 2014 07:49:46 +0000 (16:49 +0900)
committeryasushiito <yas@pen-chan.jp>
Sun, 23 Feb 2014 07:49:46 +0000 (16:49 +0900)
28 files changed:
app/assets/javascripts/manifest/work/controllers.js.coffee.erb
app/assets/javascripts/manifest/work/lists.js.coffee.erb
app/assets/javascripts/manifest/work/models.js.coffee.erb
lib/manifest/list.rb
lib/manifest/list/base.rb
lib/manifest/list/filter.rb
lib/manifest/list/foreign_filter.rb [moved from lib/manifest/list/element_filter.rb with 55% similarity]
lib/manifest/list/includes.rb [new file with mode: 0644]
lib/manifest/list/includes/auto.rb [new file with mode: 0644]
lib/manifest/list/includes/base.rb [new file with mode: 0644]
lib/manifest/list/includes/method.rb [new file with mode: 0644]
lib/manifest/list/includes/none.rb [new file with mode: 0644]
lib/manifest/list/private.rb
lib/manifest/list/public.rb
lib/manifest/list/through_filter.rb
lib/manifest/list/where.rb [new file with mode: 0644]
lib/manifest/list/where/auto.rb [new file with mode: 0644]
lib/manifest/list/where/base.rb [new file with mode: 0644]
lib/manifest/list/where/method.rb [new file with mode: 0644]
lib/manifest/model.rb
lib/manifest/model/association/has_many.rb
lib/manifest/model/association/has_one.rb
lib/manifest/model/list.rb
lib/manifest/model/list/foreign_filter.rb [moved from lib/manifest/model/list/element_filter.rb with 93% similarity]
lib/manifest/model/list/has_many.rb [deleted file]
lib/manifest/model/list/has_many_through.rb [deleted file]
lib/peta/content.rb
public/manifest.json

index 604e205..e00855c 100644 (file)
@@ -5,7 +5,7 @@
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       by_author: {\r
@@ -26,7 +26,7 @@
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_author: {\r
@@ -45,7 +45,7 @@
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
@@ -61,7 +61,7 @@
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_panel: {\r
@@ -77,7 +77,7 @@
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
@@ -90,7 +90,7 @@
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_author: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       by_comic: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_story: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_story: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_sheet: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_scroll: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_panel: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_panel: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_writing_format: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
     },\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_panel: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_panel: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'private_list',\r
-          \r
+          list_name: 'private',\r
         },\r
       },\r
       show: {\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
     },\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_license: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
     },\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_system_picture: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
     },\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
       count_by_license_group: {\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
     },\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
     },\r
       index: {\r
         type: 'list',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
           \r
         },\r
       },\r
       count: {\r
         type: 'count',\r
         args: {\r
-          list_name: 'public_list',\r
+          list_name: 'public',\r
         },\r
       },\r
     },\r
         type: 'list',\r
         args: {\r
           item_name: 'scroll',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'scroll_panel',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'comic',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'story',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'story_sheet',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'sheet',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'sheet_panel',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'panel',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'panel_picture',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'speech_balloon',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'speech',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'balloon',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'ground_picture',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'ground_color',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'original_picture',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
         type: 'list',\r
         args: {\r
           item_name: 'resource_picture',\r
-          list_name: 'private_list',\r
+          list_name: 'private',\r
           \r
         },\r
       },\r
index 815d8bc..d3add6f 100644 (file)
@@ -1,9 +1,9 @@
 #マニフェスト\r
 @lists = {\r
   scroll: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_author: {\r
     },\r
@@ -13,9 +13,9 @@
     },\r
   },\r
   scroll_panel: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_scroll: {\r
     },\r
     },\r
   },\r
   comic: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_author: {\r
     },\r
   },\r
   story: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_comic: {\r
     },\r
     by_sheet: {\r
     },\r
     by_author: {\r
-      type: 'element_filter',\r
-      args: {\r
-        from: 'author',\r
-        filter_key: 'author_id',\r
-      },\r
     },\r
     play: {\r
-      type: 'play',\r
-      args: {\r
-        model: 'story_sheet',\r
-        filter_key: 'story_id',\r
-      },\r
     },\r
   },\r
   story_sheet: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_story: {\r
     },\r
@@ -65,9 +55,9 @@
     },\r
   },\r
   sheet: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_story: {\r
     },\r
     by_author: {\r
     },\r
     play: {\r
-      type: 'play',\r
-      args: {\r
-        model: 'sheet_panel',\r
-        filter_key: 'sheet_id',\r
-      },\r
     },\r
   },\r
   sheet_panel: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_sheet: {\r
     },\r
@@ -94,9 +79,9 @@
     },\r
   },\r
   panel: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_scroll: {\r
     },\r
     by_author: {\r
     },\r
     by_speech_balloon_template: {\r
-      type: 'through_filter',\r
-      args: {\r
-        from: 'speech_balloon_template',\r
-        through: 'speech_balloons',\r
-        filter_key: 'speech_balloon_template_id',\r
-      },\r
     },\r
   },\r
   panel_picture: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_panel: {\r
     },\r
     by_author: {\r
-      where: 'by_author_where',\r
-      includes: 'by_author_includes',\r
     },\r
   },\r
   speech_balloon: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_panel: {\r
     },\r
     by_speech_balloon_template: {\r
-      type: 'filter',\r
-      args: {\r
-        from: 'speech_balloon_template',\r
-        filter_key: 'speech_balloon_template_id',\r
-      },\r
     },\r
     by_author: {\r
     },\r
   },\r
   speech: {\r
-    public_list: {\r
+    public: {\r
     },\r
     by_speech_balloon: {\r
-      type: 'filter',\r
-      args: {\r
-        from: 'speech_balloon',\r
-        includes: {speech_balloon: {panel: {}}},\r
-        filter_key: 'speech_balloon_id',\r
-      },\r
     },\r
     by_writing_format: {\r
-      type: 'filter',\r
-      args: {\r
-        from: 'writing_format',\r
-        filter_key: 'writing_format_id',\r
-      },\r
     },\r
   },\r
   balloon: {\r
-    public_list: {\r
+    public: {\r
     },\r
     by_speech_balloon: {\r
-      type: 'filter',\r
-      args: {\r
-        from: 'speech_balloon',\r
-        includes: {speech_balloon: {panel: {}}},\r
-        filter_key: 'speech_balloon_id',\r
-      },\r
     },\r
     #by_system_picture: {\r
-    #  type: 'filter',\r
-    #  from: 'system_picture',\r
-    #  filter_key: 'system_picture_id',\r
     #},\r
   },\r
   ground_picture: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_panel: {\r
-      type: 'filter',\r
-      args: {\r
-        from: 'panel',\r
-        filter_key: 'panel_id',\r
-      },\r
     },\r
     by_author: {\r
-      type: 'element_filter',\r
-      args: {\r
-        from: 'author',\r
-        filter_key: 'author_id',\r
-      },\r
     },\r
   },\r
   ground_color: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_panel: {\r
-      type: 'filter',\r
-      args: {\r
-        from: 'panel',\r
-        filter_key: 'panel_id',\r
-      },\r
     },\r
     by_author: {\r
-      type: 'element_filter',\r
-      args: {\r
-        from: 'author',\r
-        filter_key: 'author_id',\r
-      },\r
     },\r
   },\r
   original_picture: {\r
-    private_list: {\r
+    private: {\r
     },\r
   },\r
   picture: {\r
   },\r
   resource_picture: {\r
-    public_list: {\r
+    public: {\r
     },\r
-    private_list: {\r
+    private: {\r
     },\r
     by_license: {\r
-      type: 'filter',\r
-      args: {\r
-        from: 'license',\r
-        filter_key: 'license_id',\r
-      },\r
     },\r
     by_artist: {\r
     },\r
   },\r
   speech_balloon_template: {\r
-    public_list: {\r
+    public: {\r
     },\r
     select_items: {\r
-      type: 'system_resource',\r
     },\r
   },\r
   writing_format: {\r
-    public_list: {\r
+    public: {\r
     },\r
     select_items: {\r
-      type: 'system_resource',\r
     },\r
     by_system_picture: {\r
     },\r
   },\r
   license_group: {\r
-    public_list: {\r
+    public: {\r
     },\r
     select_items: {\r
-      type: 'system_resource',\r
     },\r
   },\r
   license: {\r
-    public_list: {\r
+    public: {\r
     },\r
     by_license_group: {\r
     },\r
     },\r
   },\r
   author: {\r
-    public_list: {\r
+    public: {\r
     },\r
   },\r
   artist: {\r
-    public_list: {\r
+    public: {\r
     },\r
   },\r
   system_picture: {\r
-    public_list: {\r
+    public: {\r
     },\r
   },\r
 }\r
index f8c3a26..47b4ba8 100644 (file)
@@ -1,23 +1,16 @@
 #マニフェスト\r
 @models = {\r
   scroll: {\r
-    class_name: 'Scroll',\r
-    table_name: 'scrolls',\r
     associations: {\r
       belongs_to: {\r
         author: {\r
-          id_column: 'author_id'\r
         }, \r
       },\r
       has_many: {\r
         scroll_panels: {\r
-          foreign_key: 'scroll_id',\r
-          model_name: 'scroll_panel',\r
         }, \r
         panels: {\r
           through: 'scroll_panel',\r
-          foreign_key: 'scroll_id',\r
-          model_name: 'panel',\r
         }, \r
       },\r
     },\r
       }\r
     },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_author: {\r
         type: 'filter',\r
         args: {\r
-          filter_item_name: 'author',\r
-          filter_key: 'author_id',\r
         },\r
       },\r
       by_panel: {\r
         type: 'through_filter',\r
         args: {\r
-          filter_item_name: 'panel',\r
           through: 'scroll_panels',\r
-          filter_key: 'panel_id',\r
         },\r
       },\r
       play: {\r
     },\r
   },\r
   scroll_panel: {\r
-    class_name: 'ScrollPanel',\r
-    table_name: 'scroll_panels',\r
     associations: {\r
       belongs_to: {\r
         panel: {\r
-          id_column: 'panel_id'\r
         }, \r
         scroll: {\r
-          id_column: 'scroll_id'\r
         }, \r
       },\r
       has_many: {\r
         type: 'datetime',\r
       }\r
     },\r
+    tree: {\r
+      owner: 'scroll',\r
+    },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_scroll: {\r
     },\r
   },\r
   comic: {\r
-    class_name: 'Comic',\r
-    table_name: 'comics',\r
     associations: {\r
       belongs_to: {\r
         author: {\r
-          id_column: 'author_id'\r
         }, \r
       },\r
       has_many: {\r
         stories: {\r
-          foreign_key: 'comic_id',\r
-          model_name: 'story',\r
         }, \r
       },\r
-      has_many_through: {\r
-      },\r
     },\r
     attributes: {\r
       id: {\r
       }\r
     },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_author: {\r
     },\r
   },\r
   story: {\r
-    class_name: 'Story',\r
-    table_name: 'stories',\r
     associations: {\r
       belongs_to: {\r
         comic: {\r
-          id_column: 'comic_id'\r
         }, \r
       },\r
       has_many: {\r
         story_sheets: {\r
-          foreign_key: 'story_id',\r
-          model_name: 'story_sheet',\r
         }, \r
         sheets: {\r
           through: 'story_sheets',\r
-          foreign_key: 'story_id',\r
-          model_name: 'sheet',\r
         }, \r
       },\r
     },\r
         type: 'datetime',\r
       }\r
     },\r
+    tree: {\r
+      owner: 'comic',\r
+    },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_comic: {\r
       },\r
       by_sheet: {\r
         type: 'through_filter',\r
+        args: {\r
+          through: 'story_sheets',\r
+        },\r
       },\r
       by_author: {\r
-        type: 'element_filter',\r
+        type: 'foreign_filter',\r
       },\r
       play: {\r
         type: 'play',\r
     },\r
   },\r
   story_sheet: {\r
-    class_name: 'StorySheet',\r
-    table_name: 'story_sheets',\r
     associations: {\r
       belongs_to: {\r
         story: {\r
-          id_column: 'story_id'\r
         }, \r
         sheet: {\r
-          id_column: 'sheet_id'\r
         }, \r
       },\r
       has_many: {\r
         type: 'datetime',\r
       }\r
     },\r
+    tree: {\r
+      owner: 'story',\r
+    },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_story: {\r
     },\r
   },\r
   sheet: {\r
-    class_name: 'Sheet',\r
-    table_name: 'sheets',\r
     associations: {\r
       belongs_to: {\r
         author: {\r
-          id_column: 'author_id'\r
         }, \r
       },\r
       has_many: {\r
         story_sheets: {\r
-          foreign_key: 'story_id',\r
-          model_name: 'story_sheet',\r
         }, \r
         stories: {\r
           through: 'story_sheets',\r
-          foreign_key: 'sheet_id',\r
-          model_name: 'story',\r
         }, \r
         sheet_panels: {\r
-          foreign_key: 'sheet_id',\r
-          model_name: 'sheet_panel',\r
         }, \r
         panels: {\r
           through: 'sheet_panels',\r
-          foreign_key: 'sheet_id',\r
-          model_name: 'panel',\r
         }, \r
       },\r
     },\r
       }\r
     },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_story: {\r
         type: 'through_filter',\r
+        args: {\r
+          through: 'story_sheets',\r
+        },\r
       },\r
       by_panel: {\r
         type: 'through_filter',\r
+        args: {\r
+          through: 'sheet_panels',\r
+        },\r
       },\r
       by_author: {\r
         type: 'filter',\r
     },\r
   },\r
   sheet_panel: {\r
-    class_name: 'SheetPanel',\r
-    table_name: 'sheet_panels',\r
     associations: {\r
       belongs_to: {\r
         sheet: {\r
-          id_column: 'sheet_id'\r
         }, \r
         panel: {\r
-          id_column: 'panel_id'\r
         }, \r
       },\r
       has_many: {\r
         type: 'datetime',\r
       }\r
     },\r
+    tree: {\r
+      owner: 'sheet',\r
+    },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_sheet: {\r
     },\r
   },\r
   panel: {\r
-    class_name: 'Panel',\r
-    table_name: 'panels',\r
     associations: {\r
       belongs_to: {\r
         author: {\r
-          id_column: 'author_id'\r
         }, \r
       },\r
       has_many: {\r
         scroll_panels: {\r
-          foreign_key: 'panel_id',\r
-          model_name: 'scroll_panel',\r
         }, \r
         scrolls: {\r
           through: 'scroll_panels',\r
-          foreign_key: 'panel_id',\r
-          model_name: 'scroll',\r
         }, \r
         sheet_panels: {\r
-          foreign_key: 'panel_id',\r
-          model_name: 'sheet_panel',\r
         }, \r
         sheets: {\r
           through: 'sheet_panels',\r
-          foreign_key: 'panel_id',\r
-          model_name: 'sheet',\r
         }, \r
         panel_pictures: {\r
-          foreign_key: 'panel_id',\r
-          model_name: 'panel_picture',\r
         }, \r
         speech_balloons: {\r
-          foreign_key: 'panel_id',\r
-          model_name: 'speech_balloon',\r
         }, \r
         ground_pictures: {\r
-          foreign_key: 'panel_id',\r
-          model_name: 'ground_picture',\r
         }, \r
         ground_colors: {\r
-          foreign_key: 'panel_id',\r
-          model_name: 'ground_color',\r
         }, \r
       },\r
     },\r
       }\r
     },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_scroll: {\r
         type: 'through_filter',\r
         args: {\r
-          filter_item_name: 'scroll',\r
           through: 'scroll_panels',\r
-          filter_key: 'scroll_id',\r
         },\r
       },\r
       by_sheet: {\r
         type: 'through_filter',\r
+        args: {\r
+          through: 'sheet_panels',\r
+        },\r
       },\r
       by_author: {\r
         type: 'filter',\r
     },\r
   },\r
   panel_picture: {\r
-    class_name: 'PanelPicture',\r
-    table_name: 'panel_pictures',\r
     associations: {\r
       belongs_to: {\r
         panel: {\r
-          id_column: 'panel_id'\r
         }, \r
       },\r
       has_many: {\r
         type: 'datetime',\r
       }\r
     },\r
+    tree: {\r
+      owner: 'panel',\r
+      panel: 'panel',\r
+    },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_panel: {\r
         type: 'filter',\r
+        args: {\r
+          where_name: 'public_list_where',\r
+        },\r
       },\r
       by_author: {\r
-        type: 'element_filter',\r
+        type: 'foreign_filter',\r
+        args: {\r
+          tree_name: 'owner',\r
+        },\r
       },\r
     },\r
   },\r
   speech_balloon: {\r
-    class_name: 'SpeechBalloon',\r
-    table_name: 'speech_balloons',\r
     extend: 'classname', \r
     associations: {\r
       belongs_to: {\r
         panel: {\r
-          id_column: 'panel_id'\r
         }, \r
       },\r
       has_many: {\r
       },\r
       has_one: {\r
         balloon: {\r
-          foreign_key: 'speech_balloon_id',\r
-          model_name: 'balloon',\r
         }, \r
         speech: {\r
-          foreign_key: 'speech_balloon_id',\r
-          model_name: 'speech',\r
         }, \r
       },\r
     },\r
         type: 'datetime',\r
       }\r
     },\r
+    tree: {\r
+      owner: 'panel',\r
+      panel: 'panel',\r
+    },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_panel: {\r
         type: 'filter',\r
       },\r
       by_author: {\r
-        type: 'element_filter',\r
+        type: 'foreign_filter',\r
       },\r
     },\r
   }, \r
   balloon: {\r
-    class_name: 'Balloon',\r
-    table_name: 'balloons',\r
     associations: {\r
       belongs_to: {\r
         speech_balloon: {\r
-          id_column: 'speech_balloon_id'\r
         }, \r
         system_picture: {\r
-          id_column: 'system_picture_id'\r
         }, \r
       },\r
       has_many: {\r
         type: 'datetime',\r
       }\r
     },\r
+    tree: {\r
+      owner: 'speech_balloon',\r
+      panel: 'speech_balloon',\r
+    },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_panel: {\r
         type: 'filter',\r
       },\r
       by_author: {\r
-        type: 'element_filter',\r
+        type: 'foreign_filter',\r
       },\r
     },\r
   },\r
   speech: {\r
-    class_name: 'Speech',\r
-    table_name: 'speeches',\r
     associations: {\r
       belongs_to: {\r
         speech_balloon: {\r
-          id_column: 'speech_balloon_id'\r
         }, \r
         writing_format: {\r
-          id_column: 'writing_format_id'\r
         }, \r
       },\r
       has_many: {\r
         type: 'datetime',\r
       }\r
     },\r
+    tree: {\r
+      owner: 'speech_balloon',\r
+      panel: 'speech_balloon',\r
+    },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
       by_speech_balloon: {\r
     },\r
   },\r
   ground_picture: {\r
-    class_name: 'GroundPicture',\r
-    table_name: 'ground_pictures',\r
     associations: {\r
       belongs_to: {\r
         panel: {\r
-          id_column: 'panel_id'\r
         }, \r
       },\r
       has_many: {\r
         type: 'datetime',\r
       }\r
     },\r
+    tree: {\r
+      owner: 'panel',\r
+      panel: 'panel',\r
+    },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_panel: {\r
         type: 'filter',\r
       },\r
       by_author: {\r
-        type: 'element_filter',\r
+        type: 'foreign_filter',\r
       },\r
     },\r
   },\r
   ground_color: {\r
-    class_name: 'GroundColor',\r
-    table_name: 'ground_colors',\r
     associations: {\r
       belongs_to: {\r
         panel: {\r
-          id_column: 'panel_id'\r
         }, \r
       },\r
       has_many: {\r
         type: 'datetime',\r
       }\r
     },\r
+    tree: {\r
+      owner: 'panel',\r
+      panel: 'panel',\r
+    },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_panel: {\r
         type: 'filter',\r
       },\r
       by_author: {\r
-        type: 'element_filter',\r
+        type: 'foreign_filter',\r
       },\r
     },\r
   },\r
   original_picture: {\r
-    class_name: 'OriginalPicture',\r
-    table_name: 'original_pictures',\r
     associations: {\r
       belongs_to: {\r
         artist: {\r
-          id_column: 'artist_id'\r
         }, \r
       },\r
       has_many: {\r
         pictures: {\r
-          foreign_key: 'original_picture_id',\r
-          model_name: 'picture',\r
         }, \r
       },\r
       has_one: {\r
         resource_picture: {\r
-          foreign_key: 'original_picture_id',\r
-          model_name: 'resource_picture',\r
         }, \r
       },\r
     },\r
       }\r
     },\r
     lists: {\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
     },\r
   },\r
   picture: {\r
-    class_name: 'Picture',\r
-    table_name: 'pictures',\r
     associations: {\r
       belongs_to: {\r
         license: {\r
-          id_column: 'license_id'\r
         }, \r
         artist: {\r
-          id_column: 'artist_id'\r
         }, \r
       },\r
       has_many: {\r
     }\r
   },\r
   resource_picture: {\r
-    class_name: 'ResourcePicture',\r
-    table_name: 'resource_pictures',\r
     associations: {\r
       belongs_to: {\r
         original_picture: {\r
-          id_column: 'original_picture_id'\r
         }, \r
         license: {\r
-          id_column: 'license_id'\r
         }, \r
         artist: {\r
-          id_column: 'artist_id'\r
         }, \r
       },\r
       has_many: {\r
       }\r
     },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
-      private_list: {\r
+      private: {\r
         type: 'private',\r
       },\r
       by_license: {\r
     },\r
   },\r
   speech_balloon_template: {\r
-    class_name: 'SpeechBalloonTemplate',\r
-    table_name: 'speech_balloon_templates',\r
     associations: {\r
       belongs_to: {\r
         system_picture: {\r
-          id_column: 'system_picture_id'\r
         }, \r
       },\r
       has_many: {\r
         speech_balloons: {\r
-          foreign_key: 'speech_balloon_template_id',\r
-          model_name: 'speech_balloon',\r
         }, \r
         panels: {\r
           through: 'speech_balloons',\r
-          foreign_key: 'speech_balloon_template_id',\r
-          model_name: 'panel',\r
         }, \r
       },\r
       has_one: {\r
       }\r
     },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
       select_items: {\r
     },\r
   },\r
   writing_format: {\r
-    class_name: 'WritingFormat',\r
-    table_name: 'writing_formats',\r
     associations: {\r
       belongs_to: {\r
         system_picture: {\r
-          id_column: 'system_picture_id'\r
         }, \r
       },\r
       has_many: {\r
         speeches: {\r
-          foreign_key: 'writing_format_id',\r
-          model_name: 'speech',\r
         }, \r
       },\r
       has_one: {\r
       }\r
     },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
       select_items: {\r
     },\r
   },\r
   license_group: {\r
-    class_name: 'LicenseGroup',\r
-    table_name: 'license_groups',\r
     associations: {\r
       belongs_to: {\r
       },\r
       has_many: {\r
         licenses: {\r
-          foreign_key: 'license_group_id',\r
-          model_name: 'license',\r
         }, \r
       },\r
       has_one: {\r
       }\r
     },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
       select_items: {\r
     },\r
   },\r
   license: {\r
-    class_name: 'License',\r
-    table_name: 'licenses',\r
     associations: {\r
       belongs_to: {\r
         license_group: {\r
-          id_column: 'license_group_id'\r
         }, \r
         system_picture: {\r
-          id_column: 'system_picture_id'\r
         }, \r
       },\r
       has_many: {\r
         resource_pictures: {\r
-          foreign_key: 'license_id',\r
-          model_name: 'resource_picture',\r
         }, \r
       },\r
       has_one: {\r
       }\r
     },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
       by_license_group: {\r
     },\r
   },\r
   author: {\r
-    class_name: 'Author',\r
-    table_name: 'authors',\r
     associations: {\r
       belongs_to: {\r
       },\r
       has_many: {\r
         scrolls: {\r
-          foreign_key: 'author_id',\r
-          model_name: 'scroll',\r
         }, \r
         comics: {\r
-          foreign_key: 'author_id',\r
-          model_name: 'comic',\r
         }, \r
         stories: {\r
-          foreign_key: 'author_id',\r
-          model_name: 'story',\r
         }, \r
         sheets: {\r
-          foreign_key: 'author_id',\r
-          model_name: 'sheet',\r
         }, \r
         panels: {\r
-          foreign_key: 'author_id',\r
-          model_name: 'panel',\r
         }, \r
       },\r
       has_one: {\r
       }\r
     },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
     },\r
   },\r
   artist: {\r
-    class_name: 'Artist',\r
-    table_name: 'artists',\r
     associations: {\r
       belongs_to: {\r
       },\r
       has_many: {\r
         resource_pictures: {\r
-          foreign_key: 'artist_id',\r
-          model_name: 'resource_picture',\r
         }, \r
       },\r
       has_one: {\r
       }\r
     },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
     },\r
   },\r
   system_picture: {\r
-    class_name: 'SystemPicture',\r
-    table_name: 'system_pictures',\r
     associations: {\r
       belongs_to: {\r
       },\r
       has_many: {\r
         balloons: {\r
-          foreign_key: 'system_picture_id',\r
-          model_name: 'balloon',\r
         }, \r
-        balloon_templates: {\r
-          foreign_key: 'system_picture_id',\r
-          model_name: 'balloon_template',\r
+        speech_balloon_templates: {\r
         }, \r
         licenses: {\r
-          foreign_key: 'system_picture_id',\r
-          model_name: 'license',\r
         }, \r
       },\r
       has_one: {\r
       }\r
     },\r
     lists: {\r
-      public_list: {\r
+      public: {\r
         type: 'public',\r
       },\r
     },\r
index 1d48022..4fdd3f0 100644 (file)
@@ -4,15 +4,14 @@ require_dependency "manifest/list/private"
 require_dependency "manifest/list/system_resource"
 require_dependency "manifest/list/filter"
 require_dependency "manifest/list/through_filter"
-require_dependency "manifest/list/element_filter"
+require_dependency "manifest/list/foreign_filter"
 require_dependency "manifest/list/play"
 module Manifest
   module ListModule
     class ListFactory
       @@types = {
         'public' => ListModule::PublicList, 'private' => PrivateList, 'system_resource' => SystemResourceList,
-        'filter' => FilterList, 
-        'through_filter' => ThroughFilterList, 'element_filter' => ElementFilterList, 
+        'filter' => FilterList, 'through_filter' => ThroughFilterList, 'foreign_filter' => ForeignFilterList, 
         'play' => PlayList
       }
       def self.factory manifest, item_name, my_manifests
index 8516bd7..be0a0a1 100644 (file)
@@ -1,3 +1,5 @@
+require_dependency "manifest/list/where"
+require_dependency "manifest/list/includes"
 module Manifest
   module ListModule
     class Base
@@ -11,7 +13,8 @@ module Manifest
       end
       
       attr :manifest, :item_name, :list_name, :list_manifest, 
-        :default_page_size, :max_page_size
+        :model, :model_manifest, :model_list_manifest, 
+        :where, :includes
       def initialize manifest, item_name, list_name, list_manifest
         @manifest = manifest
         @item_name = item_name
@@ -24,20 +27,23 @@ module Manifest
       def set_default
         @model_manifest = @manifest.models[@item_name]
         @model_list_manifest = @model_manifest.lists[@list_name]
-        @list_manifest['default_page_size'] ||= @model_list_manifest.default_page_size
-        @list_manifest['max_page_size'] ||= @model_list_manifest.max_page_size
+        @list_manifest['where'] ||= {}
+        @list_manifest['includes'] ||= {}
       end
       
       def init
-        @default_page_size = @list_manifest['default_page_size']
-        @max_page_size = @list_manifest['max_page_size']
-        
         @model = ::Manifest.item_name_to_model @item_name
         @table_name = @model.table_name
-        if @model.content?
-          @owner_model = @model.owner_model
-          @owner_table_name = @owner_model.table_name if @owner_model
-        end
+        @where = WhereFactory.factory self, @list_manifest['where']
+        @includes = IncludeFactory.factory self, @list_manifest['includes']
+      end
+      
+      def default_page_size
+        @model_list_manifest.default_page_size
+      end
+      
+      def max_page_size
+        @model_list_manifest.max_page_size
       end
       
       def page_number prm = nil
@@ -48,25 +54,20 @@ module Manifest
       
       def page_size prm
         page_size = prm.to_i
-        page_size = @max_page_size if page_size > @max_page_size
-        page_size = @default_page_size if page_size < 1
+        page_size = self.max_page_size if page_size > self.max_page_size
+        page_size = self.default_page_size if page_size < 1
         page_size
       end
       
-      def where
-        @model.list_where
+      def where_condition
+        method_name = @where.conditions do |name|
+          name
+        end
+        @model.__send__ method_name
       end
       
-      def includes
-        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
+      def include_hash
+        @includes.includes
       end
       
       def order
@@ -74,11 +75,11 @@ module Manifest
       end
       
       def items operators, options, offset, page_size
-        @model.where(self.where).includes(self.includes).order(self.order).offset(offset).limit(page_size)
+        @model.where(self.where_condition).includes(self.include_hash).order(self.order).offset(offset).limit(page_size)
       end
       
       def count operators, options
-        @model.where(self.where).includes(self.includes).count
+        @model.where(self.where_condition).includes(self.include_hash).count
       end
       
       def paginate count, offset, page_size
index 440b1fa..da0eefa 100644 (file)
@@ -12,27 +12,25 @@ module Manifest
         @filter_key = @model_list_manifest.filter_key
       end
       
-      def where filter_item_id
-        w = @model.list_where
+      def where_condition filter_item_id
+        w = super
         w += ' and ' unless w.blank?
         [w + @table_name + '.' + @filter_key + ' = ?', filter_item_id] 
       end
       
-      def includes
-        return @includes if @includes
-        w = @owner_model ? {@owner_model.item_name => {}} : {}
-        w.merge({@filter_item_name => {} })  if @filter_item_name
-        w
+      def include_hash
+        w = super
+        w.merge({@filter_item_name => {} }) unless w[@filter_item_name]
       end
       
       def items operators, options, offset, page_size
         filter_item_id = options[:id]
-        @model.where(self.where(filter_item_id)).includes(self.includes).order(self.order).offset(offset).limit(page_size)
+        @model.where(self.where_condition(filter_item_id)).includes(self.include_hash).order(self.order).offset(offset).limit(page_size)
       end
       
       def count operators, options
         filter_item_id = options[:id]
-        @model.where(self.where(filter_item_id)).includes(self.includes).count
+        @model.where(self.where_condition(filter_item_id)).includes(self.include_hash).count
       end
       
       def self._add_action item_name, action_name, list_name, list_conf
similarity index 55%
rename from lib/manifest/list/element_filter.rb
rename to lib/manifest/list/foreign_filter.rb
index b846268..3ad7b0f 100644 (file)
@@ -1,6 +1,6 @@
 module Manifest
   module ListModule
-    class ElementFilterList < FilterList
+    class ForeignFilterList < FilterList
       
       def set_default
         super
@@ -10,14 +10,10 @@ module Manifest
         super
       end
       
-      def includes
-        {@owner_model.item_name => {}}
-      end
-      
-      def where filter_item
-        w = @model.list_where
+      def where_condition filter_item
+        w = super
         w += ' and ' unless w.blank?
-        [w + @owner_table_name + '.' + @filter_key + ' = ?', filter_item.id] 
+        [w + @filter_item_name + '.id' + ' = ?', filter_item.id] 
       end
       
       def self.add_action item_name, action_name, list_name, list_conf
diff --git a/lib/manifest/list/includes.rb b/lib/manifest/list/includes.rb
new file mode 100644 (file)
index 0000000..7873585
--- /dev/null
@@ -0,0 +1,24 @@
+require_dependency "manifest/list/includes/base"
+require_dependency "manifest/list/includes/method"
+require_dependency "manifest/list/includes/auto"
+require_dependency "manifest/list/includes/none"
+module Manifest
+  module ListModule
+    class IncludeFactory
+      include IncludeModule
+      @@types = {
+        'method' => IncludeMethod, 'auto' => IncludeAuto, 'none' => IncludeNone
+      }
+      
+      def self.factory list, my_manifest
+        my_manifest['type'] ||=  'auto'
+        type = my_manifest['type']
+        raise "undefined type for lists > #{list.item_name} > #{list.list_name} > includes\n" unless type
+        my_class = @@types[type]
+        raise "undefined class for lists > #{list.item_name} > #{list.list_name} > includes > #{type}\n" unless my_class
+        my_class.new(list, my_manifest)
+      end
+      
+    end
+  end
+end
diff --git a/lib/manifest/list/includes/auto.rb b/lib/manifest/list/includes/auto.rb
new file mode 100644 (file)
index 0000000..73d5eaa
--- /dev/null
@@ -0,0 +1,48 @@
+module Manifest
+  module ListModule
+    module IncludeModule
+      class IncludeAuto < Base
+        attr :tree_name
+        def set_default
+          super
+          @includes_manifest['args']['tree_name'] ||= 'owner'
+        end
+        
+        def init
+          super
+          @tree_name = @args['tree_name']
+          @parent_model_manifest = @list.model_manifest.tree_model_manifest(@tree_name)
+          if @parent_model_manifest
+            @parent_model_name = @parent_model_manifest.classify.item_name
+            @root_model_manifest = @parent_model_manifest.tree_model_manifest(@tree_name)
+            if @root_model_manifest
+              @root_model_name = @root_model_manifest.classify.item_name
+            end
+          end
+        end
+        
+        def includes
+          if @parent_model_name
+            if @root_model_name
+              {@parent_model_name => {@root_model_name => {}}}
+            else
+              {@parent_model_name => {}}
+            end
+          else
+            {}
+          end
+        end
+        
+        def foreign_model_name
+          if @root_model_name
+            @root_model_name
+          else
+            @parent_model_name
+          end
+        end
+        
+      end
+      
+    end
+  end
+end
diff --git a/lib/manifest/list/includes/base.rb b/lib/manifest/list/includes/base.rb
new file mode 100644 (file)
index 0000000..742f7f1
--- /dev/null
@@ -0,0 +1,38 @@
+module Manifest
+  module ListModule
+    module IncludeModule
+      class Base
+        attr :list, :includes_manifest, :type
+        def initialize list, includes_manifest
+          @list = list
+          @includes_manifest = includes_manifest
+          self.set_default
+          self.init
+        end
+        
+        def set_default
+          @includes_manifest['args'] ||= {}
+        end
+        
+        def init
+          @type = @includes_manifest['type']
+          @args = @includes_manifest['args']
+        end
+        
+        def item_name
+          @list.item_name
+        end
+        
+        def list_name
+          @list.list_name
+        end
+        
+        def model
+          @list.model
+        end
+        
+      end
+      
+    end
+  end
+end
diff --git a/lib/manifest/list/includes/method.rb b/lib/manifest/list/includes/method.rb
new file mode 100644 (file)
index 0000000..7b99fcb
--- /dev/null
@@ -0,0 +1,24 @@
+module Manifest
+  module ListModule
+    module IncludeModule
+      class IncludeMethod < Base
+        attr :method_name
+        def set_default
+          super
+          @includes_manifest['args']['method_name'] ||= self.list_name + '_list_includes'
+        end
+        
+        def init
+          super
+          @method_name = @args['method_name']
+        end
+        
+        def includes
+          self.model.__send__ @method_name
+        end
+        
+      end
+      
+    end
+  end
+end
diff --git a/lib/manifest/list/includes/none.rb b/lib/manifest/list/includes/none.rb
new file mode 100644 (file)
index 0000000..0dae0b2
--- /dev/null
@@ -0,0 +1,22 @@
+module Manifest
+  module ListModule
+    module IncludeModule
+      class IncludeNone < Base
+        attr :tree_name
+        def set_default
+          super
+        end
+        
+        def init
+          super
+        end
+        
+        def includes
+          {}
+        end
+        
+      end
+      
+    end
+  end
+end
index 8ba028e..81a123b 100644 (file)
@@ -1,7 +1,7 @@
 module Manifest
   module ListModule
     class PrivateList < Base
-      def where operators
+      def where_condition operators
         case @model.owner_type
         when :author
           operator = operators.author
@@ -17,16 +17,18 @@ module Manifest
         else
           @table_name
         end
-        [t + '.' + @model.owner_type.to_s + '_id = ?', operator.id]
+        @where.conditions do |name|
+          [t + '.' + @model.owner_type.to_s + '_id = ?', operator.id]
+        end
       end
     
       def items operators, options, offset, page_size
-        @model.where(self.where(operators)).includes(self.includes).order(self.order).offset(offset).limit(page_size)
+        @model.where(self.where_condition(operators)).includes(self.include_hash).order(self.order).offset(offset).limit(page_size)
       end
       
       def count operators, options
         filter_item_id = options[:id]
-        @model.where(self.where(operators)).includes(self.includes).count
+        @model.where(self.where_condition(operators)).includes(self.include_hash).count
       end
       
     end
index d5fb47f..6a19c43 100644 (file)
@@ -10,22 +10,6 @@ module Manifest
         super
       end
       
-      def where
-        @model.list_where
-      end
-      
-      def includes
-        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
         @model.list_order
       end
index b5a0a63..b2bf563 100644 (file)
@@ -19,8 +19,6 @@ module Manifest
       def where filter_item_id
         w = @model.list_where
         w += ' and ' unless w.blank?
-   p  @through
-   p  @filter_key
         [w + @through + '.' + @filter_key + ' = ?', filter_item_id] 
       end
       
diff --git a/lib/manifest/list/where.rb b/lib/manifest/list/where.rb
new file mode 100644 (file)
index 0000000..6a67f63
--- /dev/null
@@ -0,0 +1,23 @@
+require_dependency "manifest/list/where/base"
+require_dependency "manifest/list/where/method"
+require_dependency "manifest/list/where/auto"
+module Manifest
+  module ListModule
+    class WhereFactory
+      include WhereModule
+      @@types = {
+        'method' => WhereMethod, 'auto' => WhereAuto
+      }
+      
+      def self.factory list, my_manifest
+        my_manifest['type'] ||=  'auto'
+        type = my_manifest['type']
+        raise "undefined type for lists > #{list.item_name} > #{list.list_name} > where\n" unless type
+        my_class = @@types[type]
+        raise "undefined class for lists > #{list.item_name} > #{list.list_name} > where > #{type}\n" unless my_class
+        my_class.new(list, my_manifest)
+      end
+      
+    end
+  end
+end
diff --git a/lib/manifest/list/where/auto.rb b/lib/manifest/list/where/auto.rb
new file mode 100644 (file)
index 0000000..ca8c14d
--- /dev/null
@@ -0,0 +1,32 @@
+module Manifest
+  module ListModule
+    module WhereModule
+      class WhereAuto < Base
+        attr :method_name
+        def set_default
+          super
+          @where_manifest['args']['method_name'] ||= self.base_name
+        end
+        
+        def init
+          super
+          @method_name = @args['method_name']
+        end
+        
+        def base_name
+          if self.model.content?
+            'public_list_where'
+          else
+            'list_where'
+          end
+        end
+        
+        def conditions
+          yield @method_name
+        end
+        
+      end
+      
+    end
+  end
+end
diff --git a/lib/manifest/list/where/base.rb b/lib/manifest/list/where/base.rb
new file mode 100644 (file)
index 0000000..41ba04f
--- /dev/null
@@ -0,0 +1,38 @@
+module Manifest
+  module ListModule
+    module WhereModule
+      class Base
+        attr :list, :where_manifest, :type
+        def initialize list, where_manifest
+          @list = list
+          @where_manifest = where_manifest
+          self.set_default
+          self.init
+        end
+        
+        def set_default
+          @where_manifest['args'] ||= {}
+        end
+        
+        def init
+          @type = @where_manifest['type']
+          @args = @where_manifest['args']
+        end
+        
+        def item_name
+          @list.item_name
+        end
+        
+        def list_name
+          @list.list_name
+        end
+        
+        def model
+          @list.model
+        end
+        
+      end
+      
+    end
+  end
+end
diff --git a/lib/manifest/list/where/method.rb b/lib/manifest/list/where/method.rb
new file mode 100644 (file)
index 0000000..723edde
--- /dev/null
@@ -0,0 +1,24 @@
+module Manifest
+  module ListModule
+    module WhereModule
+      class WhereMethod < Base
+        attr :method_name
+        def set_default
+          super
+          @where_manifest['args']['method_name'] ||= self.list_name + '_list_where'
+        end
+        
+        def init
+          super
+          @method_name = @args['method_name']
+        end
+        
+        def conditions
+          yield @method_name
+        end
+        
+      end
+      
+    end
+  end
+end
index 256b4d1..6c76ea4 100644 (file)
@@ -14,7 +14,7 @@ module Manifest
     end
     
     attr :model_name, :model_manifest, 
-      :attributes, :associations, :lists
+      :attributes, :associations, :tree, :lists
     def initialize manifest, model_name, model_manifest
       @manifest = manifest
       @model_name = model_name
@@ -26,6 +26,7 @@ module Manifest
     def set_default
       @model_manifest['attributes'] ||= {}
       @model_manifest['associations'] ||= {}
+      @model_manifest['tree'] ||= {}
       @model_manifest['lists'] ||= {}
     end
     
@@ -35,6 +36,7 @@ module Manifest
         @attributes[attribute_name] = ModelModule::Attribute.new(self, attribute_name, attribute_manifest)
       }
       @associations = ModelModule::Association.new(self, @model_manifest['associations'])
+      @tree = @model_manifest['tree']
       @lists = {}
       @model_manifest['lists'].each {|list_name, list_manifest|
         @lists[list_name] = ModelModule::ListFactory.factory(self, list_name, list_manifest)
@@ -45,6 +47,20 @@ module Manifest
       ::Manifest.item_name_to_model @model_name
     end
     
+    def tree_model_manifest tree_name
+      if tree_name
+        if @tree[tree_name]
+          r = ::Manifest.manifest.models[@tree[tree_name]]
+          raise "undefined tree_model for models > #{@model_name} > tree > #{tree_name}\n" unless r
+          r
+        else
+          nil
+        end
+      else
+        nil
+      end
+    end
+    
   end
 end
 
index ce1ee6d..063fdcf 100644 (file)
@@ -14,11 +14,11 @@ module Manifest
         
         def set_default
           @has_many_manifest['model_name'] ||= @has_many_name.singularize
+          @has_many_manifest['foreign_key'] ||= @association.model_name + '_id'
         end
         
         def init
           @model_name = @has_many_manifest['model_name']
-          raise "undefined foreign_key for models > #{@association.model.model_name} > associations > has_many > #{@has_many_name}\n" unless @has_many_manifest['foreign_key']
           @foreign_key = @has_many_manifest['foreign_key']
           @through = @has_many_manifest['through']
         end
index 1e27057..7cf723d 100644 (file)
@@ -14,11 +14,11 @@ module Manifest
         
         def set_default
           @has_one_manifest['model_name'] ||= @has_one_name
+          @has_one_manifest['foreign_key'] ||= @association.model_name + '_id'
         end
         
         def init
           @model_name = @has_one_manifest['model_name']
-          raise "undefined foreign_key for models > #{@association.model.model_name} > associations > has_one > #{@has_one_name}\n" unless @has_one_manifest['foreign_key']
           @foreign_key = @has_one_manifest['foreign_key']
         end
         
index e7c1803..d32a6b3 100644 (file)
@@ -2,11 +2,9 @@ require_dependency "manifest/model/list/base"
 require_dependency "manifest/model/list/public"
 require_dependency "manifest/model/list/private"
 require_dependency "manifest/model/list/system_resource"
-require_dependency "manifest/model/list/has_many"
-require_dependency "manifest/model/list/has_many_through"
 require_dependency "manifest/model/list/filter"
 require_dependency "manifest/model/list/through_filter"
-require_dependency "manifest/model/list/element_filter"
+require_dependency "manifest/model/list/foreign_filter"
 require_dependency "manifest/model/list/play"
 module Manifest
   module ModelModule
@@ -14,8 +12,7 @@ module Manifest
       include ListModule
       @@types = {
         'public' => PublicList, 'private' => PrivateList, 'system_resource' => SystemResourceList,
-        'has_many' => HasManyList, 'has_many_through' => HasManyThroughList, 'filter' => FilterList, 
-        'through_filter' => ThroughFilterList, 'element_filter' => ElementFilterList, 
+        'filter' => FilterList, 'through_filter' => ThroughFilterList, 'foreign_filter' => ForeignFilterList, 
         'play' => PlayList
       }
       
similarity index 93%
rename from lib/manifest/model/list/element_filter.rb
rename to lib/manifest/model/list/foreign_filter.rb
index 2dea906..77eff0c 100644 (file)
@@ -1,7 +1,7 @@
 module Manifest
   module ModelModule
     module ListModule
-      class ElementFilterList < FilterList
+      class ForeignFilterList < FilterList
         
         def set_default
           super
diff --git a/lib/manifest/model/list/has_many.rb b/lib/manifest/model/list/has_many.rb
deleted file mode 100644 (file)
index 869c978..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-module Manifest
-  module ModelModule
-    module ListModule
-      class HasManyList < Base
-        def initialize list, list_name, list_manifest
-          super
-        end
-        
-        def set_default
-          super
-          return
-          option_manifest['association_name'] ||= 100
-        end
-        
-        def init
-          super
-          return
-          @list_list_conf = @manifest.list(@item_name).lists[list_name] || {}
-          @association_name = @list_list_conf['association_name']
-          @has_many_conf = @manifest.model(@item_name).associations['has_many'] || {}
-          @association_conf = @has_many_conf[@association_name] || {}
-          @association_model_name = @association_conf['model']
-          @association_model = @association_model_name.classify.constantize
-          @foreign_key = @association_conf['foreign_key']
-         if @association_model.content?
-            @owner_model = @association_model.owner_model
-            @owner_table_name = @owner_model.table_name if @owner_model
-          end
-        end
-        
-        def where parent_item
-          w = @association_model.list_where
-          w += ' and ' unless w.blank?
-          [w + @association_model.table_name + '.' + @foreign_key + ' = ?', parent_item.id] 
-        end
-        
-        def includes
-    #   @with_model_name ? {@with_model_name.classify.constantize.table_name => {}} : {}
-          w = @owner_model ? {@owner_model.item_name => {}} : {}
-          w.merge({}) 
-        end
-        
-        def items parent_item
-           @association_model.where(self.where(parent_item)).includes(self.includes).order(self.order).offset(@offset).limit(@page_size)
-        end
-        
-        def paginate parent_item
-          Kaminari.paginate_array(Array.new(@association_model.where(self.where(parent_item)).includes(self.includes).count, nil)).page(@offset).per(@page_size)
-        end
-        
-        def self._add_action item_name, action_name, list_name, list_conf
-          model = item_name.classify.constantize
-          controller_name = model.plural + 'Controller'
-          controller = controller_name.constantize
-          association_name = list_conf['association_name']
-          has_many_conf = Pettanr::Application::manifest.model(item_name).associations['has_many'] || {}
-          association_conf = has_many_conf[association_name] || {}
-          association_model_name = association_conf['model']
-          return if controller.method_defined?(action_name)
-          controller.define_method(action_name) do 
-            has_many_list item_name, list_name, association_model_name, params
-          end
-        end
-      end
-      
-    end
-  end
-end
diff --git a/lib/manifest/model/list/has_many_through.rb b/lib/manifest/model/list/has_many_through.rb
deleted file mode 100644 (file)
index 21c12df..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-module Manifest
-  module ModelModule
-    module ListModule
-      class HasManyThroughList < Base
-        attr :list, :list_name, :list_manifest, 
-          :belongs_to, :has_many, :has_one
-        
-        def set_default
-          super
-        end
-        
-        def init
-          super
-          return
-          @list_list_conf = @manifest.list(@item_name).lists[list_name] || {}
-          @association_name = @list_list_conf['association_name']
-          @has_many_conf = @manifest.model(@item_name).associations['has_many'] || {}
-          @association_conf = @has_many_conf[@association_name] || {}
-          @association_through_model_name = @association_conf['through']
-          @association_through_model = @association_through_model_name.classify.constantize
-          @association_model_name = @association_conf['model']
-          @association_model = @association_model_name.classify.constantize
-          @foreign_key = @association_conf['foreign_key']
-         if @association_model.content?
-            @owner_model = @association_model.owner_model
-            @owner_table_name = @owner_model.table_name if @owner_model
-          end
-        end
-        
-        def where root_item
-          w = @association_model.list_where
-          w += ' and ' unless w.blank?
-          [w + @association_through_model.table_name + '.' + @foreign_key + ' = ?', root_item.id] 
-        end
-        
-        def includes
-          {@association_through_model.table_name => {@item_name => {}}}
-        end
-        
-        def items root_item
-           @association_model.where(self.where(root_item)).includes(self.includes).order(self.order).offset(@offset).limit(@page_size)
-        end
-        
-        def paginate root_item
-          Kaminari.paginate_array(Array.new(@association_model.where(self.where(root_item)).includes(self.includes).count, nil)).page(@offset).per(@page_size)
-        end
-        
-        def self.add_action item_name, action_name, list_name, list_conf
-          return
-        end
-      end
-      
-    end
-  end
-end
index 6b59afc..8458c51 100644 (file)
@@ -30,6 +30,10 @@ module Peta
       self.owner_type.to_s + '_id'
     end
     
+    def self.public_list_where
+      ''
+    end
+    
     def self.edit content_id, operators
       content = self.find content_id, self.show_opt
       raise ActiveRecord::Forbidden unless content.own?(operators)
index 7856fc9..f1bdea4 100644 (file)
@@ -5,7 +5,7 @@
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_author": {\r
@@ -26,7 +26,7 @@
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_author": {\r
@@ -45,7 +45,7 @@
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_panel": {\r
@@ -60,7 +60,7 @@
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_panel": {\r
@@ -76,7 +76,7 @@
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_author": {\r
@@ -88,7 +88,7 @@
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_author": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_comic": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_author": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_story": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_story": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_story": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_story": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_sheet": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_sheet": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_scroll": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_scroll": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_panel": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_panel": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_panel": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_panel": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_writing_format": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_writing_format": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "show": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         }\r
       }\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_panel": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_panel": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_panel": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_panel": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "show": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         }\r
       }\r
     },\r
-    "pictures": {},\r
+    "pictures": {\r
+      "actions": {\r
+        "show": {\r
+          "type": "show"\r
+        }\r
+      }\r
+    },\r
     "resource_pictures": {\r
       "actions": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_license": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_license": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "show": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         }\r
       }\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_system_picture": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_system_picture": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "show": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         }\r
       }\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "by_license_group": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "count_by_license_group": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "scrolls": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         }\r
       }\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "resource_pictures": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         }\r
       }\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         },\r
         "show": {\r
         "count": {\r
           "type": "count",\r
           "args": {\r
-            "list_name": "public_list"\r
+            "list_name": "public"\r
           }\r
         }\r
       }\r
           "type": "list",\r
           "args": {\r
             "item_name": "scroll",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "scroll_panels": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "scroll_panel",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "comics": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "comic",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "stories": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "story",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "story_sheets": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "story_sheet",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "sheets": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "sheet",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "sheet_panels": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "sheet_panel",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "panels": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "panel",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "panel_pictures": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "panel_picture",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "speech_balloons": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "speech_balloon",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "speeches": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "speech",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "balloons": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "balloon",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "ground_pictures": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "ground_picture",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "ground_colors": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "ground_color",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "original_pictures": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "original_picture",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         },\r
         "resource_pictures": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "resource_picture",\r
-            "list_name": "private_list"\r
+            "list_name": "private"\r
           }\r
         }\r
       }\r
   },\r
   "models": {\r
     "scroll": {\r
-      "class_name": "Scroll",\r
-      "table_name": "scrolls",\r
       "associations": {\r
         "belongs_to": {\r
-          "author": {\r
-            "id_column": "author_id"\r
-          }\r
+          "author": {}\r
         },\r
         "has_many": {\r
-          "scroll_panels": {\r
-            "foreign_key": "scroll_id",\r
-            "model_name": "scroll_panel"\r
-          },\r
+          "scroll_panels": {},\r
           "panels": {\r
-            "through": "scroll_panel",\r
-            "foreign_key": "scroll_id",\r
-            "model_name": "panel"\r
+            "through": "scroll_panel"\r
           }\r
         }\r
       },\r
         }\r
       },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_author": {\r
           "type": "filter",\r
-          "args": {\r
-            "filter_item_name": "author",\r
-            "filter_key": "author_id"\r
-          }\r
+          "args": {}\r
         },\r
         "by_panel": {\r
           "type": "through_filter",\r
           "args": {\r
-            "filter_item_name": "panel",\r
-            "through": "scroll_panels",\r
-            "filter_key": "panel_id"\r
+            "through": "scroll_panels"\r
           }\r
         },\r
         "play": {\r
       }\r
     },\r
     "scroll_panel": {\r
-      "class_name": "ScrollPanel",\r
-      "table_name": "scroll_panels",\r
       "associations": {\r
         "belongs_to": {\r
-          "panel": {\r
-            "id_column": "panel_id"\r
-          },\r
-          "scroll": {\r
-            "id_column": "scroll_id"\r
-          }\r
+          "panel": {},\r
+          "scroll": {}\r
         },\r
         "has_many": {}\r
       },\r
           "type": "datetime"\r
         }\r
       },\r
+      "tree": {\r
+        "owner": "scroll"\r
+      },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_scroll": {\r
-          "type": "filter"\r
+          "type": "foreign_filter"\r
         },\r
         "by_panel": {\r
-          "type": "filter"\r
+          "type": "foreign_filter"\r
         }\r
       }\r
     },\r
     "comic": {\r
-      "class_name": "Comic",\r
-      "table_name": "comics",\r
       "associations": {\r
         "belongs_to": {\r
-          "author": {\r
-            "id_column": "author_id"\r
-          }\r
+          "author": {}\r
         },\r
         "has_many": {\r
-          "stories": {\r
-            "foreign_key": "comic_id",\r
-            "model_name": "story"\r
-          }\r
-        },\r
-        "has_many_through": {}\r
+          "stories": {}\r
+        }\r
       },\r
       "attributes": {\r
         "id": {\r
         }\r
       },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_author": {\r
       }\r
     },\r
     "story": {\r
-      "class_name": "Story",\r
-      "table_name": "stories",\r
       "associations": {\r
         "belongs_to": {\r
-          "comic": {\r
-            "id_column": "comic_id"\r
-          }\r
+          "comic": {}\r
         },\r
         "has_many": {\r
-          "story_sheets": {\r
-            "foreign_key": "story_id",\r
-            "model_name": "story_sheet"\r
-          },\r
+          "story_sheets": {},\r
           "sheets": {\r
-            "through": "story_sheets",\r
-            "foreign_key": "story_id",\r
-            "model_name": "sheet"\r
+            "through": "story_sheets"\r
           }\r
         }\r
       },\r
           "type": "datetime"\r
         }\r
       },\r
+      "tree": {\r
+        "owner": "comic"\r
+      },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_comic": {\r
           "type": "filter"\r
         },\r
         "by_sheet": {\r
-          "type": "through_filter"\r
+          "type": "through_filter",\r
+          "args": {\r
+            "through": "story_sheets"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "element_filter"\r
+          "type": "foreign_filter"\r
         },\r
         "play": {\r
           "type": "play"\r
       }\r
     },\r
     "story_sheet": {\r
-      "class_name": "StorySheet",\r
-      "table_name": "story_sheets",\r
       "associations": {\r
         "belongs_to": {\r
-          "story": {\r
-            "id_column": "story_id"\r
-          },\r
-          "sheet": {\r
-            "id_column": "sheet_id"\r
-          }\r
+          "story": {},\r
+          "sheet": {}\r
         },\r
         "has_many": {}\r
       },\r
           "type": "datetime"\r
         }\r
       },\r
+      "tree": {\r
+        "owner": "story"\r
+      },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_story": {\r
       }\r
     },\r
     "sheet": {\r
-      "class_name": "Sheet",\r
-      "table_name": "sheets",\r
       "associations": {\r
         "belongs_to": {\r
-          "author": {\r
-            "id_column": "author_id"\r
-          }\r
+          "author": {}\r
         },\r
         "has_many": {\r
-          "story_sheets": {\r
-            "foreign_key": "story_id",\r
-            "model_name": "story_sheet"\r
-          },\r
+          "story_sheets": {},\r
           "stories": {\r
-            "through": "story_sheets",\r
-            "foreign_key": "sheet_id",\r
-            "model_name": "story"\r
-          },\r
-          "sheet_panels": {\r
-            "foreign_key": "sheet_id",\r
-            "model_name": "sheet_panel"\r
+            "through": "story_sheets"\r
           },\r
+          "sheet_panels": {},\r
           "panels": {\r
-            "through": "sheet_panels",\r
-            "foreign_key": "sheet_id",\r
-            "model_name": "panel"\r
+            "through": "sheet_panels"\r
           }\r
         }\r
       },\r
         }\r
       },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_story": {\r
-          "type": "through_filter"\r
+          "type": "through_filter",\r
+          "args": {\r
+            "through": "story_sheets"\r
+          }\r
         },\r
         "by_panel": {\r
-          "type": "through_filter"\r
+          "type": "through_filter",\r
+          "args": {\r
+            "through": "sheet_panels"\r
+          }\r
         },\r
         "by_author": {\r
           "type": "filter"\r
       }\r
     },\r
     "sheet_panel": {\r
-      "class_name": "SheetPanel",\r
-      "table_name": "sheet_panels",\r
       "associations": {\r
         "belongs_to": {\r
-          "sheet": {\r
-            "id_column": "sheet_id"\r
-          },\r
-          "panel": {\r
-            "id_column": "panel_id"\r
-          }\r
+          "sheet": {},\r
+          "panel": {}\r
         },\r
         "has_many": {}\r
       },\r
           "type": "datetime"\r
         }\r
       },\r
+      "tree": {\r
+        "owner": "sheet"\r
+      },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_sheet": {\r
       }\r
     },\r
     "panel": {\r
-      "class_name": "Panel",\r
-      "table_name": "panels",\r
       "associations": {\r
         "belongs_to": {\r
-          "author": {\r
-            "id_column": "author_id"\r
-          }\r
+          "author": {}\r
         },\r
         "has_many": {\r
-          "scroll_panels": {\r
-            "foreign_key": "panel_id",\r
-            "model_name": "scroll_panel"\r
-          },\r
+          "scroll_panels": {},\r
           "scrolls": {\r
-            "through": "scroll_panels",\r
-            "foreign_key": "panel_id",\r
-            "model_name": "scroll"\r
-          },\r
-          "sheet_panels": {\r
-            "foreign_key": "panel_id",\r
-            "model_name": "sheet_panel"\r
+            "through": "scroll_panels"\r
           },\r
+          "sheet_panels": {},\r
           "sheets": {\r
-            "through": "sheet_panels",\r
-            "foreign_key": "panel_id",\r
-            "model_name": "sheet"\r
-          },\r
-          "panel_pictures": {\r
-            "foreign_key": "panel_id",\r
-            "model_name": "panel_picture"\r
-          },\r
-          "speech_balloons": {\r
-            "foreign_key": "panel_id",\r
-            "model_name": "speech_balloon"\r
+            "through": "sheet_panels"\r
           },\r
-          "ground_pictures": {\r
-            "foreign_key": "panel_id",\r
-            "model_name": "ground_picture"\r
-          },\r
-          "ground_colors": {\r
-            "foreign_key": "panel_id",\r
-            "model_name": "ground_color"\r
-          }\r
+          "panel_pictures": {},\r
+          "speech_balloons": {},\r
+          "ground_pictures": {},\r
+          "ground_colors": {}\r
         }\r
       },\r
       "attributes": {\r
         }\r
       },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_scroll": {\r
           "type": "through_filter",\r
           "args": {\r
-            "filter_item_name": "scroll",\r
-            "through": "scroll_panels",\r
-            "filter_key": "scroll_id"\r
+            "through": "scroll_panels"\r
           }\r
         },\r
         "by_sheet": {\r
-          "type": "through_filter"\r
+          "type": "through_filter",\r
+          "args": {\r
+            "through": "sheet_panels"\r
+          }\r
         },\r
         "by_author": {\r
           "type": "filter"\r
       }\r
     },\r
     "panel_picture": {\r
-      "class_name": "PanelPicture",\r
-      "table_name": "panel_pictures",\r
       "associations": {\r
         "belongs_to": {\r
-          "panel": {\r
-            "id_column": "panel_id"\r
-          }\r
+          "panel": {}\r
         },\r
         "has_many": {}\r
       },\r
           "type": "datetime"\r
         }\r
       },\r
+      "tree": {\r
+        "owner": "panel",\r
+        "panel": "panel"\r
+      },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_panel": {\r
-          "type": "filter"\r
+          "type": "filter",\r
+          "args": {\r
+            "where_name": "public_list_where"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "element_filter"\r
+          "type": "foreign_filter",\r
+          "args": {\r
+            "tree_name": "owner"\r
+          }\r
         }\r
       }\r
     },\r
     "speech_balloon": {\r
-      "class_name": "SpeechBalloon",\r
-      "table_name": "speech_balloons",\r
       "extend": "classname",\r
       "associations": {\r
         "belongs_to": {\r
-          "panel": {\r
-            "id_column": "panel_id"\r
-          }\r
+          "panel": {}\r
         },\r
         "has_many": {},\r
         "has_one": {\r
-          "balloon": {\r
-            "foreign_key": "speech_balloon_id",\r
-            "model_name": "balloon"\r
-          },\r
-          "speech": {\r
-            "foreign_key": "speech_balloon_id",\r
-            "model_name": "speech"\r
-          }\r
+          "balloon": {},\r
+          "speech": {}\r
         }\r
       },\r
       "attributes": {\r
           "type": "datetime"\r
         }\r
       },\r
+      "tree": {\r
+        "owner": "panel",\r
+        "panel": "panel"\r
+      },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_panel": {\r
           "type": "filter"\r
         },\r
         "by_author": {\r
-          "type": "element_filter"\r
+          "type": "foreign_filter"\r
         }\r
       }\r
     },\r
     "balloon": {\r
-      "class_name": "Balloon",\r
-      "table_name": "balloons",\r
       "associations": {\r
         "belongs_to": {\r
-          "speech_balloon": {\r
-            "id_column": "speech_balloon_id"\r
-          },\r
-          "system_picture": {\r
-            "id_column": "system_picture_id"\r
-          }\r
+          "speech_balloon": {},\r
+          "system_picture": {}\r
         },\r
         "has_many": {}\r
       },\r
           "type": "datetime"\r
         }\r
       },\r
+      "tree": {\r
+        "owner": "speech_balloon",\r
+        "panel": "speech_balloon"\r
+      },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_panel": {\r
           "type": "filter"\r
         },\r
         "by_author": {\r
-          "type": "element_filter"\r
+          "type": "foreign_filter"\r
         }\r
       }\r
     },\r
     "speech": {\r
-      "class_name": "Speech",\r
-      "table_name": "speeches",\r
       "associations": {\r
         "belongs_to": {\r
-          "speech_balloon": {\r
-            "id_column": "speech_balloon_id"\r
-          },\r
-          "writing_format": {\r
-            "id_column": "writing_format_id"\r
-          }\r
+          "speech_balloon": {},\r
+          "writing_format": {}\r
         },\r
         "has_many": {}\r
       },\r
           "type": "datetime"\r
         }\r
       },\r
+      "tree": {\r
+        "owner": "speech_balloon",\r
+        "panel": "speech_balloon"\r
+      },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
         "by_speech_balloon": {\r
       }\r
     },\r
     "ground_picture": {\r
-      "class_name": "GroundPicture",\r
-      "table_name": "ground_pictures",\r
       "associations": {\r
         "belongs_to": {\r
-          "panel": {\r
-            "id_column": "panel_id"\r
-          }\r
+          "panel": {}\r
         },\r
         "has_many": {}\r
       },\r
           "type": "datetime"\r
         }\r
       },\r
+      "tree": {\r
+        "owner": "panel",\r
+        "panel": "panel"\r
+      },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_panel": {\r
           "type": "filter"\r
         },\r
         "by_author": {\r
-          "type": "element_filter"\r
+          "type": "foreign_filter"\r
         }\r
       }\r
     },\r
     "ground_color": {\r
-      "class_name": "GroundColor",\r
-      "table_name": "ground_colors",\r
       "associations": {\r
         "belongs_to": {\r
-          "panel": {\r
-            "id_column": "panel_id"\r
-          }\r
+          "panel": {}\r
         },\r
         "has_many": {}\r
       },\r
           "type": "datetime"\r
         }\r
       },\r
+      "tree": {\r
+        "owner": "panel",\r
+        "panel": "panel"\r
+      },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_panel": {\r
           "type": "filter"\r
         },\r
         "by_author": {\r
-          "type": "element_filter"\r
+          "type": "foreign_filter"\r
         }\r
       }\r
     },\r
     "original_picture": {\r
-      "class_name": "OriginalPicture",\r
-      "table_name": "original_pictures",\r
       "associations": {\r
         "belongs_to": {\r
-          "artist": {\r
-            "id_column": "artist_id"\r
-          }\r
+          "artist": {}\r
         },\r
         "has_many": {\r
-          "pictures": {\r
-            "foreign_key": "original_picture_id",\r
-            "model_name": "picture"\r
-          }\r
+          "pictures": {}\r
         },\r
         "has_one": {\r
-          "resource_picture": {\r
-            "foreign_key": "original_picture_id",\r
-            "model_name": "resource_picture"\r
-          }\r
+          "resource_picture": {}\r
         }\r
       },\r
       "attributes": {\r
         }\r
       },\r
       "lists": {\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         }\r
       }\r
     },\r
     "picture": {\r
-      "class_name": "Picture",\r
-      "table_name": "pictures",\r
       "associations": {\r
         "belongs_to": {\r
-          "license": {\r
-            "id_column": "license_id"\r
-          },\r
-          "artist": {\r
-            "id_column": "artist_id"\r
-          }\r
+          "license": {},\r
+          "artist": {}\r
         },\r
         "has_many": {},\r
         "has_one": {}\r
       }\r
     },\r
     "resource_picture": {\r
-      "class_name": "ResourcePicture",\r
-      "table_name": "resource_pictures",\r
       "associations": {\r
         "belongs_to": {\r
-          "original_picture": {\r
-            "id_column": "original_picture_id"\r
-          },\r
-          "license": {\r
-            "id_column": "license_id"\r
-          },\r
-          "artist": {\r
-            "id_column": "artist_id"\r
-          }\r
+          "original_picture": {},\r
+          "license": {},\r
+          "artist": {}\r
         },\r
         "has_many": {},\r
         "has_one": {}\r
         }\r
       },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
-        "private_list": {\r
+        "private": {\r
           "type": "private"\r
         },\r
         "by_license": {\r
       }\r
     },\r
     "speech_balloon_template": {\r
-      "class_name": "SpeechBalloonTemplate",\r
-      "table_name": "speech_balloon_templates",\r
       "associations": {\r
         "belongs_to": {\r
-          "system_picture": {\r
-            "id_column": "system_picture_id"\r
-          }\r
+          "system_picture": {}\r
         },\r
         "has_many": {\r
-          "speech_balloons": {\r
-            "foreign_key": "speech_balloon_template_id",\r
-            "model_name": "speech_balloon"\r
-          },\r
+          "speech_balloons": {},\r
           "panels": {\r
-            "through": "speech_balloons",\r
-            "foreign_key": "speech_balloon_template_id",\r
-            "model_name": "panel"\r
+            "through": "speech_balloons"\r
           }\r
         },\r
         "has_one": {}\r
         }\r
       },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
         "select_items": {\r
       }\r
     },\r
     "writing_format": {\r
-      "class_name": "WritingFormat",\r
-      "table_name": "writing_formats",\r
       "associations": {\r
         "belongs_to": {\r
-          "system_picture": {\r
-            "id_column": "system_picture_id"\r
-          }\r
+          "system_picture": {}\r
         },\r
         "has_many": {\r
-          "speeches": {\r
-            "foreign_key": "writing_format_id",\r
-            "model_name": "speech"\r
-          }\r
+          "speeches": {}\r
         },\r
         "has_one": {}\r
       },\r
         }\r
       },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
         "select_items": {\r
       }\r
     },\r
     "license_group": {\r
-      "class_name": "LicenseGroup",\r
-      "table_name": "license_groups",\r
       "associations": {\r
         "belongs_to": {},\r
         "has_many": {\r
-          "licenses": {\r
-            "foreign_key": "license_group_id",\r
-            "model_name": "license"\r
-          }\r
+          "licenses": {}\r
         },\r
         "has_one": {}\r
       },\r
         }\r
       },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
         "select_items": {\r
       }\r
     },\r
     "license": {\r
-      "class_name": "License",\r
-      "table_name": "licenses",\r
       "associations": {\r
         "belongs_to": {\r
-          "license_group": {\r
-            "id_column": "license_group_id"\r
-          },\r
-          "system_picture": {\r
-            "id_column": "system_picture_id"\r
-          }\r
+          "license_group": {},\r
+          "system_picture": {}\r
         },\r
         "has_many": {\r
-          "resource_pictures": {\r
-            "foreign_key": "license_id",\r
-            "model_name": "resource_picture"\r
-          }\r
+          "resource_pictures": {}\r
         },\r
         "has_one": {}\r
       },\r
         }\r
       },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         },\r
         "by_license_group": {\r
       }\r
     },\r
     "author": {\r
-      "class_name": "Author",\r
-      "table_name": "authors",\r
       "associations": {\r
         "belongs_to": {},\r
         "has_many": {\r
-          "scrolls": {\r
-            "foreign_key": "author_id",\r
-            "model_name": "scroll"\r
-          },\r
-          "comics": {\r
-            "foreign_key": "author_id",\r
-            "model_name": "comic"\r
-          },\r
-          "stories": {\r
-            "foreign_key": "author_id",\r
-            "model_name": "story"\r
-          },\r
-          "sheets": {\r
-            "foreign_key": "author_id",\r
-            "model_name": "sheet"\r
-          },\r
-          "panels": {\r
-            "foreign_key": "author_id",\r
-            "model_name": "panel"\r
-          }\r
+          "scrolls": {},\r
+          "comics": {},\r
+          "stories": {},\r
+          "sheets": {},\r
+          "panels": {}\r
         },\r
         "has_one": {}\r
       },\r
         }\r
       },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         }\r
       }\r
     },\r
     "artist": {\r
-      "class_name": "Artist",\r
-      "table_name": "artists",\r
       "associations": {\r
         "belongs_to": {},\r
         "has_many": {\r
-          "resource_pictures": {\r
-            "foreign_key": "artist_id",\r
-            "model_name": "resource_picture"\r
-          }\r
+          "resource_pictures": {}\r
         },\r
         "has_one": {}\r
       },\r
         }\r
       },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         }\r
       }\r
     },\r
     "system_picture": {\r
-      "class_name": "SystemPicture",\r
-      "table_name": "system_pictures",\r
       "associations": {\r
         "belongs_to": {},\r
         "has_many": {\r
-          "balloons": {\r
-            "foreign_key": "system_picture_id",\r
-            "model_name": "balloon"\r
-          },\r
-          "balloon_templates": {\r
-            "foreign_key": "system_picture_id",\r
-            "model_name": "balloon_template"\r
-          },\r
-          "licenses": {\r
-            "foreign_key": "system_picture_id",\r
-            "model_name": "license"\r
-          }\r
+          "balloons": {},\r
+          "speech_balloon_templates": {},\r
+          "licenses": {}\r
         },\r
         "has_one": {}\r
       },\r
         }\r
       },\r
       "lists": {\r
-        "public_list": {\r
+        "public": {\r
           "type": "public"\r
         }\r
       }\r
     },\r
     "lists": {\r
       "scroll": {\r
-        "public_list": {},\r
-        "private_list": {},\r
+        "public": {},\r
+        "private": {},\r
         "by_author": {},\r
         "by_panel": {},\r
         "play": {}\r
       },\r
       "scroll_panel": {\r
-        "public_list": {},\r
-        "private_list": {},\r
+        "public": {},\r
+        "private": {},\r
         "by_scroll": {},\r
         "by_panel": {}\r
       },\r
       "comic": {\r
-        "public_list": {},\r
-        "private_list": {},\r
+        "public": {},\r
+        "private": {},\r
         "by_author": {}\r
       },\r
       "story": {\r
-        "public_list": {},\r
-        "private_list": {},\r
+        "public": {},\r
+        "private": {},\r
         "by_comic": {},\r
         "by_sheet": {},\r
-        "by_author": {\r
-          "type": "element_filter",\r
-          "args": {\r
-            "from": "author",\r
-            "filter_key": "author_id"\r
-          }\r
-        },\r
-        "play": {\r
-          "type": "play",\r
-          "args": {\r
-            "model": "story_sheet",\r
-            "filter_key": "story_id"\r
-          }\r
-        }\r
+        "by_author": {},\r
+        "play": {}\r
       },\r
       "story_sheet": {\r
-        "public_list": {},\r
-        "private_list": {},\r
+        "public": {},\r
+        "private": {},\r
         "by_story": {},\r
         "by_sheet": {}\r
       },\r
       "sheet": {\r
-        "public_list": {},\r
-        "private_list": {},\r
+        "public": {},\r
+        "private": {},\r
         "by_story": {},\r
         "by_panel": {},\r
         "by_author": {},\r
-        "play": {\r
-          "type": "play",\r
-          "args": {\r
-            "model": "sheet_panel",\r
-            "filter_key": "sheet_id"\r
-          }\r
-        }\r
+        "play": {}\r
       },\r
       "sheet_panel": {\r
-        "public_list": {},\r
-        "private_list": {},\r
+        "public": {},\r
+        "private": {},\r
         "by_sheet": {},\r
         "by_panel": {}\r
       },\r
       "panel": {\r
-        "public_list": {},\r
-        "private_list": {},\r
+        "public": {},\r
+        "private": {},\r
         "by_scroll": {},\r
         "by_sheet": {},\r
         "by_author": {},\r
-        "by_speech_balloon_template": {\r
-          "type": "through_filter",\r
-          "args": {\r
-            "from": "speech_balloon_template",\r
-            "through": "speech_balloons",\r
-            "filter_key": "speech_balloon_template_id"\r
-          }\r
-        }\r
+        "by_speech_balloon_template": {}\r
       },\r
       "panel_picture": {\r
-        "public_list": {},\r
-        "private_list": {},\r
+        "public": {},\r
+        "private": {},\r
         "by_panel": {},\r
-        "by_author": {\r
-          "where": "by_author_where",\r
-          "includes": "by_author_includes"\r
-        }\r
+        "by_author": {}\r
       },\r
       "speech_balloon": {\r
-        "public_list": {},\r
-        "private_list": {},\r
+        "public": {},\r
+        "private": {},\r
         "by_panel": {},\r
-        "by_speech_balloon_template": {\r
-          "type": "filter",\r
-          "args": {\r
-            "from": "speech_balloon_template",\r
-            "filter_key": "speech_balloon_template_id"\r
-          }\r
-        },\r
+        "by_speech_balloon_template": {},\r
         "by_author": {}\r
       },\r
       "speech": {\r
-        "public_list": {},\r
-        "by_speech_balloon": {\r
-          "type": "filter",\r
-          "args": {\r
-            "from": "speech_balloon",\r
-            "includes": {\r
-              "speech_balloon": {\r
-                "panel": {}\r
-              }\r
-            },\r
-            "filter_key": "speech_balloon_id"\r
-          }\r
-        },\r
-        "by_writing_format": {\r
-          "type": "filter",\r
-          "args": {\r
-            "from": "writing_format",\r
-            "filter_key": "writing_format_id"\r
-          }\r
-        }\r
+        "public": {},\r
+        "by_speech_balloon": {},\r
+        "by_writing_format": {}\r
       },\r
       "balloon": {\r
-        "public_list": {},\r
-        "by_speech_balloon": {\r
-          "type": "filter",\r
-          "args": {\r
-            "from": "speech_balloon",\r
-            "includes": {\r
-              "speech_balloon": {\r
-                "panel": {}\r
-              }\r
-            },\r
-            "filter_key": "speech_balloon_id"\r
-          }\r
-        }\r
+        "public": {},\r
+        "by_speech_balloon": {}\r
       },\r
       "ground_picture": {\r
-        "public_list": {},\r
-        "private_list": {},\r
-        "by_panel": {\r
-          "type": "filter",\r
-          "args": {\r
-            "from": "panel",\r
-            "filter_key": "panel_id"\r
-          }\r
-        },\r
-        "by_author": {\r
-          "type": "element_filter",\r
-          "args": {\r
-            "from": "author",\r
-            "filter_key": "author_id"\r
-          }\r
-        }\r
+        "public": {},\r
+        "private": {},\r
+        "by_panel": {},\r
+        "by_author": {}\r
       },\r
       "ground_color": {\r
-        "public_list": {},\r
-        "private_list": {},\r
-        "by_panel": {\r
-          "type": "filter",\r
-          "args": {\r
-            "from": "panel",\r
-            "filter_key": "panel_id"\r
-          }\r
-        },\r
-        "by_author": {\r
-          "type": "element_filter",\r
-          "args": {\r
-            "from": "author",\r
-            "filter_key": "author_id"\r
-          }\r
-        }\r
+        "public": {},\r
+        "private": {},\r
+        "by_panel": {},\r
+        "by_author": {}\r
       },\r
       "original_picture": {\r
-        "private_list": {}\r
+        "private": {}\r
       },\r
       "picture": {},\r
       "resource_picture": {\r
-        "public_list": {},\r
-        "private_list": {},\r
-        "by_license": {\r
-          "type": "filter",\r
-          "args": {\r
-            "from": "license",\r
-            "filter_key": "license_id"\r
-          }\r
-        },\r
+        "public": {},\r
+        "private": {},\r
+        "by_license": {},\r
         "by_artist": {}\r
       },\r
       "speech_balloon_template": {\r
-        "public_list": {},\r
-        "select_items": {\r
-          "type": "system_resource"\r
-        }\r
+        "public": {},\r
+        "select_items": {}\r
       },\r
       "writing_format": {\r
-        "public_list": {},\r
-        "select_items": {\r
-          "type": "system_resource"\r
-        },\r
+        "public": {},\r
+        "select_items": {},\r
         "by_system_picture": {}\r
       },\r
       "license_group": {\r
-        "public_list": {},\r
-        "select_items": {\r
-          "type": "system_resource"\r
-        }\r
+        "public": {},\r
+        "select_items": {}\r
       },\r
       "license": {\r
-        "public_list": {},\r
+        "public": {},\r
         "by_license_group": {},\r
         "by_system_picture": {}\r
       },\r
       "author": {\r
-        "public_list": {}\r
+        "public": {}\r
       },\r
       "artist": {\r
-        "public_list": {}\r
+        "public": {}\r
       },\r
       "system_picture": {\r
-        "public_list": {}\r
+        "public": {}\r
       }\r
     },\r
     "elements": [\r