Orbit/app/controllers/admin/ad_banners_controller.rb

52 lines
1.1 KiB
Ruby

class Admin::AdBannersController < ApplicationController
layout "new_admin"
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
@ad_banners = AdBanner.all
@active = AdBanner.find(params[:id])
render :action => 'index'
end
def new
@ad_banners = AdBanner.all
render :action => 'index',:params => 'new'
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
def realtime_preview
@ad_banner = AdBanner.find(params[:id]).preview_clone
#@ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images])
end
def index
@ad_banners = AdBanner.all
@active = @ad_banners.first
end
end