Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SECTION_NAV_PROC = Proc.new do |parent|
- sections = Section.find(:all, :conditions => ['sections.active = ?', true], :order => 'sections.position', :include => [:urlnames, :project_listing_entries])
- res = sections.inject([]) do |urls, s|
- if s.project_listing_entries.length > 0
- section_url = parent.create_url s.urlname, parent.default_params.merge(:id => s.urlname) do |u|
- u.label = s.name(parent.default_params[:lang])
- u.description = "#{s.description(parent.default_params[:lang])} (#{s.project_listing_entries.length})"
- end
- urls << section_url
- end
- urls
- end
- res
- end
- NAVIGATION = Loob::NavigationAid::UrlList.new do
- recognize :nl, '/nl' do |lang|
- lang.label = 'nederlands'
- lang.description = 'Nederlandse website'
- lang.create_subnav(:lang => 'nl') do |section|
- section.recognize :index, :controller => 'main', :action => 'index' do |url|
- url.label = 'beek design'
- url.description = 'terug naar homepage'
- url.create_subnav do |sub|
- sub.recognize :welcome, :controller => 'main' do |url|
- url.label = 'welkom'
- url.description = 'welkom bij beek design bvba'
- end
- sub.recognize :news, :controller => 'news' do |url|
- url.label = 'actueel'
- url.description = 'nieuws en actualiteit'
- end
- sub.recognize :links, :controller => 'news', :action => 'links' do |url|
- url.label = 'publicaties + links'
- url.description = 'publicaties en websites van fabrikanten, opdrachtgevers, ...'
- end
- end
- end
- section.recognize :work, :controller => 'work', :action => 'overview', :id => nil do |url|
- url.label = 'werk'
- url.description = 'producten - projecten - vrij werk'
- url.dynamic_subnav({ :controller => 'work', :action => 'overview' }, SECTION_NAV_PROC)
- end
- section.recognize :contact, :controller => 'main', :action => 'contact' do |url|
- url.label = 'contact'
- url.description = 'adres - contactformulier'
- url.create_subnav do |sub|
- sub.recognize :form, '#form' do |url|
- url.label = 'formulier'
- url.description = 'contactformulier'
- end
- sub.recognize :address, '#address' do |url|
- url.label = 'adres'
- url.description = 'adresgegevens'
- end
- end
- end
- section.recognize :home, '/' do |url|
- url.label = 'homepage'
- url.description = 'terug naar homepage'
- end
- end
- end
- recognize :en, '/en' do |lang|
- lang.label = 'english'
- lang.description = 'English website'
- lang.create_subnav(:lang => 'en') do |section|
- section.recognize :work, :controller => 'work', :action => 'overview', :id => nil do |url|
- url.label = 'work'
- url.description = 'products - projects - autonomous work'
- url.dynamic_subnav({ :controller => 'work', :action => 'overview' }, SECTION_NAV_PROC)
- end
- section.recognize :home, '/' do |url|
- url.label = 'homepage'
- url.description = 'terug naar homepage'
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment