1 class ComicsController < ApplicationController
2 layout 'test' if Pettanr::TestLayout
4 before_filter :authenticate_user!, :only => [:new, :create, :edit, :update, :destroy]
6 before_filter :authenticate_user!, :only => [:top, :index, :show, :play, :new, :create, :edit, :update, :destroy]
8 before_filter :authenticate_admin!, :only => [:list, :browse]
11 @new_comics = Comic.find(:all,
12 :include => :author, :conditions => ['visible > 0'], :order => 'updated_at desc', :limit => 5
14 @new_pictures = OriginalPicture.list @artist.id
16 respond_to do |format|
17 format.html # index.html.erb
24 @page = Comic.page params[:page]
25 @page_size = Comic.page_size params[:page_size]
26 @comics = Comic.list(@page, @page_size)
27 respond_to do |format|
28 format.html # index.html.erb
29 format.json { render json: @comics.to_json(Comic.list_json_opt) }
36 @comic = Comic.show(params[:id], @author)
38 respond_to do |format|
39 format.html # show.html.erb
40 format.json { render json: @comic.to_json(Comic.show_json_opt) }
45 @comic = {:count => Comic.visible_count}
46 respond_to do |format|
47 format.json { render json: @comic.to_json }
54 respond_to do |format|
55 format.html { render layout: 'system' }# index.html.erb
56 format.json { render json: @comics }
61 @comic = Comic.find(params[:id])
63 respond_to do |format|
64 format.html { render layout: 'system' } # show.html.erb
65 format.json { render json: @comic }
74 respond_to do |format|
75 format.html # new.html.erb
77 format.json { render json: @comic.to_json(Comic.show_json_opt) }
82 # GET /comics/1.js/edit
84 @comic = Comic.edit(params[:id], @author)
85 respond_to do |format|
96 @comic.attributes = params[:comic]
97 @comic.overwrite @author
99 respond_to do |format|
101 format.html { redirect_to @comic, notice: 'Comic was successfully created.' }
102 format.json { render json: @comic.to_json(Comic.show_json_opt), status: :created, location: @comic }
104 format.html { render action: "new" }
105 format.json { render json: @comic.errors, status: :unprocessable_entity }
113 @comic = Comic.edit(params[:id], @author)
114 @comic.attributes = params[:comic]
115 @comic.overwrite @author
116 respond_to do |format|
118 format.html { redirect_to @comic, notice: 'Comic was successfully updated.' }
119 format.json { head :ok }
121 format.html { render action: "edit" }
122 format.json { render json: @comic.errors, status: :unprocessable_entity }
128 # DELETE /comics/1.json
130 @comic = Comic.edit(params[:id], @author)
132 respond_to do |format|
133 format.html { redirect_to comics_url }
134 format.json { head :ok }