1 class ComicsController < ApplicationController
2 layout 'test' if MagicNumber['test_layout']
3 if MagicNumber['run_mode'] == 0
4 before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
5 before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
7 before_filter :authenticate_reader, :only => [:top, :index, :show]
8 before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
9 before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
11 before_filter :authenticate_admin!, :only => [:list, :browse]
22 @item = Comic.show(params[:id], @operators)
23 respond_to do |format|
28 @profiler = @@profiler_manager.open(@item, @operators)
29 render :template => 'system/prof', :locals => {
30 :profiler => @profiler
33 format.json { render json: @item.to_json(Comic.show_json_opt) }
40 @comic = {:count => Comic.visible_count}
41 respond_to do |format|
42 format.json { render json: @comic.to_json }
49 respond_to do |format|
50 format.html { render layout: 'system' }# index.html.erb
51 format.json { render json: @comics }
56 @comic = Comic.find(params[:id])
58 respond_to do |format|
59 format.html { render layout: 'system' } # show.html.erb
60 format.json { render json: @comic }
67 respond_to do |format|
68 format.html # new.html.erb
70 format.json { render json: @comic.to_json(Comic.show_json_opt) }
75 @comic = Comic.edit(params[:id], @author)
76 respond_to do |format|
85 @comic.attributes = params[:comic]
86 @comic.overwrite @operators
88 respond_to do |format|
90 flash[:notice] = I18n.t('flash.notice.created', :model => Comic.model_name.human)
91 format.html { redirect_to @comic }
92 format.json { render json: @comic.to_json(Comic.show_json_opt), status: :created, location: @comic }
94 flash[:notice] = I18n.t('flash.notice.not_created', :model => Comic.model_name.human)
95 format.html { render action: "new" }
96 format.json { render json: @comic.errors, status: :unprocessable_entity }
102 @comic = Comic.edit(params[:id], @operators)
103 @comic.attributes = params[:comic]
104 @comic.overwrite @operators
105 respond_to do |format|
107 flash[:notice] = I18n.t('flash.notice.updated', :model => Comic.model_name.human)
108 format.html { redirect_to @comic }
109 format.json { head :ok }
111 flash[:notice] = I18n.t('flash.notice.not_updated', :model => Comic.model_name.human)
112 format.html { render action: "edit" }
113 format.json { render json: @comic.errors, status: :unprocessable_entity }
119 @comic = Comic.edit(params[:id], @author)
120 respond_to do |format|
121 if @comic.destroy_with_story
122 flash[:notice] = I18n.t('flash.notice.destroyed', :model => Comic.model_name.human)
123 format.html { redirect_to '/home/comics' }
124 format.json { head :ok }
126 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Comic.model_name.human)
127 format.html { redirect_to @comic }
128 format.json { render json: @comic.errors, status: :unprocessable_entity }