- def supply_default
- self.scroll_id = nil
- self.panel_id = nil
- self.t = nil
- end
-
- def overwrite operators
- return false unless operators.author
- self.author_id = operators.author.id
- end
-
- def self.list_order
- 'scroll_panels.updated_at desc'
- end
-
- def self.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 => {},
- :scroll => {
- :author => {}
- },
- :panel => {
- :author => {},
- :panel_pictures => {:picture => {:artist => {}, :license => {}}},
- :speech_balloons =>{:balloon => {}, :speech => {}}
- }
- }
- end
-
- def self.list_json_opt
- {:include => {
- :author => {},
- :scroll => {
- :author => {}
- },
- :panel => {
- :author => {},
- :panel_pictures => {:picture => {:artist => {}, :license => {}}},
- :speech_balloons =>{:balloon => {}, :speech => {}}
- }
- }}