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,
|
'today' => Date.today,
|
||||||
'locale' => I18n.locale,
|
'locale' => I18n.locale,
|
||||||
'default_locale' => current_site.default_locale.to_s,
|
'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)
|
assigns.merge!(Locomotive.config.context_assign_extensions)
|
||||||
@ -105,4 +106,4 @@ module Locomotive
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user