Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop
This commit is contained in:
commit
c941c640dd
|
@ -6,19 +6,24 @@ class StoresController < ApplicationController
|
||||||
|
|
||||||
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(:label_sumbit_empty);return) if name.blank?
|
||||||
# 按文件名搜索
|
# 按文件名搜索
|
||||||
result = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{name}%").
|
resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{name}%").
|
||||||
reorder("created_on DESC")
|
reorder("created_on DESC")
|
||||||
# result = result.to_a
|
|
||||||
result.map { |res|
|
result = resultSet.to_a.dup
|
||||||
|
|
||||||
|
resultSet.to_a.map { |res|
|
||||||
if(res.container.nil? ||
|
if(res.container.nil? ||
|
||||||
(res.container.class.to_s=="Project" && res.container.is_public == false) ||
|
(res.container.class.to_s=="Project" && res.container.is_public == false) ||
|
||||||
(res.container.has_attribute?(:project) && res.container.project.is_public == false) ||
|
(res.container.has_attribute?(:project) && res.container.project.is_public == false) ||
|
||||||
(res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
|
(res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
# logger.debug("=====================================#{result.include? res}")
|
||||||
|
# logger.debug("=====================================#{res}")
|
||||||
result.delete(res)
|
result.delete(res)
|
||||||
|
# logger.debug("=====================================#{result.include? res}")
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
@searched_attach = paginateHelper result
|
@searched_attach = paginateHelper result
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
||||||
<%= join_in_course(@project, User.current) %></div>
|
<%= join_in_course(@project, User.current) %></div>
|
||||||
<% end %> </div>1111
|
<% end %> </div>
|
||||||
<% unless User.current.member_of?(@project) %>
|
<% unless User.current.member_of?(@project) %>
|
||||||
<!-- <%= image_tag "/images/fav.png" %> -->
|
<!-- <%= image_tag "/images/fav.png" %> -->
|
||||||
<div style="padding-right: 10px">
|
<div style="padding-right: 10px">
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<div class="top-content">
|
<div class="top-content">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="info_font" style="width: 240px; color: #15bccf"><%=t(:label_course_file)%></td>
|
<td class="info_font" style="width: 240px; color: #15bccf"><%=t(:label_stores_index)%></td>
|
||||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||||
<td rowspan="2" width="250px">
|
<td rowspan="2" width="250px">
|
||||||
<div class="top-content-search" style="display:none;">
|
<div class="top-content-search" style="display:none;">
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-left: 8px"><%= link_to stores_url , stores_url %></td>
|
<td style="padding-left: 8px"><%= link_to stores_url , stores_url %></td>
|
||||||
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to l(:label_course_file),stores_url %> </p></td>
|
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to l(:label_stores_index),stores_url %> </p></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<div style="margin: 10px 5%;">
|
||||||
|
<%= form_tag( search_stores_path, method: 'post') do %>
|
||||||
|
<%= text_field_tag 'name', params[:name], size:"100", placeholder:'请输入要搜索的关键字', name: "name", :class => 'blueinputbar'%>
|
||||||
|
<%= submit_tag l(:label_search), :class => "enterprise"%>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
|
@ -1,10 +1,5 @@
|
||||||
<% content_for :top_field do%>
|
<% content_for :top_field do%>
|
||||||
<div style="margin: 10px 5%;vertical-align: bottom;">
|
<%= render 'search_bar' %>
|
||||||
<%= form_tag( search_stores_path, method: 'post') do %>
|
|
||||||
<%= text_field_tag 'name', nil, size:"100", placeholder:'请输入要搜索的关键字', :class => 'blueinputbar', :required => true %>
|
|
||||||
<%= submit_tag l(:label_search), :class => "enterprise"%>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="resource_sum">
|
<div class="resource_sum">
|
||||||
|
@ -27,7 +22,7 @@
|
||||||
<td class="filename" style="width:62%;"><%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %> </td>
|
<td class="filename" style="width:62%;"><%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %> </td>
|
||||||
<td style="width:19%; text-align: center;"><%= c1.downloads %> </td>
|
<td style="width:19%; text-align: center;"><%= c1.downloads %> </td>
|
||||||
<td class="filename download_icon" style="width:19%; text-align: center;">
|
<td class="filename download_icon" style="width:19%; text-align: center;">
|
||||||
<%= link_to_attachment c1, {:text => image_tag("/images/button/download.png", width: "22px", alt: "l(:button_download)") }%>
|
<%= link_to_attachment c1, {:download => true, :text => image_tag("/images/button/download.png", width: "22px", alt: l(:button_download)) }%>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -37,7 +32,25 @@
|
||||||
<% reset_cycle; end %>
|
<% reset_cycle; end %>
|
||||||
</div>
|
</div>
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
|
function validate_required(field,alerttxt)
|
||||||
|
{
|
||||||
|
with (field)
|
||||||
|
{
|
||||||
|
if (value==null||value=="")
|
||||||
|
{alert(alerttxt);$.find('form').attr("data-submitted",'');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($) {
|
$(document).ready(function($) {
|
||||||
|
$('.download_icon').find("a").attr("target", "_blank");
|
||||||
$('.download_icon').each(function(){
|
$('.download_icon').each(function(){
|
||||||
$(this).mouseenter(function(event) {
|
$(this).mouseenter(function(event) {
|
||||||
$(this).find('img').attr("src", "/images/button/download_focus.png")
|
$(this).find('img').attr("src", "/images/button/download_focus.png")
|
||||||
|
|
|
@ -2,12 +2,7 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<% content_for :top_field do%>
|
<% content_for :top_field do%>
|
||||||
<div style="margin: 10px 5%;">
|
<%= render 'search_bar' %>
|
||||||
<%= form_tag( search_stores_path, method: 'post') do %>
|
|
||||||
<%= text_field_tag 'name', nil, size:"100", placeholder:'请输入要搜索的关键字', :value => params[:name] , :class => 'blueinputbar', :required => true %>
|
|
||||||
<%= submit_tag l(:label_search), :class => "enterprise"%>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% @searched_attach.each do |result| %>
|
<% @searched_attach.each do |result| %>
|
||||||
|
@ -19,7 +14,7 @@
|
||||||
<div class="cb">
|
<div class="cb">
|
||||||
<span style=""><%= result.filename %></span>
|
<span style=""><%= result.filename %></span>
|
||||||
<span style="margin-left: 4px;">
|
<span style="margin-left: 4px;">
|
||||||
<%= link_to_attachment result, {:text => image_tag("/images/button/dl.png", width: "70px", alt: l(:button_download), :class => 'download_icon')}%>
|
<%= link_to_attachment result, {:download => true, :text => image_tag("/images/button/dl.png", width: "70px", alt: l(:button_download), :class => 'download_icon')}%>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<%= result.description %>
|
<%= result.description %>
|
||||||
|
@ -27,7 +22,7 @@
|
||||||
<span class="gray blue-color">
|
<span class="gray blue-color">
|
||||||
下载:<%= result.downloads%>|
|
下载:<%= result.downloads%>|
|
||||||
大小:<%= number_to_human_size(result.filesize) %>|
|
大小:<%= number_to_human_size(result.filesize) %>|
|
||||||
共享者:<a class="gray" ><%= link_to result.author, user_path(result.author), target: "_blank"%></a>|
|
共享者:<a class="gray" ><%= link_to result.author, user_path(result.author), target: "_blank" unless result.author.blank? %></a>|
|
||||||
上传时间:<%= format_time(result.created_on) %>
|
上传时间:<%= format_time(result.created_on) %>
|
||||||
</span>
|
</span>
|
||||||
<div style="display: none"></div>
|
<div style="display: none"></div>
|
||||||
|
@ -39,32 +34,49 @@
|
||||||
<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>
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
jQuery.fn.highlight = function(pat) {
|
jQuery.fn.highlight = function(pat) {
|
||||||
function innerHighlight(node, pat) {
|
function innerHighlight(node, pat) {
|
||||||
var skip = 0;
|
var skip = 0;
|
||||||
if (node.nodeType == 3) {
|
if (node.nodeType == 3) {
|
||||||
var pos = node.data.toUpperCase().indexOf(pat);
|
var pos = node.data.toUpperCase().indexOf(pat);
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
var spannode = document.createElement('span');
|
var spannode = document.createElement('span');
|
||||||
spannode.className = 'highlight';
|
spannode.className = 'highlight';
|
||||||
var middlebit = node.splitText(pos);
|
var middlebit = node.splitText(pos);
|
||||||
var endbit = middlebit.splitText(pat.length);
|
var endbit = middlebit.splitText(pat.length);
|
||||||
var middleclone = middlebit.cloneNode(true);
|
var middleclone = middlebit.cloneNode(true);
|
||||||
spannode.appendChild(middleclone);
|
spannode.appendChild(middleclone);
|
||||||
middlebit.parentNode.replaceChild(spannode, middlebit);
|
middlebit.parentNode.replaceChild(spannode, middlebit);
|
||||||
skip = 1;
|
skip = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
|
||||||
else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
|
for (var i = 0; i < node.childNodes.length; ++i) {
|
||||||
for (var i = 0; i < node.childNodes.length; ++i) {
|
i += innerHighlight(node.childNodes[i], pat);
|
||||||
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}
|
||||||
}
|
}
|
||||||
return skip;
|
|
||||||
}
|
}
|
||||||
return this.each(function() {
|
|
||||||
innerHighlight(this, pat.toUpperCase());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
$(document).ready(function($) {
|
$(document).ready(function($) {
|
||||||
$('.cb span').highlight('<%=params[:name]%>');
|
$('.cb span').highlight('<%=params[:name]%>');
|
||||||
|
|
||||||
|
|
|
@ -1585,5 +1585,6 @@ en:
|
||||||
label_tags_forum: Call forum
|
label_tags_forum: Call forum
|
||||||
label_memo_locked: 'Topic is locked'
|
label_memo_locked: 'Topic is locked'
|
||||||
label_downloads_list: enter file list.
|
label_downloads_list: enter file list.
|
||||||
|
label_sumbit_empty: search bar need container.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1647,6 +1647,7 @@ zh:
|
||||||
label_course_student: 学生
|
label_course_student: 学生
|
||||||
label_homework: 课程作业
|
label_homework: 课程作业
|
||||||
label_course_file: 资源库 #资料共享
|
label_course_file: 资源库 #资料共享
|
||||||
|
label_stores_index: 资源索引
|
||||||
label_course_new_homework: 新建作业
|
label_course_new_homework: 新建作业
|
||||||
label_course_homework_list: 作业列表
|
label_course_homework_list: 作业列表
|
||||||
label_course_homework_new: 发布作业
|
label_course_homework_new: 发布作业
|
||||||
|
@ -1789,4 +1790,5 @@ zh:
|
||||||
label_joined_contest: 参与了竞赛
|
label_joined_contest: 参与了竞赛
|
||||||
label_contest_user: 参赛人:
|
label_contest_user: 参赛人:
|
||||||
label_contest_reason: 参赛宣言:
|
label_contest_reason: 参赛宣言:
|
||||||
label_notification: 通知
|
label_notification: 通知
|
||||||
|
label_sumbit_empty: 搜索内容不能为空
|
||||||
|
|
|
@ -204,7 +204,7 @@ Redmine::MenuManager.map :top_menu do |menu|
|
||||||
menu.push :contest_innovate, {:controller => 'bids', :action => 'contest', :project_type => 1}
|
menu.push :contest_innovate, {:controller => 'bids', :action => 'contest', :project_type => 1}
|
||||||
menu.push :requirement_enterprise, {:controller => 'bids', :action => 'index'}
|
menu.push :requirement_enterprise, {:controller => 'bids', :action => 'index'}
|
||||||
menu.push :project_module_forums, :forums_path
|
menu.push :project_module_forums, :forums_path
|
||||||
menu.push :course_file, :stores_path
|
menu.push :stores_index, :stores_path
|
||||||
|
|
||||||
|
|
||||||
# menu.push :investor, :home_path
|
# menu.push :investor, :home_path
|
||||||
|
|
Loading…
Reference in New Issue