14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/railings/layout_helper.rb', line 14
def title controller
scope = [
controller.class.parent == Object ? nil : controller.class.parent.name.downcase,
controller.controller_name,
controller.action_name
].compact
options = { :default => '' }
controller.instance_variables.each do |name|
options.merge! name.to_s[1..-1].to_sym => controller.instance_variable_get(name).to_s if
controller.instance_variable_get(name).kind_of?(MongoMapper::Document)
end
while scope.any?
t(:title, options.merge!(:scope => scope)).tap do |title|
return title unless title.blank?
end
scope.pop
end
t :title, :default => ::Rails.application.class.parent.name.titleize
end
|