2019-05-28 15:54:32 +00:00
|
|
|
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"))
|
2020-06-11 10:57:15 +00:00
|
|
|
.with_tags(filters("tag"))
|
2019-05-28 15:54:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
@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
|