2012-01-31 10:31:31 +00:00
|
|
|
class Admin::AdBannersController < ApplicationController
|
2012-03-23 03:18:29 +00:00
|
|
|
layout "new_admin"
|
2012-01-31 10:31:31 +00:00
|
|
|
before_filter :authenticate_user!
|
|
|
|
before_filter :is_admin?
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@ad_banner = AdBanner.find(params[:id])
|
|
|
|
@ad_banner.destroy
|
|
|
|
redirect_to admin_ad_banners_url
|
|
|
|
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
|
2012-04-01 15:39:49 +00:00
|
|
|
@ad_banners = AdBanner.all
|
|
|
|
render :action => 'index',:params => 'new'
|
2012-01-31 10:31:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@ad_banner = AdBanner.new(params[:ad_banner])
|
|
|
|
@ad_banner.save
|
|
|
|
redirect_to admin_ad_banners_url
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
@ad_banner = AdBanner.find(params[:id])
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@ad_banner = AdBanner.find(params[:id])
|
|
|
|
@ad_banner.update_attributes(params[:ad_banner])
|
|
|
|
@ad_banner.save
|
|
|
|
redirect_to admin_ad_banners_url
|
|
|
|
end
|
|
|
|
|
2012-04-13 09:24:30 +00:00
|
|
|
def realtime_preview
|
2012-04-17 03:34:25 +00:00
|
|
|
@ad_banner = AdBanner.find(params[:id]).clone
|
|
|
|
debugger
|
2012-04-13 09:24:30 +00:00
|
|
|
@ad_banner.update_attributes(params[:ad_banner])
|
2012-04-01 15:39:49 +00:00
|
|
|
end
|
|
|
|
|
2012-01-31 10:31:31 +00:00
|
|
|
def index
|
|
|
|
@ad_banners = AdBanner.all
|
2012-04-01 15:39:49 +00:00
|
|
|
@active = @ad_banners.first
|
2012-01-31 10:31:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|