diff --git a/CHANGELOG b/CHANGELOG index 001d3912..0bdfa1b8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ * SVN * +* [NEW] Added {{ article.excerpt }} liquid tag for accessing an articles excerpt. + * Change - Article#body_for_mode only returns the body, not excerpt + body. This means you'll have to do this in your templates if you want to show both: diff --git a/db/schema.rb b/db/schema.rb index 208120ff..d4607db9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -88,8 +88,8 @@ t.column "author_email", :string t.column "author_ip", :string, :limit => 100 t.column "comments_count", :integer, :default => 0 - t.column "version", :integer t.column "updater_id", :integer + t.column "version", :integer t.column "site_id", :integer t.column "approved", :boolean, :default => false t.column "comment_age", :integer, :default => 0 @@ -98,11 +98,11 @@ create_table "events", :force => true do |t| t.column "mode", :string + t.column "user_id", :integer t.column "article_id", :integer t.column "title", :text t.column "body", :text t.column "created_at", :datetime - t.column "user_id", :integer t.column "author", :string, :limit => 100 t.column "comment_id", :integer t.column "site_id", :integer diff --git a/lib/mephisto/liquid/article_drop.rb b/lib/mephisto/liquid/article_drop.rb index 0d5be916..85841131 100644 --- a/lib/mephisto/liquid/article_drop.rb +++ b/lib/mephisto/liquid/article_drop.rb @@ -13,6 +13,7 @@ def initialize(source, options = {}) 'permalink' => @source.permalink, 'url' => @source.full_permalink, 'body' => @source.send(:body_for_mode, options[:mode] || :list), + 'excerpt' => @source.excerpt_html, 'published_at' => @source.site.timezone.utc_to_local(@source.published_at), 'updated_at' => @source.site.timezone.utc_to_local(@source.updated_at), 'comments_count' => @source.comments_count, diff --git a/lib/mephisto/liquid/filters.rb b/lib/mephisto/liquid/filters.rb index 5d0515cd..41a9ccb8 100644 --- a/lib/mephisto/liquid/filters.rb +++ b/lib/mephisto/liquid/filters.rb @@ -82,6 +82,7 @@ def month_list # XXX cache this someday earliest = controller.site.articles.find(:first, :order => 'published_at').published_at.beginning_of_month end + private # marks a page as class=selected diff --git a/themes/default/templates/home.liquid b/themes/default/templates/home.liquid index bd84544b..8f44e208 100644 --- a/themes/default/templates/home.liquid +++ b/themes/default/templates/home.liquid @@ -4,6 +4,7 @@ {% if forloop.index < 3 %}

{{ article | link_to_article }}

+ {{ article.excerpt }} {{ article.body }}
Posted on {{ article.published_at | format_date: 'stub', true }} | diff --git a/themes/default/templates/single.liquid b/themes/default/templates/single.liquid index 9682a1b1..787c31d2 100644 --- a/themes/default/templates/single.liquid +++ b/themes/default/templates/single.liquid @@ -2,6 +2,7 @@

{{ article.title }}

+ {{ article.excerpt }} {{ article.body }}