Skip to content

Instantly share code, notes, and snippets.

@kracekumar
Created March 22, 2011 15:10
Show Gist options
  • Save kracekumar/881376 to your computer and use it in GitHub Desktop.
Save kracekumar/881376 to your computer and use it in GitHub Desktop.
<div id="content-header">
<img src="/images/manage_news/manage_news_logo.png" />
<h1>School News</h1>
<h3>Latest announcements</h3>
<div id="app-back-button">
<%= link_to_function image_tag("/images/buttons/back.png",:border => 0), "history.back()" %>
</div>
</div>
<div id="page-yield">
<% unless flash[:notice].nil? %>
<p class="flash-msg"> <%= flash[:notice] %> </p>
<% end %>
<div id="all_news">
<table id="listing" align="center" width="100%" cellpadding="1" cellspacing="1">
<tr class="tr-head">
<td>
Sl no.
</td>
<td>
Title
</td>
<td>
Author
</td>
<td>
Comments
</td>
<td>
Posted
</td>
</tr>
<tr class="tr-blank"></tr>
<% @news.each_with_index do |r,i| %>
<% @comments = NewsComment.find_all_by_news_id(r.id) %>
<% link_value = r.title %>
<tr class="tr-<%= cycle('odd', 'even') %>">
<td class="col-1">
<%= i+1 %>
</td>
<td class="col-3">
<%= link_to link_value, :controller => 'news', :action => 'view', :id => r.id%>
</td>
<td class="col-3">
<%= r.author.username %>
</td>
<td class="col-1">
<%= @comments.size %>
</td>
<td class="col-3">
<%= time_ago_in_words(r.created_at) %> ago
</td>
</tr>
<% end %>
</table>
<%= will_paginate @news %>
</div>
</div>
#output goes
Sl no. Title Author Comments Posted
1 Welcome admin 2 about {{count}} hours ago
# {{count}} is my problem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment