Module: RailsCodebook::Admin::CodebooksHelper
- Defined in:
- app/helpers/rails_codebook/admin/codebooks_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
21
22
23
24
25
26
27
|
# File 'app/helpers/rails_codebook/admin/codebooks_helper.rb', line 21
def method_missing method, *args, &block
if main_app_url_helper?(method)
main_app.send(method, *args)
else
super
end
end
|
Instance Method Details
#all_codebooks ⇒ Object
29
30
31
|
# File 'app/helpers/rails_codebook/admin/codebooks_helper.rb', line 29
def all_codebooks
RailsCodebook::Codebook.all.uniq(&:cb_name)
end
|
#humanize_key(key) ⇒ Object
15
16
17
|
# File 'app/helpers/rails_codebook/admin/codebooks_helper.rb', line 15
def humanize_key(key)
key.split('.').last.gsub('_', ' ').gsub(/\b('?[a-z])/) { $1.capitalize }
end
|
#show_title? ⇒ Boolean
11
12
13
|
# File 'app/helpers/rails_codebook/admin/codebooks_helper.rb', line 11
def show_title?
@show_title
end
|
#title(page_title, show_title = true) ⇒ Object
4
5
6
7
8
9
|
# File 'app/helpers/rails_codebook/admin/codebooks_helper.rb', line 4
def title(page_title, show_title = true)
@show_title = show_title
if @show_title
content_for(:title) { h(page_title.to_s) }
end
end
|