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]
21 @item = Comic.show(params[:id], @operators)
22 respond_to do |format|
27 format.json { render json: @item.to_json(Comic.show_json_opt) }
34 @comic = {:count => Comic.visible_count}
35 respond_to do |format|
36 format.json { render json: @comic.to_json }
43 respond_to do |format|
46 format.json { render json: @comic.to_json(Comic.show_json_opt) }
51 @comic = Comic.edit(params[:id], @operators)
52 respond_to do |format|
61 @comic.attributes = params[:comic]
62 @comic.overwrite @operators
64 respond_to do |format|
66 flash[:notice] = I18n.t('flash.notice.created', :model => Comic.model_name.human)
67 format.html { redirect_to @comic }
68 format.json { render json: @comic.to_json(Comic.show_json_opt), status: :created, location: @comic }
70 flash[:notice] = I18n.t('flash.notice.not_created', :model => Comic.model_name.human)
71 format.html { render action: "new" }
72 format.json { render json: @comic.errors, status: :unprocessable_entity }
78 @comic = Comic.edit(params[:id], @operators)
79 @comic.attributes = params[:comic]
80 @comic.overwrite @operators
81 respond_to do |format|
83 flash[:notice] = I18n.t('flash.notice.updated', :model => Comic.model_name.human)
84 format.html { redirect_to @comic }
85 format.json { head :ok }
87 flash[:notice] = I18n.t('flash.notice.not_updated', :model => Comic.model_name.human)
88 format.html { render action: "edit" }
89 format.json { render json: @comic.errors, status: :unprocessable_entity }
95 @comic = Comic.edit(params[:id], @operators)
96 respond_to do |format|
97 if @comic.destroy_with_story
98 flash[:notice] = I18n.t('flash.notice.destroyed', :model => Comic.model_name.human)
99 format.html { redirect_to '/home/comics' }
100 format.json { head :ok }
102 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Comic.model_name.human)
103 format.html { redirect_to @comic }
104 format.json { render json: @comic.errors, status: :unprocessable_entity }