2012-05-01 08:05:05 +00:00
|
|
|
class Admin::AdBannersController < OrbitBackendController
|
2013-10-18 07:25:19 +00:00
|
|
|
|
2013-08-22 07:18:54 +00:00
|
|
|
open_for_visitor :only => [:index, :show]
|
2013-10-18 07:25:19 +00:00
|
|
|
open_for_sub_manager
|
2012-01-31 10:31:31 +00:00
|
|
|
|
2013-10-18 07:25:19 +00:00
|
|
|
def index
|
|
|
|
@ad_banners = AdBanner.all.page(params[:page]).per(10)
|
2012-01-31 10:31:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
2012-04-01 15:39:49 +00:00
|
|
|
@ad_banners = AdBanner.all
|
|
|
|
@active = AdBanner.find(params[:id])
|
|
|
|
render :action => 'index'
|
2012-01-31 10:31:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
2013-08-05 10:30:35 +00:00
|
|
|
@ad_banner = AdBanner.new
|
|
|
|
render layout: false
|
2012-01-31 10:31:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@ad_banner = AdBanner.new(params[:ad_banner])
|
2012-04-18 07:26:59 +00:00
|
|
|
if @ad_banner.save
|
2013-08-05 10:30:35 +00:00
|
|
|
redirect_to admin_ad_banners_url
|
2012-04-18 07:26:59 +00:00
|
|
|
else
|
2013-10-18 07:25:19 +00:00
|
|
|
@ad_banner = AdBanner.new(params[:ad_banner])
|
|
|
|
render :new
|
2012-04-18 07:26:59 +00:00
|
|
|
end
|
2012-01-31 10:31:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
@ad_banner = AdBanner.find(params[:id])
|
2013-10-15 11:33:31 +00:00
|
|
|
render layout: false
|
2012-01-31 10:31:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@ad_banner = AdBanner.find(params[:id])
|
2013-10-18 07:25:19 +00:00
|
|
|
if @ad_banner.update_attributes(params[:ad_banner])
|
|
|
|
redirect_to admin_ad_banners_url
|
|
|
|
else
|
|
|
|
render :edit
|
|
|
|
end
|
2012-04-01 15:39:49 +00:00
|
|
|
end
|
2013-10-18 07:25:19 +00:00
|
|
|
|
|
|
|
def destroy
|
|
|
|
@ad_banner = AdBanner.find(params[:id])
|
|
|
|
@ad_banner.destroy
|
|
|
|
redirect_to admin_ad_banners_url
|
2012-01-31 10:31:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|