diff options
| -rw-r--r-- | app/controllers/content_controller.rb | 3 | ||||
| -rw-r--r-- | app/models/page.rb | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index 706cfcd..d548a34 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb | |||
| @@ -10,7 +10,7 @@ class ContentController < ApplicationController | |||
| 10 | 10 | ||
| 11 | @page = Node.find_page(path) | 11 | @page = Node.find_page(path) |
| 12 | 12 | ||
| 13 | if @page | 13 | if @page and @page.public? |
| 14 | template = @page.valid_template | 14 | template = @page.valid_template |
| 15 | 15 | ||
| 16 | render( | 16 | render( |
| @@ -25,4 +25,5 @@ class ContentController < ApplicationController | |||
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | end | 27 | end |
| 28 | |||
| 28 | end | 29 | end |
diff --git a/app/models/page.rb b/app/models/page.rb index ae2f998..af820e3 100644 --- a/app/models/page.rb +++ b/app/models/page.rb | |||
| @@ -109,6 +109,10 @@ class Page < ActiveRecord::Base | |||
| 109 | I18n.locale = locale_before | 109 | I18n.locale = locale_before |
| 110 | end | 110 | end |
| 111 | 111 | ||
| 112 | def public? | ||
| 113 | published_at.nil? ? true : published_at < Time.now | ||
| 114 | end | ||
| 115 | |||
| 112 | private | 116 | private |
| 113 | 117 | ||
| 114 | def rewrite_links_in_body | 118 | def rewrite_links_in_body |
