Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (38 sloc) 1.192 kb
module Refinery
module Inquiries
module Admin
class InquiriesController < ::Refinery::AdminController
crudify :'refinery/inquiries/inquiry',
:title_attribute => "name",
:order => "created_at DESC"
helper_method :group_by_date
before_filter :find_all_ham, :only => [:index]
before_filter :find_all_spam, :only => [:spam]
before_filter :get_spam_count, :only => [:index, :spam]
def index
@inquiries = @inquiries.with_query(params[:search]) if searching?
@inquiries = @inquiries.page(params[:page])
end
def spam
self.index
render :action => 'index'
end
def toggle_spam
find_inquiry
@inquiry.toggle!(:spam)
redirect_to :back
end
protected
def find_all_ham
@inquiries = Refinery::Inquiries::Inquiry.ham
end
def find_all_spam
@inquiries = Refinery::Inquiries::Inquiry.spam
end
def get_spam_count
@spam_count = Refinery::Inquiries::Inquiry.where(:spam => true).count
end
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.