Files

UbiquoI18n::Extensions::Helpers

This module provides some builtin helpers to be used in views

Public Instance Methods

locale_selector(options = {}) click to toggle source

Returns a selector of the currently active locales, ordered alphabetically, with the current locale selected.

Options can contain the following options:

  :keep_page => unless true, the page parameter is removed in the
                destination url, to prevent wrong page number in index pages
    # File vendor/plugins/ubiquo_i18n/lib/ubiquo_i18n/extensions/helpers.rb, line 14
14:       def locale_selector(options = {})
15:         redirect_params = params.dup
16:         redirect_params.delete(:page) unless options[:keep_page]
17:         if Locale.active.size > 1
18:           form_tag(url_for(redirect_params), :method => :get) +
19:             html_unescape(select_tag("locale",
20:                                      options_for_locale_selector,
21:                                      :id => "locale_selector")) +
22:             "</form>"
23:         end
24:       end
options_for_locale_selector() click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_i18n/lib/ubiquo_i18n/extensions/helpers.rb, line 43
43:       def options_for_locale_selector
44:         options_from_collection_for_select(Locale.active.ordered_alphabetically,
45:                                            :iso_code, 
46:                                            :native_name, 
47:                                            current_locale)
48:       end
show_translations(model, options = {}) click to toggle source

For a given model, show their translations with a link to them

    # File vendor/plugins/ubiquo_i18n/lib/ubiquo_i18n/extensions/helpers.rb, line 27
27:       def show_translations(model, options = {})
28:         return if model.in_locale?(:any)
29:         render :partial => "shared/ubiquo/model_translations", 
30:                :locals => {:model => model, :options => options}
31:       end
superadmin_locales_tab(navtab) click to toggle source

Adds a tab to display the locales section inside superadmin area

    # File vendor/plugins/ubiquo_i18n/lib/ubiquo_i18n/extensions/helpers.rb, line 34
34:       def superadmin_locales_tab(navtab)
35:         navtab.add_tab do |tab|
36:           tab.text = I18n.t("ubiquo.i18n.translations")
37:           tab.title = I18n.t("ubiquo.i18n.translations_title")
38:           tab.highlights_on({:controller => "ubiquo/locales"})
39:           tab.link = ubiquo_locales_path
40:         end if ubiquo_config_call(:assets_permit, {:context => :ubiquo_media})
41:       end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.