class AuthorsController < ApplicationController
- before_filter :authenticate_user!, :only => [:index, :show]
- before_filter :authenticate_admin!, :only => [:list, :browse]
+ if Manifest.manifest.magic_numbers['run_mode'] == 0
+ before_action :authenticate_user, :only => [:new, :create, :edit, :update]
+ before_action :authenticate_author, :only => [:edit, :update]
+ else
+ before_action :authenticate_reader, :only => [:index, :show]
+ before_action :authenticate_user, :only => [:new, :create, :edit, :update]
+ before_action :authenticate_author, :only => [:edit, :update]
+ end
def index
- @authors = Author.all
-
- respond_to do |format|
- format.html # index.html.erb
- end
+ filer_list
end
-
+
+ def show_html_format format
+ format.html {
+ }
+ end
+
def show
- @author = Author.find(params[:id])
-
+ set_show
respond_to do |format|
- format.html
+ show_html_format format
+ show_prof_format format
+ show_json_format format
end
end
-
- def list
- @authors = Author.all
-
- respond_to do |format|
- format.html { render layout: 'system' }
- end
+
+ def new
+ form_new
end
-
- def browse
- @author = Author.find(params[:id])
-
- respond_to do |format|
- format.html { render layout: 'system' }
- end
+
+ def edit
+ form_edit
+ end
+
+ def create
+ set_model
+ @item = @my_model_class.new
+ @item.supply_default
+ @item.attributes = @item.permit_params params
+ @item.overwrite @operators
+ render_create root_path
+ end
+
+ def update
+ set_edit
+ @item.attributes = @item.permit_params params
+ @item.overwrite @operators
+ render_update '/home/configure'
+ end
+
+ def destroy
+ set_model
+ @item = @my_model_class.edit(params[:id], @operators)
+ render_destroy '/home/configure'
end
end