end
end
+ def play
+ @scroll = Scroll.show(params[:id], [@user, @admin])
+ cnt = ScrollPanel.count(:conditions => ['scroll_id = ?', @scroll.id]).to_i
+ @offset = ScrollPanel.offset cnt, params[:offset]
+ @panel_count = ScrollPanel.panel_count cnt, params[:count]
+ @scroll_panels = ScrollPanel.play_list(@scroll, @author, @offset, @panel_count)
+ respond_to do |format|
+ format.html {
+ @prev_offset = if @offset > 0
+ if @offset - @panel_count < 0
+ 0
+ else
+ @offset - @panel_count
+ end
+ else
+ nil
+ end
+ @next_offset = if @offset + @panel_count > cnt
+ nil
+ else
+ @offset + @panel_count
+ end
+ if @author
+ @new_panels = Panel.mylist(@author, 1, 5)
+ end
+ }
+ format.json {render text: ScrollPanel.list_as_json_text(@scroll_panels, @author)}
+ format.jsonp {
+ render :json => "callback(" + @scroll_panels.to_json_list + ");"
+ }
+ end
+ end
+
def count
@scroll = {:count => Scroll.visible_count}
respond_to do |format|