Guest User

Untitled

a guest
Feb 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. SECTION_NAV_PROC = Proc.new do |parent|
  2. sections = Section.find(:all, :conditions => ['sections.active = ?', true], :order => 'sections.position', :include => [:urlnames, :project_listing_entries])
  3. res = sections.inject([]) do |urls, s|
  4. if s.project_listing_entries.length > 0
  5. section_url = parent.create_url s.urlname, parent.default_params.merge(:id => s.urlname) do |u|
  6. u.label = s.name(parent.default_params[:lang])
  7. u.description = "#{s.description(parent.default_params[:lang])} (#{s.project_listing_entries.length})"
  8. end
  9. urls << section_url
  10. end
  11. urls
  12. end
  13. res
  14. end
  15.  
  16. NAVIGATION = Loob::NavigationAid::UrlList.new do
  17.  
  18. recognize :nl, '/nl' do |lang|
  19. lang.label = 'nederlands'
  20. lang.description = 'Nederlandse website'
  21. lang.create_subnav(:lang => 'nl') do |section|
  22.  
  23. section.recognize :index, :controller => 'main', :action => 'index' do |url|
  24. url.label = 'beek design'
  25. url.description = 'terug naar homepage'
  26. url.create_subnav do |sub|
  27. sub.recognize :welcome, :controller => 'main' do |url|
  28. url.label = 'welkom'
  29. url.description = 'welkom bij beek design bvba'
  30. end
  31. sub.recognize :news, :controller => 'news' do |url|
  32. url.label = 'actueel'
  33. url.description = 'nieuws en actualiteit'
  34. end
  35. sub.recognize :links, :controller => 'news', :action => 'links' do |url|
  36. url.label = 'publicaties + links'
  37. url.description = 'publicaties en websites van fabrikanten, opdrachtgevers, ...'
  38. end
  39. end
  40. end
  41.  
  42. section.recognize :work, :controller => 'work', :action => 'overview', :id => nil do |url|
  43. url.label = 'werk'
  44. url.description = 'producten - projecten - vrij werk'
  45. url.dynamic_subnav({ :controller => 'work', :action => 'overview' }, SECTION_NAV_PROC)
  46. end
  47.  
  48. section.recognize :contact, :controller => 'main', :action => 'contact' do |url|
  49. url.label = 'contact'
  50. url.description = 'adres - contactformulier'
  51. url.create_subnav do |sub|
  52. sub.recognize :form, '#form' do |url|
  53. url.label = 'formulier'
  54. url.description = 'contactformulier'
  55. end
  56. sub.recognize :address, '#address' do |url|
  57. url.label = 'adres'
  58. url.description = 'adresgegevens'
  59. end
  60. end
  61. end
  62.  
  63. section.recognize :home, '/' do |url|
  64. url.label = 'homepage'
  65. url.description = 'terug naar homepage'
  66. end
  67.  
  68. end
  69. end
  70.  
  71. recognize :en, '/en' do |lang|
  72. lang.label = 'english'
  73. lang.description = 'English website'
  74. lang.create_subnav(:lang => 'en') do |section|
  75.  
  76. section.recognize :work, :controller => 'work', :action => 'overview', :id => nil do |url|
  77. url.label = 'work'
  78. url.description = 'products - projects - autonomous work'
  79. url.dynamic_subnav({ :controller => 'work', :action => 'overview' }, SECTION_NAV_PROC)
  80. end
  81.  
  82. section.recognize :home, '/' do |url|
  83. url.label = 'homepage'
  84. url.description = 'terug naar homepage'
  85. end
  86.  
  87. end
  88. end
  89.  
  90. end
Add Comment
Please, Sign In to add comment