Module: I18nDashboard::ApplicationHelper

Defined in:
app/helpers/i18n_dashboard/application_helper.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

Can search for named routes directly in the main app, omitting the “main_app.” prefix



20
21
22
23
24
25
26
# File 'app/helpers/i18n_dashboard/application_helper.rb', line 20

def method_missing method, *args, &block
  if main_app_url_helper?(method)
    main_app.send(method, *args)
  else
    super
  end
end

Instance Method Details

#humanize_key(key) ⇒ Object



14
15
16
# File 'app/helpers/i18n_dashboard/application_helper.rb', line 14

def humanize_key(key)
  key.split('.').last.gsub('_', ' ').gsub(/\b('?[a-z])/) { $1.capitalize }
end

#show_title?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/helpers/i18n_dashboard/application_helper.rb', line 10

def show_title?
  @show_title
end

#title(page_title, show_title = true) ⇒ Object



3
4
5
6
7
8
# File 'app/helpers/i18n_dashboard/application_helper.rb', line 3

def title(page_title, show_title = true)
  @show_title = show_title
  if @show_title
    content_for(:title) { h(page_title.to_s) }
  end
end