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

93 lines
3.0 KiB
Plaintext
Raw Normal View History

2014-01-16 15:46:09 +08:00
<style type="text/css">
2014-01-16 10:19:19 +08:00
</style>
2014-01-14 16:18:48 +08:00
<% content_for :top_field do%>
2014-01-17 15:05:50 +08:00
<%= render 'search_bar' %>
2014-01-14 16:18:48 +08:00
<% end %>
<% @searched_attach.each do |result| %>
2014-01-15 20:38:58 +08:00
<table border=0 cellSpacing=0 cellPadding=0>
<tbody>
<tr>
<td class="r1">
<div class="cb">
2014-01-16 15:46:09 +08:00
<span style=""><%= result.filename %></span>
<span style="margin-left: 4px;">
2014-01-17 11:13:24 +08:00
<%= link_to_attachment result, {:download => true, :text => image_tag("/images/button/dl.png", width: "70px", alt: l(:button_download), :class => 'download_icon')}%>
2014-01-16 15:46:09 +08:00
</span>
2014-01-15 20:38:58 +08:00
</div>
2014-01-15 20:05:13 +08:00
<%= result.description %>
2014-01-16 15:52:48 +08:00
<div class="c9 gray-color"> 所属分类:<%=result_come_from result%> </div>
<span class="gray blue-color">
2014-01-16 15:46:09 +08:00
下载:<%= 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>|
2014-01-16 15:46:09 +08:00
上传时间:<%= format_time(result.created_on) %>
</span>
2014-01-15 20:38:58 +08:00
<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>
2014-01-16 10:19:19 +08:00
<script type='text/javascript'>
jQuery.fn.highlight = function(pat) {
2014-01-17 15:37:57 +08:00
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;
}
2014-01-16 10:19:19 +08:00
}
2014-01-17 15:37:57 +08:00
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);
}
2014-01-16 10:19:19 +08:00
}
2014-01-17 15:37:57 +08:00
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}
2014-01-16 10:19:19 +08:00
}
}
$(document).ready(function($) {
2014-01-16 11:04:11 +08:00
$('.cb span').highlight('<%=params[:name]%>');
$('.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")
});
});
2014-01-16 10:19:19 +08:00
});
2014-01-16 15:52:48 +08:00
</script>