Method: Espresso::View::InstanceMethods#default_page_title

Defined in:
lib/espresso/view.rb

#default_page_titleString

Makes default page title, based on controller and action

Returns:

  • (String)

    default page title



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/espresso/view.rb', line 110

def default_page_title
  text = case view_name
         when 'index'
           if collection?
             resource_class.name
           else
             controller_name.camelize
           end
         when 'new'
           "#{t('espresso.navigation.new', :default => 'New')} #{(resource? ? resource_class : controller_name.classify.constantize).human_name}"
         when 'edit'
           "#{t('espresso.navigation.edit', :default => 'Edit')} #{(resource? ? resource_class : controller_name.classify.constantize).human_name}"
         else
           t("navigation.#{controller_name}.#{view_name}")
         end
  %(<span class="translation_missing">#{text}</span>)
end