解决不能搜0的功能
This commit is contained in:
parent
f781742961
commit
8172516aff
|
@ -6,7 +6,7 @@ class StoresController < ApplicationController
|
|||
|
||||
def search
|
||||
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?
|
||||
# 按文件名搜索
|
||||
resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{name}%").
|
||||
reorder("created_on DESC")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div style="margin: 10px 5%;">
|
||||
<%= form_tag( search_stores_path, method: 'post') do %>
|
||||
<%= text_field_tag 'name', params[:name], size:"100", placeholder:'请输入要搜索的关键字', :class => 'blueinputbar', :required => true %>
|
||||
<%= text_field_tag 'name', params[:name], size:"100", placeholder:'请输入要搜索的关键字', name: "name", :class => 'blueinputbar'%>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise"%>
|
||||
<% end %>
|
||||
</div>
|
|
@ -32,6 +32,23 @@
|
|||
<% reset_cycle; end %>
|
||||
</div>
|
||||
<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($) {
|
||||
$('.download_icon').find("a").attr("target", "_blank");
|
||||
$('.download_icon').each(function(){
|
||||
|
|
|
@ -60,6 +60,23 @@
|
|||
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]%>');
|
||||
|
||||
|
|
|
@ -1585,5 +1585,6 @@ en:
|
|||
label_tags_forum: Call forum
|
||||
label_memo_locked: 'Topic is locked'
|
||||
label_downloads_list: enter file list.
|
||||
label_sumbit_empty: search bar need container.
|
||||
|
||||
|
||||
|
|
|
@ -1790,3 +1790,4 @@ zh:
|
|||
label_contest_user: 参赛人:
|
||||
label_contest_reason: 参赛宣言:
|
||||
label_notification: 通知
|
||||
label_sumbit_empty: 搜索内容不能为空
|
Loading…
Reference in New Issue