modified
This commit is contained in:
parent
33df4327b5
commit
8d788fac45
|
@ -3,16 +3,11 @@
|
||||||
# Copyright (C) 2013-2014
|
# Copyright (C) 2013-2014
|
||||||
class StoresController < ApplicationController
|
class StoresController < ApplicationController
|
||||||
layout 'base_stores'
|
layout 'base_stores'
|
||||||
# menu_item :overview
|
|
||||||
# menu_item :roadmap, :only => :roadmap
|
|
||||||
# menu_item :settings, :only => :settings
|
|
||||||
# include ActsAsTaggableOn::TagsHelper
|
|
||||||
|
|
||||||
def search
|
def search
|
||||||
name = params[:name] ||= ''
|
name = params[:name] ||= ''
|
||||||
redirect_to stores_path, :notice => l(:field_course_un) if name.blank?
|
redirect_to stores_path, :notice => l(:field_course_un) if name.blank?
|
||||||
# 按文件名搜索
|
# 按文件名搜索
|
||||||
#result = Attachment.includes(:project).where("projects.is_public = 1 AND filename LIKE '%" << name << "%' ")
|
|
||||||
result = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE '%" + name + "%' ").
|
result = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE '%" + name + "%' ").
|
||||||
reorder("created_on DESC")
|
reorder("created_on DESC")
|
||||||
result = result.to_a
|
result = result.to_a
|
||||||
|
@ -30,8 +25,6 @@ class StoresController < ApplicationController
|
||||||
|
|
||||||
LIMIT = 12 unless const_defined?(:LIMIT)
|
LIMIT = 12 unless const_defined?(:LIMIT)
|
||||||
def index
|
def index
|
||||||
# @projects_attach = project_classification(0).take(LIMIT)
|
|
||||||
# @courses_attach = project_classification(1).take(LIMIT)
|
|
||||||
@projects_attach = Attachment.includes(:project).where("projects.project_type=? AND projects.is_public = ?", 0, 1).
|
@projects_attach = Attachment.includes(:project).where("projects.project_type=? AND projects.is_public = ?", 0, 1).
|
||||||
reorder("#{Attachment.table_name}.downloads DESC").
|
reorder("#{Attachment.table_name}.downloads DESC").
|
||||||
limit(LIMIT)
|
limit(LIMIT)
|
||||||
|
@ -62,10 +55,10 @@ class StoresController < ApplicationController
|
||||||
limit(LIMIT)
|
limit(LIMIT)
|
||||||
doc_attach = join_tools_project Document, project_type
|
doc_attach = join_tools_project Document, project_type
|
||||||
issue_attach = join_tools_project Issue, project_type
|
issue_attach = join_tools_project Issue, project_type
|
||||||
mess_attach = []#join_tools_project Message, project_type
|
mess_attach = []
|
||||||
news_attach = join_tools_project News"news", project_type
|
news_attach = join_tools_project News"news", project_type
|
||||||
vers_attach = join_tools_project Version"versions", project_type
|
vers_attach = join_tools_project Version"versions", project_type
|
||||||
wiki_attach = []#join_tools_project WikiPage, project_type
|
wiki_attach = []
|
||||||
|
|
||||||
tmp = pro_attach+doc_attach+issue_attach+mess_attach+news_attach+vers_attach+wiki_attach
|
tmp = pro_attach+doc_attach+issue_attach+mess_attach+news_attach+vers_attach+wiki_attach
|
||||||
tmp.sort { |a, b| b.downloads <=> a.downloads }
|
tmp.sort { |a, b| b.downloads <=> a.downloads }
|
||||||
|
|
|
@ -1,22 +1,8 @@
|
||||||
<style type="text/css">
|
|
||||||
#main *{
|
|
||||||
/*border: 1px solid #eeeeee;*/
|
|
||||||
}
|
|
||||||
#content {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
#top_field {
|
|
||||||
max-width: 100%;
|
|
||||||
margin: 20px auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<% content_for :top_field do%>
|
<% content_for :top_field do%>
|
||||||
<div style="margin: 10px 5%;vertical-align: bottom;">
|
<div style="margin: 10px 5%;vertical-align: bottom;">
|
||||||
<%= form_tag( search_stores_path, method: 'get') do %>
|
<%= form_tag( search_stores_path, method: 'get') do %>
|
||||||
<%= text_field_tag 'name', nil, size:"100", placeholder:'请输入要搜索的关键字', :class => 'blueinputbar' %>
|
<%= text_field_tag 'name', nil, size:"100", placeholder:'请输入要搜索的关键字', :class => 'blueinputbar' %>
|
||||||
<%= submit_tag l(:label_search), class:"whiteButton", style: "padding: 0px 10px;"%>
|
<%= submit_tag l(:label_search), :class => "enterprise"%>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,46 +1,34 @@
|
||||||
<!--encoding: utf-8 -->
|
|
||||||
<style type="text/css">
|
|
||||||
#main *{
|
|
||||||
/*border: 1px solid #eeeeee;*/
|
|
||||||
}
|
|
||||||
#content {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
#top_field {
|
|
||||||
max-width: 100%;
|
|
||||||
margin: 20px auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<% content_for :top_field do%>
|
<% content_for :top_field do%>
|
||||||
<div style="margin: 10px 5%;">
|
<div style="margin: 10px 5%;">
|
||||||
<%= form_tag( search_stores_path, method: 'get') do %>
|
<%= form_tag( search_stores_path, method: 'get') do %>
|
||||||
<%= text_field_tag 'name', nil, size:"100", placeholder:'请输入要搜索的关键字', :value => params[:name] , :class => 'blueinputbar'%>
|
<%= text_field_tag 'name', nil, size:"100", placeholder:'请输入要搜索的关键字', :value => params[:name] , :class => 'blueinputbar'%>
|
||||||
<%= submit_tag l(:label_search), class:"whiteButton m3p10 h30"%>
|
<%= submit_tag l(:label_search), :class => "enterprise"%>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% @searched_attach.each do |result| %>
|
<% @searched_attach.each do |result| %>
|
||||||
|
|
||||||
<TABLE border=0 cellSpacing=0 cellPadding=0>
|
<table border=0 cellSpacing=0 cellPadding=0>
|
||||||
<TBODY>
|
<tbody>
|
||||||
<TR>
|
<tr>
|
||||||
<TD class=r1>
|
<td class="r1">
|
||||||
<DIV class=cb>
|
<div class="cb">
|
||||||
<SPAN style="COLOR: #c03; font-size: 14px;"><%= result.filename %></SPAN>
|
<span style="color: #c03; font-size: 14px;"><%= result.filename %></span>
|
||||||
<span style="margin-left: 4px;"><%= link_to_attachment result, {:text => "下载"}%></span>
|
<span style="margin-left: 4px;"><%= link_to_attachment result, {:text => "下载"}%></span>
|
||||||
</DIV>
|
</div>
|
||||||
<%= result.description %>
|
<%= result.description %>
|
||||||
<DIV class=c9>所属分类:<%=result_come_from result%>
|
<div class="c9">所属分类:<%=result_come_from result%>
|
||||||
上传时间:<%= format_time(result.created_on) %>
|
上传时间:<%= format_time(result.created_on) %>
|
||||||
</DIV>
|
</div>
|
||||||
<SPAN class="gray">下载:<%= result.downloads%>
|
<span class="gray">下载:<%= result.downloads%>
|
||||||
| 大小:<%= number_to_human_size(result.filesize) %>
|
| 大小:<%= number_to_human_size(result.filesize) %>
|
||||||
| 共享者:<A class="gray" ><%= link_to result.author%></A></SPAN>
|
| 共享者:<a class="gray" ><%= link_to result.author%></a></span>
|
||||||
<DIV style="DISPLAY: none" id=f23680389></DIV>
|
<div style="display: none"></div>
|
||||||
</TD>
|
</td>
|
||||||
</TR>
|
</tr>
|
||||||
</TBODY>
|
</tbody>
|
||||||
</TABLE>
|
</table>
|
||||||
<% end %>
|
|
||||||
|
<% end %>
|
||||||
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
|
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
|
||||||
|
|
|
@ -417,6 +417,10 @@ table.content-text-list tbody tr td.locked, div.memo-section .locked{
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
max-width: 247px;
|
max-width: 247px;
|
||||||
}
|
}
|
||||||
|
#top_field {
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 20px auto;
|
||||||
|
}
|
||||||
/*.filename a:after {
|
/*.filename a:after {
|
||||||
content: "...";
|
content: "...";
|
||||||
}*/
|
}*/
|
||||||
|
|
Loading…
Reference in New Issue