This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/controllers/admin/ad_banners_controller.rb

65 lines
1.6 KiB
Ruby

class Admin::AdBannersController < OrbitBackendController
before_filter :force_order_for_visitor,:only=>[:index, :show]
before_filter :force_order_for_user,:except => [:index, :show]
before_filter :for_app_sub_manager,:except => [:index, :show]
before_filter :for_app_manager,:except => [:index,:show,:update,:realtime_preview]
def rename
@ad_banner = AdBanner.find(params[:id])
@ad_banner.title = params[:body]
render :json => {:success =>@ad_banner.save!}
end
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_banner = AdBanner.new
render layout: false
end
def create
@ad_banner = AdBanner.new(params[:ad_banner])
if @ad_banner.save
@active = @ad_banner
redirect_to admin_ad_banners_url
#respond_to do |format|
# format.js {render 'new_created_node'}
#end
else
render 'create_error_msg'
end
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