'scroll_panels.updated_at desc'
end
- def self.list_where
+ def self.public_list_where
'scrolls.visible > 0'
end
- def self.by_author_list_includes
- {
- :scroll => {
- :author => {}
- }
- }
- end
-
- def self.play_list_where cid
- ['scroll_panels.scroll_id = ?', cid]
- end
-
- def self.play_list scroll, author, offset = 0, limit = ScrollPanel.default_panel_size
- ScrollPanel.where(self.play_list_where(scroll.id)).includes(ScrollPanel.list_opt).order('scroll_panels.t').offset(offset).limit(limit)
- end
-
def self.list_opt
{
:author => {},
}}
end
- def elements
- self.panel.elements
- end
-
- def scroll_panel_as_json au
- panel_include = if self.panel and self.panel.visible?(au)
- {:include => {:author => {}}, :methods => :elements}
- else
- {:include => {:author => {}}}
- end
- self.to_json({:include => {:scroll => {:include => {:author => {}}}, :author => {}, :panel => panel_include}})
- end
-
- def self.list_as_json_text ary, au
- '[' + ary.map {|i| i.scroll_panel_as_json(au) }.join(',') + ']'
- end
-
def self.licensed_pictures scroll_panels
r = {}
scroll_panels.each do |scroll_panel|