目前菜单有固定的几个大分类: Wedding,Lover,Family,Girl,Portrait,Personal
我是直接在 album 的 model 里面写了 CATEGORIES 的常量。
然后吧@albums
循环出来对应具体的 category。
- @albums.each do |album|
- case album.category
- when "wedding"
= link_to album.title, album
- when "lover"
= link_to album.title, album
- when "family"
= link_to album.title, album
- when "girl"
= link_to album.title, album
- when "portrait"
= link_to album.title, album
- when "personal"
= link_to album.title, album
但是最终的效果我想要的是:
dl.nav
dt.wedding Wedding
dd
= link_to "wedding1"
= link_to "wedding2"
dt.lover Lover
dd
= link_to "lover1"
= link_to "lover2"
....