OSDN Git Service

fix filer pager
[pettanr/pettanr.git] / lib / locmare / list_group / list / base.rb
index 38cc9b5..b5a447a 100644 (file)
@@ -2,16 +2,37 @@ module Locmare
   module ListGroupModule
     class Base
       class ListResult
-        attr :items, :paginate
-        def initialize items, paginate
+        attr :list, :items, :paginate
+        
+        def initialize list, items, paginate, operators, options
+          @list = list
           @items = items
           @paginate = paginate
+          @operators = operators
+          @options = options
+        end
+        
+        def path
+          if list_manifest.has_id?
+            filter_item_id = @options[:id]
+            if list_manifest.pre_id?
+              list_manifest.model.path_name + '/' + filter_item_id.to_s + '/' + list_manifest.action_name
+            else
+              list_manifest.model.path_name + '/' + list_manifest.action_name + '/' + filter_item_id.to_s
+            end
+          else
+            list_manifest.model.path_name + '/' + list_manifest.action_name
+          end
+        end
+        
+        def list_manifest
+          @list.list_manifest
         end
         
       end
       
       attr :item_name, :list_name, 
-        :model_manifest, :model_list_manifest, :model, 
+        :model_manifest, :model_list_manifest, :list_manifest, :model, 
         :default_page_size, :max_page_size
       def initialize item_name, list_name
         @item_name = item_name
@@ -63,7 +84,6 @@ module Locmare
         method_name = @where.conditions do |name|
           name
         end
-        p method_name
         @model.__send__ method_name
       end
       
@@ -115,7 +135,7 @@ module Locmare
         count = self.count operators, options
         pg = self.paginate count, offset, page_size
         self.boost items
-        ListResult.new items, pg
+        ListResult.new self, items, pg, operators, options
       end
       
     end