OSDN Git Service

merge
[pettanr/pettanr.git] / lib / manifest / local / view / list_group / list / play.rb
1 module Manifest
2   module View
3     module ListGroupModule
4       class PlayList
5         attr :model, :list_name, :list_manifest, :type, 
6           :default_page_size, :max_page_size
7         
8         def initialize model, list_name, list_manifest
9           @model = model
10           @list_name = list_name
11           @list_manifest = list_manifest
12           self.set_default
13           self.init
14         end
15         
16         def set_default
17           @list_manifest['args'] ||= {}
18           return
19           @default_page_size = @conf['default_page_size'] || 25
20           @max_page_size = @conf['max_page_size'] || 100
21           @params_offset = params_offset
22           @params_count = params_count
23           @list_list_conf = @manifest.list(@item_name).lists[list_name] || {}
24           @model_name = @list_list_conf['model']
25           @filter_key = @list_list_conf['filter_key']
26           @model = @model_name.classify.constantize
27           @table_name = @model.table_name
28           if @model.content?
29             @owner_model = @model.owner_model
30             @owner_table_name = @owner_model.table_name if @owner_model
31           end
32         end
33         
34         def init
35           @type = @list_manifest['type']
36           @args = @list_manifest['args']
37         end
38         
39       end
40       
41     end
42   end
43 end