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
method_name = @where.conditions do |name|
name
end
- p method_name
@model.__send__ method_name
end
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