2012-05-01 08:05:05 +00:00
|
|
|
class Admin::AdBannersController < OrbitBackendController
|
2013-08-22 07:18:54 +00:00
|
|
|
open_for_visitor :only => [:index, :show]
|
|
|
|
open_for_manager :except => [:index,:show,:update,:realtime_preview]
|
|
|
|
open_for_sub_manager :except => [:index, :show]
|
2012-01-31 10:31:31 +00:00
|
|
|
|
2012-05-16 08:42:43 +00:00
|
|
|
def rename
|
|
|
|
@ad_banner = AdBanner.find(params[:id])
|
2012-05-17 13:31:29 +00:00
|
|
|
@ad_banner.title = params[:body]
|
2012-05-16 08:42:43 +00:00
|
|
|
render :json => {:success =>@ad_banner.save!}
|
|
|
|
end
|
2012-01-31 10:31:31 +00:00
|
|
|
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
|
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
|
|
|
|
@active = @ad_banner
|
2013-08-05 10:30:35 +00:00
|
|
|
redirect_to admin_ad_banners_url
|
|
|
|
#respond_to do |format|
|
|
|
|
# format.js {render 'new_created_node'}
|
|
|
|
#end
|
2012-04-18 07:26:59 +00:00
|
|
|
else
|
|
|
|
render 'create_error_msg'
|
|
|
|
end
|
2012-01-31 10:31:31 +00:00
|
|
|
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-25 03:38:45 +00:00
|
|
|
@ad_banner = AdBanner.find( params[:id] ).preview_clone
|
|
|
|
@ad_banner.update_attributes(params[:ad_banner])#.update_attributes(params[:ad_images])
|
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-17 07:21:43 +00:00
|
|
|
@active = @ad_banners.first
|
2013-08-30 10:17:27 +00:00
|
|
|
@tags = get_tags
|
2012-01-31 10:31:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|