From 8172516affc2ebf87792c089fe9d175c3e993839 Mon Sep 17 00:00:00 2001 From: yanxd Date: Fri, 17 Jan 2014 15:37:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=8D=E8=83=BD=E6=90=9C0?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/stores_controller.rb | 2 +- app/views/stores/_search_bar.html.erb | 2 +- app/views/stores/index.html.erb | 17 ++++++++ app/views/stores/search.html.erb | 61 +++++++++++++++++---------- config/locales/en.yml | 1 + config/locales/zh.yml | 3 +- 6 files changed, 61 insertions(+), 25 deletions(-) diff --git a/app/controllers/stores_controller.rb b/app/controllers/stores_controller.rb index 84a9c95d6..ad622096d 100644 --- a/app/controllers/stores_controller.rb +++ b/app/controllers/stores_controller.rb @@ -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") diff --git a/app/views/stores/_search_bar.html.erb b/app/views/stores/_search_bar.html.erb index 3221bd5b2..32caa11a8 100644 --- a/app/views/stores/_search_bar.html.erb +++ b/app/views/stores/_search_bar.html.erb @@ -1,6 +1,6 @@
<%= 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 %>
\ No newline at end of file diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb index a253ea330..4df1b8239 100644 --- a/app/views/stores/index.html.erb +++ b/app/views/stores/index.html.erb @@ -32,6 +32,23 @@ <% reset_cycle; end %>