diff options
author | elijah <elijah@riseup.net> | 2012-12-07 12:34:09 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2012-12-07 12:34:09 -0800 |
commit | a085bb3e46ac9cbf8e6f3bfeba79ddac890ef025 (patch) | |
tree | a1e5a318a40fb9bb5a022f9f4db7ba6773dcfa8b | |
parent | 0e971adb4ba67e42942864e04a7fa8bb8eb9c2e4 (diff) |
minor fixes for atom feed
-rw-r--r-- | app/helpers/application_helper.rb | 4 | ||||
-rw-r--r-- | app/views/layouts/blog/_summary.html.haml | 2 | ||||
-rw-r--r-- | lib/static_page.rb | 12 |
3 files changed, 14 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 15493e1..b5bb657 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -30,9 +30,7 @@ module ApplicationHelper else klass = options[:class] if options end - if name.starts_with?('#') - path = name - elsif name.starts_with?('http') + if name.starts_with?('#') || name.starts_with?('http') path = name else page = StaticPage.find(name) diff --git a/app/views/layouts/blog/_summary.html.haml b/app/views/layouts/blog/_summary.html.haml index 68756b1..0abe3f2 100644 --- a/app/views/layouts/blog/_summary.html.haml +++ b/app/views/layouts/blog/_summary.html.haml @@ -11,7 +11,7 @@ %div.content - if page.props.preview = page.props.preview - - if page.props.body.try(:any?) + - if page.props.more = link_to(I18n.t(:read_more), page_path(page)) - else = render :template => page.template_path
\ No newline at end of file diff --git a/lib/static_page.rb b/lib/static_page.rb index 679e799..1c5336e 100644 --- a/lib/static_page.rb +++ b/lib/static_page.rb @@ -36,6 +36,10 @@ class StaticPage attr_accessor :path, :children, :name, :props, :parent + ## + ## CLASS METHODS + ## + def self.find(filter) if filter =~ /\// path = filter.split('/').map{|segment| segment.gsub(/[^0-9a-z_-]/, '')} @@ -66,6 +70,10 @@ class StaticPage end end + ## + ## INSTANCE METHODS + ## + def initialize(parent, name) @children = [] @name = name @@ -113,6 +121,10 @@ class StaticPage end end + def id + self.name + end + protected def child_tree |