Sha256: be8d4ed24c5943597031fd608ed8962f242a5f0fcb0107dd5e7b20cc93f075d4

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

class Spud::Admin::InquiriesController < Spud::Admin::ApplicationController
	layout 'spud/admin/detail'
	belongs_to_spud_app :inquiries
	add_breadcrumb "Inquiries", :spud_admin_inquiries_path
	before_filter :load_inquiries,:only => [:edit,:update,:show,:destroy]	
	def index
		@inquiries = SpudInquiry.order("created_at DESC").includes(:spud_inquiry_form).paginate :page => params[:page]
		respond_with @inquiries
	end

	def show
		add_breadcrumb "#{@inquiry.email}", :spud_admin_inquiry_path
		respond_with @inquiry
	end

	def destroy
		status = 500
		if @inquiry.destroy
			status = 200
		end
		respond_with @inquiry do |format|
			format.js { render :status => status,:text => nil}
			format.html {
				flash[:error] = "Error removing inquiry!" if status == 500
				flash[:notice] = "Inquiry removed!" if status == 200
				redirect_to spud_admin_inquiries_path and return
			}
		end
	end
private
	def load_inquiries
		@inquiry = SpudInquiry.where(:id => params[:id]).first
		if @inquiry.blank?
			flash[:error] = "Inquiry not found!"
			redirect_to spud_admin_inquiries_path and return
		end
	end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spud_inquiries-0.8.3 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-0.8.2 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-0.8.1 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-0.8.0 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-0.3.4 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-0.3.3 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-0.3.2 app/controllers/spud/admin/inquiries_controller.rb