diff options
| author | hukl <contact@smyck.org> | 2009-03-02 20:29:25 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-03-03 19:47:18 +0100 |
| commit | 82f16e71d49350c1ad4aa48773db5d0f45a55c6c (patch) | |
| tree | 72a341b68e2b1f35772e11add0bef7208e9b90b6 /app/helpers | |
| parent | c9183349c2fbacf24fca5cd7767190d069ce8873 (diff) | |
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
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/content_helper.rb | 4 | ||||
| -rw-r--r-- | app/helpers/nodes_helper.rb | 4 |
2 files changed, 6 insertions, 2 deletions
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 | |||
| 73 | # partial | 73 | # partial |
| 74 | def select_partial partial | 74 | def select_partial partial |
| 75 | if partial && partial_exists?( partial ) | 75 | if partial && partial_exists?( partial ) |
| 76 | return "custom_templates/partials/#{partial}" | 76 | return "custom/partials/#{partial}" |
| 77 | else | 77 | else |
| 78 | return 'content/article' | 78 | return 'content/article' |
| 79 | end | 79 | end |
| @@ -83,7 +83,7 @@ module ContentHelper | |||
| 83 | def partial_exists? partial | 83 | def partial_exists? partial |
| 84 | File.exist?( | 84 | File.exist?( |
| 85 | File.join( | 85 | File.join( |
| 86 | RAILS_ROOT, 'app', 'views', 'custom_templates', 'partials', "_#{partial}.html.erb" | 86 | RAILS_ROOT, 'app', 'views', 'custom', 'partials', "_#{partial}.html.erb" |
| 87 | ) | 87 | ) |
| 88 | ) | 88 | ) |
| 89 | end | 89 | 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 | |||
| 7 | truncate(node.draft.title, :length => 50) | 7 | truncate(node.draft.title, :length => 50) |
| 8 | end | 8 | end |
| 9 | end | 9 | end |
| 10 | |||
| 11 | def custom_page_templates | ||
| 12 | Page.custom_templates.map {|x| [x.gsub("_", " ").titlecase, x]} | ||
| 13 | end | ||
| 10 | end | 14 | end |
