class Admin::MailCronLogsController <  OrbitBackendController
  
  # layout "new_admin"
  before_filter :authenticate_user!
  before_filter :is_admin?

  def index  

    # @mail_cron_logs = MailCronLog.all.desc(:created_at).page(params[:page_main] ).per('20')
    @mail_cron_logs = (params[:sort]) ? get_sorted_and_filtered("mail_cron_log") : get_viewable("mail_cron_log")

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @mail_crons }
      format.js
    end

  end 

  def show
    @mail_cron_log = MailCronLog.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
    end
  end
  
  def destroy 
    @mail_cron_log = MailCronLog.find(params[:id])
    @mail_cron_log.destroy

    respond_to do |format|
      # format.html { redirect_to(admin_mail_cron_logs_url) }
      # format.xml  { head :ok }
      format.js { render :layout => false }
    end
  end 

  def delete
    if params[:ids]
      # @mail_cron_logs = MailCronLog.any_in(:_id => params[:ids]).destroy_all
      @mail_cron_logs = MailCronLog.any_in(:_id => params[:ids])
    end

    respond_to do |format|
      format.js { render :layout => false }
    end
    # redirect_to admin_mail_cron_logs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
  end
  
end
