Orbit/app/controllers/admin/ad_banners_controller.rb

51 lines
1.0 KiB
Ruby
Raw Normal View History

class Admin::AdBannersController < OrbitBackendController
2013-10-18 07:25:19 +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
@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
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])
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, :status => 303
2013-10-18 07:25:19 +00:00
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