Sha256: cadc03c13695fe5f4564a21e92bf3dc5a798892b5409fe901b3b4d7ef1a6556f

Contents?: true

Size: 896 Bytes

Versions: 6

Compression:

Stored size: 896 Bytes

Contents

module Netzke
  module ControllerExtensions
    def self.included(base)
      base.send(:before_filter, :set_session_data)
    end
    
    def set_session_data
      Netzke::Base.session = session
      session[:netzke_user_id] = defined?(current_user) ? current_user.try(:id) : nil
      # set netzke_just_logged_in and netzke_just_logged_out states (may be used by Netzke widgets)
      if session[:_netzke_next_request_is_first_after_login]
        session[:netzke_just_logged_in] = true
        session[:_netzke_next_request_is_first_after_login] = false
      else
        session[:netzke_just_logged_in] = false
      end

      if session[:_netzke_next_request_is_first_after_logout]
        session[:netzke_just_logged_out] = true
        session[:_netzke_next_request_is_first_after_logout] = false
      else
        session[:netzke_just_logged_out] = false
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
netzke-core-0.5.5 lib/netzke/controller_extensions.rb
netzke-core-0.5.4 lib/netzke/controller_extensions.rb
netzke-core-0.5.3 lib/netzke/controller_extensions.rb
netzke-core-0.5.2 lib/netzke/controller_extensions.rb
netzke-core-0.5.1 lib/netzke/controller_extensions.rb
netzke-core-0.5.0 lib/netzke/controller_extensions.rb