3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/home_page_blog/navigation.rb', line 3
def self.(resource)
case resource
when 'posts'
Proc.new do |primary, options|
primary.item :posts, I18n.t('posts.index.title'), posts_path do |posts|
posts.item :new, I18n.t('general.new'), new_post_path
unless (@post.new_record? rescue true)
posts.item :show, @post.title, post_path(@post) do |post|
if user_signed_in?
post.item :destroy, I18n.t('general.destroy'), post_path(@post), method: :delete, confirm: I18n.t('general.questions.are_you_sure')
end
post.item :show, I18n.t('general.details'), "#{post_path(@post)}#top"
post.item :edit, I18n.t('general.edit'), edit_post_path(@post) if user_signed_in?
end
end
end
end
end
end
|