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]
23 def show_html_format format
30 respond_to do |format|
31 show_html_format format
32 show_prof_format format
33 show_json_format format
58 @comic.attributes = params[:comic]
59 @comic.overwrite @operators
61 respond_to do |format|
63 flash[:notice] = I18n.t('flash.notice.created', :model => Comic.model_name.human)
64 format.html { redirect_to @comic }
65 format.json { render json: @comic.to_json(Comic.show_json_opt), status: :created, location: @comic }
67 flash[:notice] = I18n.t('flash.notice.not_created', :model => Comic.model_name.human)
68 format.html { render action: "new" }
69 format.json { render json: @comic.errors, status: :unprocessable_entity }
75 @comic = Comic.edit(params[:id], @operators)
76 @comic.attributes = params[:comic]
77 @comic.overwrite @operators
78 respond_to do |format|
80 flash[:notice] = I18n.t('flash.notice.updated', :model => Comic.model_name.human)
81 format.html { redirect_to @comic }
82 format.json { head :ok }
84 flash[:notice] = I18n.t('flash.notice.not_updated', :model => Comic.model_name.human)
85 format.html { render action: "edit" }
86 format.json { render json: @comic.errors, status: :unprocessable_entity }
92 @comic = Comic.edit(params[:id], @operators)
93 respond_to do |format|
94 if @comic.destroy_with_story
95 flash[:notice] = I18n.t('flash.notice.destroyed', :model => Comic.model_name.human)
96 format.html { redirect_to '/home/comics' }
97 format.json { head :ok }
99 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Comic.model_name.human)
100 format.html { redirect_to @comic }
101 format.json { render json: @comic.errors, status: :unprocessable_entity }