1 class ComicsController < ApplicationController
2 if Manifest.manifest.magic_numbers['run_mode'] == 0
3 before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
4 before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
6 before_filter :authenticate_reader, :only => [:top, :index, :show, :stories, :by_author]
7 before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
8 before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
16 @action = self.class.controller.open(action_name, params, @operators)
17 @action.cook params, operators
30 @item = Comic.show(params[:id], @operators)
31 respond_to do |format|
35 format.json { render json: @item.to_json(Comic.show_json_opt) }
42 @comic = {:count => Comic.visible_count}
43 respond_to do |format|
44 format.json { render json: @comic.to_json }
51 respond_to do |format|
54 format.json { render json: @comic.to_json(Comic.show_json_opt) }
59 @comic = Comic.edit(params[:id], @operators)
60 respond_to do |format|
69 @comic.attributes = params[:comic]
70 @comic.overwrite @operators
72 respond_to do |format|
74 flash[:notice] = I18n.t('flash.notice.created', :model => Comic.model_name.human)
75 format.html { redirect_to @comic }
76 format.json { render json: @comic.to_json(Comic.show_json_opt), status: :created, location: @comic }
78 flash[:notice] = I18n.t('flash.notice.not_created', :model => Comic.model_name.human)
79 format.html { render action: "new" }
80 format.json { render json: @comic.errors, status: :unprocessable_entity }
86 @comic = Comic.edit(params[:id], @operators)
87 @comic.attributes = params[:comic]
88 @comic.overwrite @operators
89 respond_to do |format|
91 flash[:notice] = I18n.t('flash.notice.updated', :model => Comic.model_name.human)
92 format.html { redirect_to @comic }
93 format.json { head :ok }
95 flash[:notice] = I18n.t('flash.notice.not_updated', :model => Comic.model_name.human)
96 format.html { render action: "edit" }
97 format.json { render json: @comic.errors, status: :unprocessable_entity }
103 @comic = Comic.edit(params[:id], @operators)
104 respond_to do |format|
105 if @comic.destroy_with_story
106 flash[:notice] = I18n.t('flash.notice.destroyed', :model => Comic.model_name.human)
107 format.html { redirect_to '/home/comics' }
108 format.json { head :ok }
110 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Comic.model_name.human)
111 format.html { redirect_to @comic }
112 format.json { render json: @comic.errors, status: :unprocessable_entity }