OSDN Git Service

work
authoryasushiito <yas@pen-chan.jp>
Mon, 16 Dec 2013 23:48:34 +0000 (08:48 +0900)
committeryasushiito <yas@pen-chan.jp>
Mon, 16 Dec 2013 23:48:34 +0000 (08:48 +0900)
app/assets/javascripts/manifest/work/lists.js.coffee.erb [moved from app/assets/javascripts/manifest/work/listss.js.coffee.erb with 89% similarity]
app/assets/javascripts/manifest/work/profilers.js.coffee.erb
config/routes.rb
lib/manifest/list.rb
lib/manifest/profiler.rb
public/manifest.json

@@ -97,7 +97,7 @@
       by_sheet: {\r
         type: 'through_filter',\r
         from: 'sheet',\r
-        through: 'sheet_panels',\r
+        through: 'story_sheets',\r
         filter_key: 'sheet_id',\r
       },\r
       by_author: {\r
       public_list: {\r
         type: 'public',\r
       },\r
+      private_list: {\r
+        type: 'private',\r
+      },\r
       scroll_panels: {\r
         type: 'has_many',\r
         association_name: 'scroll_panels',\r
       public_list: {\r
         type: 'public',\r
       },\r
+      private_list: {\r
+        type: 'private',\r
+      },\r
       by_panel: {\r
         type: 'filter',\r
         from: 'panel',\r
       public_list: {\r
         type: 'public',\r
       },\r
+      private_list: {\r
+        type: 'private',\r
+      },\r
       by_panel: {\r
         type: 'filter',\r
         from: 'panel',\r
       public_list: {\r
         type: 'public',\r
       },\r
+      by_speech_balloon: {\r
+        type: 'filter',\r
+        from: 'speech_balloon',\r
+        includes: {speech_balloon: {panel: {}}},\r
+        filter_key: 'speech_balloon_id',\r
+      },\r
       by_writing_format: {\r
         type: 'filter',\r
         from: 'writing_format',\r
       public_list: {\r
         type: 'public',\r
       },\r
+      by_speech_balloon: {\r
+        type: 'filter',\r
+        from: 'speech_balloon',\r
+        includes: {speech_balloon: {panel: {}}},\r
+        filter_key: 'speech_balloon_id',\r
+      },\r
       #by_system_picture: {\r
       #  type: 'filter',\r
       #  from: 'system_picture',\r
       public_list: {\r
         type: 'public',\r
       },\r
+      private_list: {\r
+        type: 'private',\r
+      },\r
       by_panel: {\r
         type: 'filter',\r
         from: 'panel',\r
       public_list: {\r
         type: 'public',\r
       },\r
+      private_list: {\r
+        type: 'private',\r
+      },\r
       by_panel: {\r
         type: 'filter',\r
         from: 'panel',\r
index a94e738..3fcf54c 100644 (file)
@@ -84,7 +84,7 @@
       }, \r
       'sheets.by_story': {\r
         model_name: 'sheet',\r
-        list_name: 'by_sheet',\r
+        list_name: 'by_story',\r
       }, \r
     }, \r
     columns: [\r
         list_name: 'by_speech_balloon',\r
       }, \r
       'speech.by_speech_balloon': {\r
-        model_name: 'panel',\r
+        model_name: 'speech',\r
         list_name: 'by_speech_balloon',\r
       }, \r
     }, \r
index 604cd7b..c168c74 100644 (file)
@@ -215,6 +215,7 @@ Pettanr::Application.routes.draw do
       get :show
     end
     member do
+      get :by_speech_balloon
       #get :by_system_picture
     end
   end
@@ -224,6 +225,7 @@ Pettanr::Application.routes.draw do
       get :show
     end
     member do
+      get :by_speech_balloon
       get :by_writing_format
     end
   end
index 8707b4c..b47fbda 100644 (file)
@@ -94,7 +94,7 @@ module Pettanr
       end
       
       def includes
-     @with_model_name ? {@with_model_name.classify.constantize.table_name => {}} : {}
+  #   @with_model_name ? {@with_model_name.classify.constantize.table_name => {}} : {}
         w = @owner_model ? {@owner_model.item_name => {}} : {}
         w.merge({@association_model.table_name => {} }) 
       end
@@ -115,6 +115,7 @@ module Pettanr
         @list_list_conf = @manifest.list(@item_name).lists[list_name] || {}
         @from = @list_list_conf['from']
         @filter_key = @list_list_conf['filter_key']
+        @includes = @list_list_conf['includes']
         
         @with_model_name = @list_list_conf['with']
       end
@@ -126,6 +127,7 @@ module Pettanr
       end
       
       def includes
+        return @includes if @includes
         w = @owner_model ? {@owner_model.item_name => {}} : {}
         w.merge({@from => {} }) 
       end
index 0b6140e..73c4be4 100644 (file)
@@ -126,6 +126,7 @@ module Pettanr
           raise "undefined has_many list for #{model_name}::#{list_name}\nconf:#{@controller_conf}\n" unless @manifest.list_managers[model_name]
           list = @manifest.list_managers[model_name].open(list_name, 1, 3, @operators)
           items = list.items @item
+#p [model_name, list_name, @item, list.class, list.includes, list.where(@item )]
           has_many_filer = @manifest.filer_managers[model_name].open model_name, items, @operators, nil
           yield has_many_filer
         end
@@ -133,9 +134,13 @@ module Pettanr
       
       def each_has_one 
         @has_one_conf.each do |profiler_list_name|
-          list = @manifest.list_managers[@item_name].open(profiler_list_name, 1, 1, @operators)
-          items = list.items 
-          has_one_filer = @manifest.filer_managers[@item_name].open @item_name, items, @operators, nil
+          raise "undefined lists for #{profiler_list_name} in #{@lists}\n" unless @lists[profiler_list_name]
+          model_name = @lists[profiler_list_name]['model_name']
+          list_name = @lists[profiler_list_name]['list_name']
+          raise "undefined has_one list for #{model_name}::#{list_name}\nconf:#{@controller_conf}\n" unless @manifest.list_managers[model_name]
+          list = @manifest.list_managers[model_name].open(list_name, 1, 1, @operators)
+          items = list.items @item
+          has_one_filer = @manifest.filer_managers[model_name].open model_name, items, @operators, nil
           yield has_one_filer
         end
       end
index 232f777..d8cc207 100644 (file)
         "by_sheet": {\r
           "type": "through_filter",\r
           "from": "sheet",\r
-          "through": "sheet_panels",\r
+          "through": "story_sheets",\r
           "filter_key": "sheet_id"\r
         },\r
         "by_author": {\r
         "public_list": {\r
           "type": "public"\r
         },\r
+        "by_speech_balloon": {\r
+          "type": "filter",\r
+          "from": "speech_balloon",\r
+          "includes": {\r
+            "speech_balloon": {\r
+              "panel": {}\r
+            }\r
+          },\r
+          "filter_key": "speech_balloon_id"\r
+        },\r
         "by_writing_format": {\r
           "type": "filter",\r
           "from": "writing_format",\r
       "lists": {\r
         "public_list": {\r
           "type": "public"\r
+        },\r
+        "by_speech_balloon": {\r
+          "type": "filter",\r
+          "from": "speech_balloon",\r
+          "includes": {\r
+            "speech_balloon": {\r
+              "panel": {}\r
+            }\r
+          },\r
+          "filter_key": "speech_balloon_id"\r
         }\r
       }\r
     },\r
           },\r
           "sheets.by_story": {\r
             "model_name": "sheet",\r
-            "list_name": "by_sheet"\r
+            "list_name": "by_story"\r
           }\r
         },\r
         "columns": [\r
             "list_name": "by_speech_balloon"\r
           },\r
           "speech.by_speech_balloon": {\r
-            "model_name": "panel",\r
+            "model_name": "speech",\r
             "list_name": "by_speech_balloon"\r
           }\r
         },\r