1 class AuthorsController < ApplicationController
2 if Manifest.manifest.magic_numbers['run_mode'] == 0
3 before_filter :authenticate_user, :only => [:new, :create, :edit, :update]
4 before_filter :authenticate_author, :only => [:edit, :update]
6 before_filter :authenticate_reader, :only => [:index, :show, :scrolls, :scroll_panels, :comics, :stories, :story_sheets, :sheets, :sheet_panels, :panels, :panel_pictures, :speech_balloons, :ground_pictures, :ground_colors]
7 before_filter :authenticate_user, :only => [:new, :create, :edit, :update]
8 before_filter :authenticate_author, :only => [:edit, :update]
68 @item = Author.show(params[:id], @operators)
70 respond_to do |format|
75 format.json { render :json => @item.to_json(Author.show_json_opt) }
80 @au = {:count => Author.visible_count}
81 respond_to do |format|
82 format.json { render json: @au.to_json }
88 @author.supply_default
90 respond_to do |format|
93 format.json { render json: @au.to_json(Author.show_json_opt) }
98 @author = Author.edit(params[:id], @operators)
102 @author = Author.new()
103 @author.supply_default
104 @author.attributes = params[:author]
105 @author.overwrite @operators
106 respond_to do |format|
108 flash[:notice] = I18n.t('flash.notice.created', :model => Author.model_name.human)
109 format.html { redirect_to root_path }
110 format.json { render json: @author.to_json(Author.show_json_opt), status: :created }
112 flash[:notice] = I18n.t('flash.notice.not_created', :model => Author.model_name.human)
113 format.html { render action: "new" }
114 format.json { render json: @au.errors, status: :unprocessable_entity }
120 @author = Author.edit(params[:id], @operators)
121 @author.attributes = params[:author]
122 @author.overwrite @operators
124 respond_to do |format|
126 flash[:notice] = I18n.t('flash.notice.updated', :model => Author.model_name.human)
127 format.html { redirect_to '/home/configure' }
128 format.json { head :ok }
130 flash[:notice] = I18n.t('flash.notice.not_updated', :model => Author.model_name.human)
131 format.html { render action: "edit" }
132 format.json { render json: @author.errors, status: :unprocessable_entity }