38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/home_page/navigation.rb', line 38
def self.(resource)
case resource
when :users
Proc.new do |primary, options|
if user_signed_in?
primary.item :users, I18n.t('users.index.title'), users_path do |users|
unless (@user.new_record? rescue true) || current_user.try(:id) == @user.id
if options[:after_resource_has_many]
instance_exec users, {}, &options[:after_resource_has_many]
end
end
end
end
end
when :authentication
Proc.new do |primary, options|
if user_signed_in?
primary.item :sign_out, I18n.t('authentication.sign_out'), destroy_user_session_path, method: :delete
else
primary.item :authentication, I18n.t('authentication.title'), new_user_session_path do |authentication|
authentication.item :sign_in, I18n.t('authentication.sign_in'), new_user_session_path
authentication.item :sign_up, I18n.t('authentication.sign_up'), new_user_registration_path
end
end
end
end
end
|