Sha256: 4d8805046e061c09f9d6f286ab9c3bdfdc1677803f346a476ce300140f7b27ef

Contents?: true

Size: 862 Bytes

Versions: 2

Compression:

Stored size: 862 Bytes

Contents

# Parts of this class borrowed from:
# https://gist.github.com/josevalim/fb706b1e933ef01e4fb6
# Thank you Jose Valim!

module Jobshop
  class ApplicationController < ActionController::Base
    layout :layout_for_application

    protect_from_forgery

    before_action EmailTokenValidation
    before_action :authenticate_user!

    def after_sign_in_path_for(resource_or_scope)
      if !resource_or_scope.onboard?
        welcome_path
      else
        super
      end
    end

    private

    def current_team
      @current_team ||= current_user && current_user.team
    end; helper_method :current_team

    def layout_for_application
      if devise_controller? && controller_name == "sessions" ||
          controller_path == "jobshop/teams/lookups"
        "jobshop/unauthenticated"
      else
        "jobshop/application"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jobshop-0.0.131 app/controllers/jobshop/application_controller.rb
jobshop-0.0.127 app/controllers/jobshop/application_controller.rb