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 => [:index, :show, :by_author, :count, :count_by_author]
7 before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
8 before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
24 @item = Comic.show(params[:id], @operators)
25 respond_to do |format|
29 format.json { render json: @item.to_json(Comic.show_json_opt) }
46 respond_to do |format|
49 format.json { render json: @comic.to_json(Comic.show_json_opt) }
54 @comic = Comic.edit(params[:id], @operators)
55 respond_to do |format|
64 @comic.attributes = params[:comic]
65 @comic.overwrite @operators
67 respond_to do |format|
69 flash[:notice] = I18n.t('flash.notice.created', :model => Comic.model_name.human)
70 format.html { redirect_to @comic }
71 format.json { render json: @comic.to_json(Comic.show_json_opt), status: :created, location: @comic }
73 flash[:notice] = I18n.t('flash.notice.not_created', :model => Comic.model_name.human)
74 format.html { render action: "new" }
75 format.json { render json: @comic.errors, status: :unprocessable_entity }
81 @comic = Comic.edit(params[:id], @operators)
82 @comic.attributes = params[:comic]
83 @comic.overwrite @operators
84 respond_to do |format|
86 flash[:notice] = I18n.t('flash.notice.updated', :model => Comic.model_name.human)
87 format.html { redirect_to @comic }
88 format.json { head :ok }
90 flash[:notice] = I18n.t('flash.notice.not_updated', :model => Comic.model_name.human)
91 format.html { render action: "edit" }
92 format.json { render json: @comic.errors, status: :unprocessable_entity }
98 @comic = Comic.edit(params[:id], @operators)
99 respond_to do |format|
100 if @comic.destroy_with_story
101 flash[:notice] = I18n.t('flash.notice.destroyed', :model => Comic.model_name.human)
102 format.html { redirect_to '/home/comics' }
103 format.json { head :ok }
105 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Comic.model_name.human)
106 format.html { redirect_to @comic }
107 format.json { render json: @comic.errors, status: :unprocessable_entity }