Sha256: c365195de990c6789032082a55b30ce826cc9f673cf7ae3306cdec6f616773ec

Contents?: true

Size: 1.67 KB

Versions: 9

Compression:

Stored size: 1.67 KB

Contents

module Caboose
  class InboxController < ApplicationController
    layout 'caboose/admin'
    
    # @route GET /admin/inbox
    def admin_index
      has_inbox = "Contact".constantize rescue false
      if has_inbox
        where = params[:exclude].blank? ? "(id is not null)" : "(sent_to != '#{params[:exclude]}')"
        @contacts = Contact.where(where).where(:site_id => @site.id, :captcha_valid => true, :deleted => false).order('date_submitted desc').all
      end
    end

    # @route GET /admin/inbox/spam
    def admin_spam
      has_inbox = "Contact".constantize rescue false
      if has_inbox
        @contacts = Contact.where(:site_id => @site.id, :captcha_valid => false, :deleted => false).order('date_submitted desc').all
      end
    end

    # @route GET /admin/inbox/:id
    def admin_show
      has_inbox = "Contact".constantize rescue false
      if has_inbox
        @contact = Contact.where(:site_id => @site.id, :id => params[:id], :deleted => false).first
      end
    end

    # @route GET /admin/inbox/:id/delete
    def admin_delete
      has_inbox = "Contact".constantize rescue false
      if has_inbox
        @contact = Contact.where(:site_id => @site.id, :id => params[:id]).first
        @contact.deleted = true
        @contact.save
        redirect_to '/admin/inbox'
      end
    end

    # @route GET /admin/inbox/:id/spam
    def admin_update
      has_inbox = "Contact".constantize rescue false
      if has_inbox
        @contact = Contact.where(:site_id => @site.id, :id => params[:id]).first
        @contact.captcha_valid = !@contact.captcha_valid
        @contact.save
        redirect_to '/admin/inbox/' + params[:id]
      end
    end
            
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
caboose-cms-0.9.187 app/controllers/caboose/inbox_controller.rb
caboose-cms-0.9.186 app/controllers/caboose/inbox_controller.rb
caboose-cms-0.9.185 app/controllers/caboose/inbox_controller.rb
caboose-cms-0.9.184 app/controllers/caboose/inbox_controller.rb
caboose-cms-0.9.183 app/controllers/caboose/inbox_controller.rb
caboose-cms-0.9.182 app/controllers/caboose/inbox_controller.rb
caboose-cms-0.9.181 app/controllers/caboose/inbox_controller.rb
caboose-cms-0.9.180 app/controllers/caboose/inbox_controller.rb
caboose-cms-0.9.179 app/controllers/caboose/inbox_controller.rb