Module: Mokio::FrontendHelpers::LangsHelper
- Defined in:
- lib/mokio/frontend_helpers/langs_helper.rb
Overview
Frontend helper methods used with Mokio::Lang objects
Instance Method Summary collapse
-
#build_lang_menu(image_folder = "langs", nav_class = "lang_nav", image_ext = "png") ⇒ Object
Builds forms with buttons to choose site language Pass your controller action path and check params.
Instance Method Details
#build_lang_menu(image_folder = "langs", nav_class = "lang_nav", image_ext = "png") ⇒ Object
Builds forms with buttons to choose site language Pass your controller action path and check params
Attributes
-
image_folder
- folder where helper will search country flag images (default: “langs” - searched in app/assets/images/langs) -
nav_class
- nav css class (defaut: “lang_nav”) -
image_ext
- language flag image extension(defaut: “png”)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mokio/frontend_helpers/langs_helper.rb', line 17 def (image_folder = "langs", nav_class = "lang_nav", image_ext = "png") lang_links = '' Mokio::Lang.active.each do |lang| lang_link =<<HTML <li>#{link_to_unless(I18n.locale.to_s == lang.shortname, image_tag("#{image_folder}/#{lang.shortname}.#{image_ext}"), root_url( locale: lang.shortname.to_sym ), class: 'lang-link')}</li> HTML lang_links << lang_link end html =<<HTML <nav id="#{nav_class}"> <ul id='lang_list'> #{lang_links} </ul> </nav> HTML html.html_safe end |