Skip to content

Commit

Permalink
Added article.excerpt liquid tag
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@1808 567b1171-46fb-0310-a4c9-b4bef9110e78
  • Loading branch information
Caged authored and Caged committed Aug 19, 2006
1 parent fe87cbf commit 3309c47
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions 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:

Expand Down
4 changes: 2 additions & 2 deletions db/schema.rb
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/mephisto/liquid/article_drop.rb
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions lib/mephisto/liquid/filters.rb
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions themes/default/templates/home.liquid
Expand Up @@ -4,6 +4,7 @@
{% if forloop.index < 3 %}
<div class="story{% if forloop.first %} first{% endif %}">
<h3>{{ article | link_to_article }}</h3>
{{ article.excerpt }}
{{ article.body }}
<div class="details">
Posted on {{ article.published_at | format_date: 'stub', true }} |
Expand Down
1 change: 1 addition & 0 deletions themes/default/templates/single.liquid
Expand Up @@ -2,6 +2,7 @@
<div class="inside">
<div class="primary">
<h1>{{ article.title }}</h1>
{{ article.excerpt }}
{{ article.body }}
</div>
<hr class="hide" />
Expand Down

0 comments on commit 3309c47

Please sign in to comment.