55 lines
1.1 KiB
Ruby
55 lines
1.1 KiB
Ruby
|
class Admin::EPaperImagesController < OrbitAdminController
|
||
|
|
||
|
def initialize
|
||
|
super
|
||
|
@app_title = "e_paper"
|
||
|
end
|
||
|
|
||
|
def index
|
||
|
@table_fields = [t('e_paper.banner_image')]
|
||
|
# @categories = @module_app.categories.enabled
|
||
|
# @tags = @module_app.tags
|
||
|
# @filter_fields = filter_fields(@categories, @tags)
|
||
|
# @filter_fields.delete(:status)
|
||
|
@images = EPaperImage.order_by(sort)
|
||
|
|
||
|
@images = search_data(@images,[:title]).page(params[:page]).per(10)
|
||
|
|
||
|
render :partial => "index" if request.xhr?
|
||
|
end
|
||
|
|
||
|
def new
|
||
|
@image = EPaperImage.new
|
||
|
end
|
||
|
|
||
|
def create
|
||
|
@image = EPaperImage.new(e_paper_image_params)
|
||
|
@image.save
|
||
|
redirect_to admin_e_paper_images_path
|
||
|
end
|
||
|
|
||
|
def edit
|
||
|
@image = EPaperImage.find(params[:id])
|
||
|
end
|
||
|
|
||
|
def update
|
||
|
image = EPaperImage.find(params[:id])
|
||
|
image.update_attributes(e_paper_image_params)
|
||
|
image.save
|
||
|
redirect_to admin_e_paper_images_path
|
||
|
end
|
||
|
|
||
|
def destroy
|
||
|
image = EPaperImage.find(params[:id])
|
||
|
image.destroy
|
||
|
redirect_to admin_e_paper_images_path
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def e_paper_image_params
|
||
|
params.require(:e_paper_image).permit!
|
||
|
end
|
||
|
|
||
|
end
|