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) }
54 @comic.attributes = params[:comic]
55 @comic.overwrite @operators
57 respond_to do |format|
59 flash[:notice] = I18n.t('flash.notice.created', :model => Comic.model_name.human)
60 format.html { redirect_to @comic }
61 format.json { render json: @comic.to_json(Comic.show_json_opt), status: :created, location: @comic }
63 flash[:notice] = I18n.t('flash.notice.not_created', :model => Comic.model_name.human)
64 format.html { render action: "new" }
65 format.json { render json: @comic.errors, status: :unprocessable_entity }
71 @comic = Comic.edit(params[:id], @operators)
72 @comic.attributes = params[:comic]
73 @comic.overwrite @operators
74 respond_to do |format|
76 flash[:notice] = I18n.t('flash.notice.updated', :model => Comic.model_name.human)
77 format.html { redirect_to @comic }
78 format.json { head :ok }
80 flash[:notice] = I18n.t('flash.notice.not_updated', :model => Comic.model_name.human)
81 format.html { render action: "edit" }
82 format.json { render json: @comic.errors, status: :unprocessable_entity }
88 @comic = Comic.edit(params[:id], @operators)
89 respond_to do |format|
90 if @comic.destroy_with_story
91 flash[:notice] = I18n.t('flash.notice.destroyed', :model => Comic.model_name.human)
92 format.html { redirect_to '/home/comics' }
93 format.json { head :ok }
95 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Comic.model_name.human)
96 format.html { redirect_to @comic }
97 format.json { render json: @comic.errors, status: :unprocessable_entity }