From 82f16e71d49350c1ad4aa48773db5d0f45a55c6c Mon Sep 17 00:00:00 2001 From: hukl Date: Mon, 2 Mar 2009 20:29:25 +0100 Subject: introducing page templates - need to add edit capabilities renamed the custom template folder forgot one fix for the new custom template path page templates refined renamed page attribute template to template_name as i suspected it to be a reserved word. it still didn't work until i discovered that simon defined the accessible attributes! That costed me 40 minutes of lifetime. But he apologized ;) tests for public and custom page templates --- app/helpers/content_helper.rb | 4 ++-- app/helpers/nodes_helper.rb | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index fba7737..a586142 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb @@ -73,7 +73,7 @@ module ContentHelper # partial def select_partial partial if partial && partial_exists?( partial ) - return "custom_templates/partials/#{partial}" + return "custom/partials/#{partial}" else return 'content/article' end @@ -83,7 +83,7 @@ module ContentHelper def partial_exists? partial File.exist?( File.join( - RAILS_ROOT, 'app', 'views', 'custom_templates', 'partials', "_#{partial}.html.erb" + RAILS_ROOT, 'app', 'views', 'custom', 'partials', "_#{partial}.html.erb" ) ) end diff --git a/app/helpers/nodes_helper.rb b/app/helpers/nodes_helper.rb index fc5b0a0..bd54d3d 100644 --- a/app/helpers/nodes_helper.rb +++ b/app/helpers/nodes_helper.rb @@ -7,4 +7,8 @@ module NodesHelper truncate(node.draft.title, :length => 50) end end + + def custom_page_templates + Page.custom_templates.map {|x| [x.gsub("_", " ").titlecase, x]} + end end -- cgit v1.3