Sha256: 9301629f1f08d75714ffca9302d258620a64ca56da75e09e3abb3f35ae8309e3

Contents?: true

Size: 964 Bytes

Versions: 6

Compression:

Stored size: 964 Bytes

Contents

class ApplicationController < ActionController::Base
  protect_from_forgery
  inherit_resources
  layout :layout
  helper :all
  
  include SslRequirement
  
  def email_form
    # send mail stuff here
    SoapboxMailer.email_form(params).deliver
    flash[:notice] = "Your email has been sent. Thanks."
    redirect_to :back
  end
  
  def after_sign_in_path_for(resource)
    if resource.is_a?(Member)
      goto = home_members_path
    else
      super
    end
  end

private
  def render_in_template(obj)
    if (!obj.template.blank? && 
        FileTest.exists?(Rails.root.join('app', 'views', obj.class.to_s.tableize, 'templates', "#{obj.template}.html.erb")))
      render "#{obj.class.to_s.tableize}/templates/#{obj.template}"
    else
      render "#{obj.class.to_s.tableize}/templates/default"
    end
  end
  def layout
    # only turn it off for login pages:
    # debugger
    request.path.split("/")[1] == "users" ? "login" : "application"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
soapbox-0.2.1 app/controllers/application_controller.rb
soapbox-0.2.0 app/controllers/application_controller.rb
soapbox-0.1.7 app/controllers/application_controller.rb
soapbox-0.1.3 app/controllers/application_controller.rb
soapbox-0.1.2 app/controllers/application_controller.rb
soapbox-0.1.1 app/controllers/application_controller.rb