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, :count]
7 before_filter :authenticate_user, :only => [:new, :create, :edit, :update]
8 before_filter :authenticate_author, :only => [:edit, :update]
19 def show_html_format format
27 respond_to do |format|
28 show_html_format format
29 show_prof_format format
30 show_json_format format
40 @author.supply_default
42 respond_to do |format|
45 format.json { render json: @au.to_json(Author.show_json_opt) }
50 @author = Author.edit(params[:id], @operators)
54 @author = Author.new()
55 @author.supply_default
56 @author.attributes = params[:author]
57 @author.overwrite @operators
58 respond_to do |format|
60 flash[:notice] = I18n.t('flash.notice.created', :model => Author.model_name.human)
61 format.html { redirect_to root_path }
62 format.json { render json: @author.to_json(Author.show_json_opt), status: :created }
64 flash[:notice] = I18n.t('flash.notice.not_created', :model => Author.model_name.human)
65 format.html { render action: "new" }
66 format.json { render json: @au.errors, status: :unprocessable_entity }
72 @author = Author.edit(params[:id], @operators)
73 @author.attributes = params[:author]
74 @author.overwrite @operators
76 respond_to do |format|
78 flash[:notice] = I18n.t('flash.notice.updated', :model => Author.model_name.human)
79 format.html { redirect_to '/home/configure' }
80 format.json { head :ok }
82 flash[:notice] = I18n.t('flash.notice.not_updated', :model => Author.model_name.human)
83 format.html { render action: "edit" }
84 format.json { render json: @author.errors, status: :unprocessable_entity }