Sha256: ec25fa186b217793038d2151108ae180ca9fd70a9983f47f31f2f131fba477d7

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 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 || "Unknown"}", ''
		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

10 entries across 10 versions & 1 rubygems

Version Path
spud_inquiries-1.0.1 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-1.0.0 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-1.0.0.rc4 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-1.0.0.rc3 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-1.0.0.rc2 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-1.0.0.rc1.1 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-1.0.0.rc1 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-0.9.5 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-0.9.3 app/controllers/spud/admin/inquiries_controller.rb
spud_inquiries-0.9.2 app/controllers/spud/admin/inquiries_controller.rb