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



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

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

#admin_indexObject



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

def admin_index
  has_inbox = "Contact".constantize rescue false
  if has_inbox
    @contacts = Contact.where(:site_id => @site.id, :captcha_valid => true, :deleted => false).order('date_submitted desc').all
  end
end

#admin_showObject



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

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

#admin_spamObject



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

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

#admin_updateObject



41
42
43
44
45
46
47
48
49
# File 'app/controllers/caboose/inbox_controller.rb', line 41

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