layout 'test' if MagicNumber['test_layout']
if MagicNumber['run_mode'] == 0
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
+ before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
else
before_filter :authenticate_reader, :only => [:index, :show, :comic]
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
+ before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
before_filter :authenticate_admin!, :only => [:list, :browse]
@stories = Story.list(@page, @page_size)
respond_to do |format|
- format.html # index.html.erb
+ format.html {
+ @paginate = Story.list_paginate(@page, @page_size)
+ }
format.json { render :json => @stories.to_json(Story.list_json_opt) }
end
end
def show
- @story = Story.show(params[:id], [@author, @admin])
+ @story = Story.show(params[:id], [@user, @admin])
respond_to do |format|
format.html # show.html.erb
end
def comic
- @comic = Comic.show(params[:id], [@author, @admin])
+ @comic = Comic.show(params[:id], [@user, @admin])
cnt = Story.count(:conditions => ['comic_id = ?', @comic.id]).to_i
@offset = Story.offset cnt, params[:offset]
@panel_count = Story.panel_count cnt, params[:count]
@stories = Story.play_list(@comic, @author, @offset, @panel_count)
respond_to do |format|
- format.html # index.html.erb
+ format.html {
+ @paginate = Story.play_list_paginate(@comic, @offset, @panel_count)
+ if @author
+ @new_panels = Panel.mylist(@author, 0, 5)
+ end
+ }
format.json {render text: Story.list_as_json_text(@stories, @author)}
format.jsonp {
render :json => "callback(" + @stories.to_json_list + ");"