Ok here goes
Search results view
<style>
xdiv { border: solid 1px; }
body {
font: 1.4em 'Lucida Grande', LucidaGrande, Lucida, Helvetica, Arial, sans-serif;
xbackground: #cccccc url(images/tile1.jpg) repeat;
}
#fax { margin: 100 auto 0 auto; width:780px;}
#logo { margin: 0 auto; width: 770px; height:100px;
xbackground: transparent url(images/logo.png) no-repeat;
}
#fax span { margin-left: -3000px; }
#search { text-align: center; }
#searchbox { margin: 1em auto; width: 750px; height: 40px;
xbackground: #8c8c8c; }
a { border: solid 0px; }
/*
Coffee with milk
Table design by Roger Johansson, 456 Berea Street
www.456bereastreet.com
================================================*/
table {
width: 760px;
border: solid 0px;
font:normal 0.44em "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
border-collapse:separate;
xbackground: #b9927c;
border-spacing:0;
margin:0 0 1em;
color:#000;
}
table a {
color:#523A0B;
text-decoration:none;
border-bottom:1px dotted;
}
table a:visited {
color:#444;
font-weight:normal;
}
table a:visited:after {
content:"\00A0\221A";
}
table a:hover {
border-bottom-style:solid;
}
thead td, tbody td {
padding-top: 10px;
padding-bottom: 10px;
padding-left: 12px;
}
thead td, thead th {
font-size: 1.6em;
text-transform: capitalize;
}
thead th,
thead td,
tfoot th,
tfoot td {
border:1px solid #523A0B;
border-width:1px 0;
xbackground:#e9b5ae;
}
th {
font-weight:bold;
line-height:normal;
padding:0.25em 0.5em;
text-align:left;
}
tbody th,
td {
width:200px;
padding:0.25em 0.5em;
text-align:left;
vertical-align:top;
}
tbody th {
font-weight:normal;
white-space:nowrap;
}
tbody th a:link,
tbody th a:visited {
font-weight:bold;
}
tbody td,
tbody th {
border:1px solid #fff;
border-width:1px 0;
}
tbody tr.odd th,
tbody tr.odd td {
border-color:#EBE5D9;
xbackground:#F7F4EE;
}
tbody tr:hover td,
tbody tr:hover th {
xbackground:#ffffee;
border-color:#523A0B;
}
caption {
font-family:Georgia,Times,serif;
font-weight:normal;
font-size:1.4em;
text-align:left;
margin:0;
padding:0.5em 0.25em;
}
#searchresults {margin: 0 auto; width: 760px;}
</style>
<%= pagination_links @infostwo_pages, :params=> { :query => params[:query] } %>
<%# pagination_links(paginator, options={}, html_options={}) %>
<%# { :name => :page, :window_size => 2, :always_show_anchors => true, :link_to_current_page => false, :params => {} %>
<% for info in @infostwo %>
<% medialogs = info.medialogs.find(:all, :conditions => ['shotdescription LIKE ?', '%' + params[:query].to_s + '%']) %>
<% for cat in medialogs %>
<table>
<tbody>
<thead>
<tr>
<td colspan="6" scope="col">Shot Description</td>
</tr>
</thead>
<tr>
<td colspan="6"><%= cat.shotdescription %></td>
</tr>
<thead> <tr>
<td width="14">Barcode</td>
<td width="22">Start</td>
<td width="19">End</td>
<td width="25">Duration</td>
<td width="23">Shot Type</td>
<td width="57">Searched by</td>
</tr></thead>
<tr>
<td><%= cat.id %></td>
<td><%= cat.info_id %></td>
<td><%= cat.shottype %></td>
<td><%= cat.start %></td>
<td><%= cat.end %></td>
<td><%= cat.duration %></td>
<td><%= cat.searchedby %></td>
<td widtd="29" scope="col"><%= info.Licensable %></td>
</tr>
</tbody>
</table>
<% end %>
<% if medialogs.empty? && info.Synopsis_Content.include?(params[:query]) %>
<table border="1">
<thead>
<tr>
<td widtd="155" scope="col"><%= info.Subject_Title %></td>
<td widtd="29" scope="col"><%= info.id %></td>
<td widtd="29" scope="col"><%= info.Licensable %></td>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2"><%= info.Synopsis_Content %></td>
</tr>
</tbody>
</table>
<% end %>
<% end %>
Search form
<h1>SEARCH</h1>
<div id="searchbar">
<%= start_form_tag :action => 'infomoxlist' %>
<%= text_field_tag ("query", @params['query'], :size => 40 ) %>
<br />
<%= check_box_tag 'filters[shotdescription]', checked = true, options = {} %> Bar Code
<%= check_box_tag 'filters[Synopsis_Content]', checked = true, options = {} %> id
<%= check_box_tag 'filters[Address_Track]', checked = true, options = {} %> Shot description
<%= submit_tag 'Search' %>
<%= end_form_tag %>
Controller
@infostwo_pages, @infostwo = paginate(:info, :include => :medialogs, :conditions => ["Licensable = 'Yes'"] + ["Synopsis_Content LIKE ? or Address_Track LIKE ?"] + ["%#{params[:query]}%"] * 2, :per_page => 10)#@per_page = 30
# @infostwo = Info.find(:all, :include => :medialogs, :conditions => ["Licensable = 'Yes'"] + ["Synopsis_Content LIKE ? or Address_Track LIKE ?"] + ["%#{params[:query]}%"] * 2)
# @infostwo_pages, @infostwo = paginate_collection @infostwo, :per_page => @per_page
# #@infos_pages, @infostwo = paginate :info,:include => :medialogs, :per_page => 4
#
Test helper also tried from else where
def paginate_collection(coll, options = {})
# Grab params and fix em up
per = options[:per_page].to_i
page = (params[:page] || 1).to_i
offset = (page - 1) * per # Create a Paginator based on the collection data
pages = Paginator.new self, coll.size, per, page
# Grab the sub-set of the collection
paged = coll[offset..(offset + per - 1)]
return [pages, paged]
end
Forgive me if things are off I have made lots of tests since this last simi working code.
I am now prepping to test out
http://cardboardrocket.com/2006/09/06/p
en-sexier/