Guest User

Untitled

a guest
Jun 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. ## in application_helper.rb
  2.  
  3. def navigation_item(text, controller_name, action_name = nil)
  4. current = (controller.controller_name == controller_name) and (action_name.nil? or controller.action_name == action_name)
  5. "<li class=\"ui-state-default ui-corner-top #{'ui-tabs-selected ui-state-active' if current}\">#{link_to text, :controller => controller_name, :action => action_name}</li>"
  6. end
  7.  
  8. ## in the view:
  9.  
  10. <%= navigation_item I18n.t('layout.navigation.instruments'), "instruments" %>
  11. <%= navigation_item I18n.t('layout.navigation.indicators'), "indicators" %>
  12. <%= navigation_item I18n.t('layout.navigation.exchange_rates'), "exchange_rates" %>
  13. <%= navigation_item I18n.t('layout.navigation.import_quotes'), "quotes", "import" %>
  14.  
  15. ## /config/locales/views/layout/en.yml:
  16.  
  17. en:
  18.  
  19. layout:
  20. navigation:
  21. instruments: "Instruments"
  22. indicators: "Indicators"
  23. exchange_rates: "Exchange Rates"
  24. investment_category: "Investment Category"
  25.  
  26. ## /config/locales/views/layout/de.yml:
  27.  
  28. de:
  29.  
  30. layout:
  31. navigation:
  32. instruments: "Papiere"
  33. indicators: "Indikatoren"
  34. exchange_rates: "Wechselkurse"
  35. investment_category: "Anlagekategorien"
Add Comment
Please, Sign In to add comment