epaper/app/controllers/admin/e_papers_controller.rb

59 lines
1.3 KiB
Ruby

class Admin::EPapersController < OrbitAdminController
def index
@table_fields = [:category,t('e_paper.title'),t('e_paper.publish_date'),t('tags')]
@categories = @module_app.categories.enabled
@tags = @module_app.tags
@filter_fields = filter_fields(@categories, @tags)
@filter_fields.delete(:status)
@papers = EPaperTopic.order_by(sort)
.with_categories(filters("category"))
@papers = search_data(@papers,[:title]).page(params[:page]).per(10)
render :partial => "index" if request.xhr?
end
def new
@paper = EPaperTopic.new
end
def destroy
paper = EPaperTopic.find(params[:id])
paper.destroy
redirect_to admin_e_papers_path
end
def create
@paper = EPaperTopic.new(e_paper_params)
@paper.save
redirect_to admin_e_papers_path
end
def edit
@paper = EPaperTopic.find(params[:id])
end
def update
paper = EPaperTopic.find(params[:id])
paper.update_attributes(e_paper_params)
paper.save
redirect_to admin_e_papers_path
end
def subscribers
@subscribers = Subscriber.all.desc(:created_at)
end
def send_email_to_subscribers
end
def instructions
end
private
def e_paper_params
params.require(:e_paper_topic).permit!
end
end