class Admin::AdImagesController < Admin::AdBannersController # before_filter :force_order_for_user # before_filter :for_app_sub_manager # before_filter :for_app_manager def initialize super @app_title = "ad_banner" end def index #@ad_banner = AdBanner.find params[:ad_banner_id] #@ad_images = @ad_banner.ad_images.all.page(params[:page]).per(10) @ad_images = AdImage.all.page(params[:page]).per(10) end def edit #@ad_banner = AdBanner.find params[:ad_banner_id] @ad_image = AdImage.find(params[:id]) @tags = get_tags end def update @ad_image = AdImage.find(params[:id]) @ad_image.update_attributes(params[:ad_image]) redirect_to admin_ad_images_path end def new #ad_banner = AdBanner.find params[:ad_banner_id] #@ad_image =ad_banner.ad_images.build @ad_image = AdImage.new @ad_image.post_date = Date.today @ad_image.unpost_date = Date.today + 30 @tags = get_tags #render :action => 'new',:url=> {:ad_banner_id => params.has_key?(:ad_banner_id)? params[:ad_banner_id],nil} end def create # @ad_banner = AdBanner.find params[:ad_banner][:id] @ad_image = AdImage.new params[:ad_image] #@ad_image.to_save = true #@ad_banner.ad_images << ad_image if @ad_image.save redirect_to admin_ad_images_path end end def destroy #@ad_banner = AdBanner.find params[:ad_banner_id] @ad_image = AdImage.find params[:id] if @ad_image.destroy flash[:notice] = t('ad.success_destroy_ad_image') redirect_to admin_ad_images_path end end end