Permalink
Browse files

Hook up news items on home page

  • Loading branch information...
1 parent 4ad192e commit d4767641aa281540b15f201ed4560e388d671720 @ffmike ffmike committed Jun 29, 2009
@@ -4,7 +4,7 @@ class NewsItemsController < ApplicationController
before_filter :find_news_item, :only => [ :show, :edit, :update, :destroy ]
def index
- @news_items = NewsItem.all(:order => "name")
+ @news_items = NewsItem.all(:order => "created_at DESC")
@page_title = "RailsBridge News Items"
end
@@ -3,6 +3,7 @@ class PagesController < ApplicationController
def home
@page_title = 'RailsBridge'
@projects = Project.all.shuffle
+ @news_items = NewsItem.all(:order => "created_at DESC", :limit => 2)
end
def css_test
@@ -7,13 +7,14 @@
<hr />
<h2 class="redMarking"><strong>News</strong></h2>
- <h3><a href="#" title="Some news"><span class="date">06.26.09</span> Lorem ipsum dolor sit amet</a></h3>
- <p>Proin vel ante tellus, non fringilla sapien. Pellentesque eu dignissim nisi. Praesent id vehicula tellus. Curabitur odio nulla, vehicula at eleifend vel, sodales eget tortor.</p>
-
- <h3><a href="#" title="Some news"><span class="date">06.09.09</span> Etiam nec dolor sit amet</a></h3>
- <p>Donec mauris ligula, tincidunt nec commodo id, feugiat ut libero. Vestibulum porta malesuada pellentesque. Nam dolor augue, feugiat blandit imperdiet non, posuere vitae erat. Cras vulputate gravida dolor vitae mattis.</p>
+ <% @news_items.each do |news_item| %>
+ <h3><%= link_to "<span class='date'>#{news_item.created_at.strftime('%m.%d.%y')}</span>" + news_item.headline, news_item %></h3>
+ <p>
+ <%= textilize_without_paragraph news_item.lede %> <%= link_to("more &raquo;", news_item) if !news_item.body.blank? %>
+ </p>
+ <% end %>
- <p class="allNews"><a href="#" title="View all news">View all news &raquo;</a></p>
+ <p class="allNews"><%= link_to "View all news &raquo;", news_items_path %></p>
<hr />
<form id="subscribe" action="/subscribe" method="get" >
<p>
@@ -46,4 +46,6 @@
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
# config.i18n.default_locale = :de
-end
+end
+
+require 'RedCloth'
@@ -1,5 +1,5 @@
lede = <<-END
-"Rails Builders"":http://builders.railsbridge.org has several pro bono projects underway for non-profit organizations.
+"Rails Builders":http://builders.railsbridge.org has several pro bono projects underway for non-profit organizations.
We're always in need of more volunteers, so if you'd like to do some good while enhancing your portfolio, head over to the Builders
web site and let us know how you'd like to be involved.
END

0 comments on commit d476764

Please sign in to comment.