Class: Caboose::InboxController

Inherits:
ApplicationController show all
Defined in:
app/controllers/caboose/inbox_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#add_ga_event, #admin_add, #admin_bulk_add, #admin_bulk_delete, #admin_bulk_update, #admin_edit, #admin_json, #admin_json_single, #before_action, #before_before_action, #hashify_query_string, #init_cart, #logged_in?, #logged_in_user, #login_user, #logout_user, #parse_url_params, #reject_param, #under_construction_or_forwarding_domain?, #user_is_allowed, #user_is_allowed_to, #validate_cookie, #validate_token, #var, #verify_logged_in

Instance Method Details

#admin_deleteObject


22
23
24
25
26
27
# File 'app/controllers/caboose/inbox_controller.rb', line 22

def admin_delete
  @contact = Caboose::FormSubmission.where(:site_id => @site.id, :id => params[:id]).first
  @contact.is_deleted = true
  @contact.save
  redirect_to '/admin/inbox'
end

#admin_indexObject


6
7
8
9
# File 'app/controllers/caboose/inbox_controller.rb', line 6

def admin_index
  where = params[:exclude].blank? ? "(id is not null)" : "(sent_to != '#{params[:exclude]}')"
  @contacts = Caboose::FormSubmission.where(where).where(:site_id => @site.id, :is_spam => false, :is_deleted => false).order('date_submitted desc').all
end

#admin_showObject


17
18
19
# File 'app/controllers/caboose/inbox_controller.rb', line 17

def admin_show
  @contact = Caboose::FormSubmission.where(:site_id => @site.id, :id => params[:id], :is_deleted => false).first
end

#admin_spamObject


12
13
14
# File 'app/controllers/caboose/inbox_controller.rb', line 12

def admin_spam
  @contacts = Caboose::FormSubmission.where(:site_id => @site.id, :is_spam => true, :is_deleted => false).order('date_submitted desc').all
end

#admin_updateObject


30
31
32
33
34
35
# File 'app/controllers/caboose/inbox_controller.rb', line 30

def admin_update
  @contact = Caboose::FormSubmission.where(:site_id => @site.id, :id => params[:id]).first
  @contact.is_spam = !@contact.is_spam
  @contact.save
  redirect_to '/admin/inbox/' + params[:id]
end