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