added current_user
This commit is contained in:
parent
d6059c2a9b
commit
b87c76bc67
23
lib/locomotive/liquid/drops/current_user.rb
Normal file
23
lib/locomotive/liquid/drops/current_user.rb
Normal file
@ -0,0 +1,23 @@
|
||||
module Locomotive
|
||||
module Liquid
|
||||
module Drops
|
||||
class CurrentUser < Base
|
||||
|
||||
include ::Rails.application.routes.url_helpers
|
||||
|
||||
def logged_in?
|
||||
_source.present?
|
||||
end
|
||||
|
||||
def name
|
||||
_source.name if logged_in?
|
||||
end
|
||||
|
||||
def email
|
||||
_source.email if logged_in?
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -55,7 +55,8 @@ module Locomotive
|
||||
'today' => Date.today,
|
||||
'locale' => I18n.locale,
|
||||
'default_locale' => current_site.default_locale.to_s,
|
||||
'locales' => current_site.locales
|
||||
'locales' => current_site.locales,
|
||||
'current_user' => Locomotive::Liquid::Drops::CurrentUser.new(current_locomotive_account)
|
||||
}
|
||||
|
||||
assigns.merge!(Locomotive.config.context_assign_extensions)
|
||||
|
Loading…
Reference in New Issue
Block a user