51 lines
1.0 KiB
Ruby
51 lines
1.0 KiB
Ruby
|
class Admin::AdBannersController < OrbitBackendController
|
||
|
|
||
|
open_for_visitor :only => [:index, :show]
|
||
|
open_for_sub_manager
|
||
|
|
||
|
def index
|
||
|
@ad_banners = AdBanner.all.page(params[:page]).per(10)
|
||
|
end
|
||
|
|
||
|
def show
|
||
|
@ad_banners = AdBanner.all
|
||
|
@active = AdBanner.find(params[:id])
|
||
|
render :action => 'index'
|
||
|
end
|
||
|
|
||
|
def new
|
||
|
@ad_banner = AdBanner.new
|
||
|
render layout: false
|
||
|
end
|
||
|
|
||
|
def create
|
||
|
@ad_banner = AdBanner.new(params[:ad_banner])
|
||
|
if @ad_banner.save
|
||
|
redirect_to admin_ad_banners_url
|
||
|
else
|
||
|
@ad_banner = AdBanner.new(params[:ad_banner])
|
||
|
render :new
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def edit
|
||
|
@ad_banner = AdBanner.find(params[:id])
|
||
|
render layout: false
|
||
|
end
|
||
|
|
||
|
def update
|
||
|
@ad_banner = AdBanner.find(params[:id])
|
||
|
if @ad_banner.update_attributes(params[:ad_banner])
|
||
|
redirect_to admin_ad_banners_url, :status => 303
|
||
|
else
|
||
|
render :edit
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def destroy
|
||
|
@ad_banner = AdBanner.find(params[:id])
|
||
|
@ad_banner.destroy
|
||
|
redirect_to admin_ad_banners_url
|
||
|
end
|
||
|
|
||
|
end
|