socialforge/app/views/stores/search.html.erb

94 lines
3.1 KiB
Plaintext

<style type="text/css">
</style>
<% content_for :top_field do%>
<%= render 'search_bar' %>
<span class="font_lighter" style="margin-left: 10px;">找到约&nbsp;<%= number_with_delimiter(@result_all_count, delimiter:',') %>&nbsp;条结果</span>
<% end %>
<% @searched_attach.each do |result| %>
<table border=0 cellSpacing=0 cellPadding=0>
<tbody>
<tr>
<td class="r1">
<div class="cb">
<span style=""><%= result.filename %></span>
<span style="margin-left: 4px;">
<%= link_to_attachment result, {:download => true, :text => image_tag("/images/button/dl.png", width: "70px", alt: l(:button_download), :class => 'download_icon')}%>
</span>
</div>
<%= result.description %>
<div class="c9 gray-color"> 所属分类:<%=result_come_from result%> </div>
<span class="gray blue-color">
下载:<%= result.downloads%>|
大小:<%= number_to_human_size(result.filesize) %>|
共享者:<a class="gray" ><%= link_to result.author, user_path(result.author), target: "_blank" unless result.author.blank? %></a>|
上传时间:<%= format_time(result.created_on) %>
</span>
<div style="display: none"></div>
</td>
</tr>
</tbody>
</table>
<% end %>
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
<script type='text/javascript'>
jQuery.fn.highlight = function(pat) {
function innerHighlight(node, pat) {
var skip = 0;
if (node.nodeType == 3) {
var pos = node.data.toUpperCase().indexOf(pat);
if (pos >= 0) {
var spannode = document.createElement('span');
spannode.className = 'highlight';
var middlebit = node.splitText(pos);
var endbit = middlebit.splitText(pat.length);
var middleclone = middlebit.cloneNode(true);
spannode.appendChild(middleclone);
middlebit.parentNode.replaceChild(spannode, middlebit);
skip = 1;
}
}
else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
for (var i = 0; i < node.childNodes.length; ++i) {
i += innerHighlight(node.childNodes[i], pat);
}
}
return skip;
}
return this.each(function() {
innerHighlight(this, pat.toUpperCase());
});
};
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{alert(alerttxt);return false}
else {return true}
}
}
function validate_form(thisform) {
with (thisform)
{
if (validate_required(name,"name must be filled out!")==false)
{name.focus();return false}
}
}
$(document).ready(function($) {
$('.cb span').highlight('<%="#{params[:name].strip}"%>');
$('.a_download_icon').each(function(){
$(this).mouseenter(function(event) {
$(this).attr("src", "/images/button/download_focus.png")
});
$(this).mouseleave(function(event) {
$(this).attr("src", "/images/button/download.png")
});
});
});
</script>