Class | PageTemplate |
In: |
app/models/page_template.rb
|
Parent: | DynamicView |
# File app/models/page_template.rb, line 17 17: def self.default_body 18: html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n <title><%= page_title %></title>\n <%= yield :html_head %>\n </head>\n <body>\n <%= cms_toolbar %>\n <%= container :main %>\n </body>\n</html>\n" 19: html 20: end
# File app/models/page_template.rb, line 36 36: def self.display_name(file_name) 37: name, format, handler = file_name.split('.') 38: "#{name.titleize} (#{format}/#{handler})" 39: end
# File app/models/page_template.rb, line 13 13: def self.file_path 14: File.join(base_path, relative_path) 15: end
This is a combination of file system page templates and database page templates
# File app/models/page_template.rb, line 43 43: def self.options 44: file_system_templates = ActionController::Base.view_paths.map{|p| Dir["#{p}/#{relative_path}/*"]}.flatten.map{|f| File.basename(f)} 45: page_templates = file_system_templates + all.map{|t| t.file_name } 46: page_templates.map{|f| [display_name(f), f] }.sort.uniq 47: end
# File app/models/page_template.rb, line 9 9: def self.relative_path 10: File.join("layouts", "templates") 11: end