Permalink
Browse files

Fix index to display more properly.

  • Loading branch information...
1 parent 308144b commit b51fb85fb47a476468546a7ceb54ff9385280b1e @Flameeyes Flameeyes committed Jun 16, 2012
Showing with 16 additions and 6 deletions.
  1. +11 −1 display.rb
  2. +5 −5 views/index.erb
View
@@ -28,5 +28,15 @@
sdb.domains.create(domain_name) unless domain.exists?
get '/' do
- erb :index, :locals => { :items => domain.items.order(:date) }
+ items = domain.items.order(:date, :desc).limit(100).select(:all).map do |data|
+ { :name => data.name,
+ :host => data.attributes["host"][0],
+ :public_url => data.attributes["public_url"][0],
+ :date => data.attributes["date"][0],
+ :pkg => data.attributes["pkg"][0],
+ :matches => data.attributes["matches"][0]
+ }
+ end
+
+ erb :index, :locals => { :items => items }
end
View
@@ -13,11 +13,11 @@
<% items.each do |item| %>
<tr>
- <td><%= item.attributes[:host].values[0] %></td>
- <td><a href="<%= item.attributes[:public_url].values[0] %>"><%= item.pkg %></a></td>
- <td><%= item.attributes[:date].values[0] %></td>
- <td><%= item.attributes[:pkg].values[0] %></td>
- <td><%= item.attributes[:matches].values[0] %></td>
+ <td><%= item[:host] %></td>
+ <td><a href="<%= item[:public_url] %>"><%= item[:pkg] %></a></td>
+ <td><%= item[:date] %></td>
+ <td><%= item[:pkg] %></td>
+ <td><%= item[:matches] %></td>
</tr>
<% end %>
</table>

0 comments on commit b51fb85

Please sign in to comment.