解决搜索不能用的问题

This commit is contained in:
huang 2016-05-20 10:48:17 +08:00
parent 92f55e0dc1
commit 80f829c018
2 changed files with 2 additions and 3 deletions

View File

@ -164,7 +164,7 @@ class OrganizationsController < ApplicationController
return
end
q = params[:search].nil? ? "" : "#{params[:search].strip}"
@field = OrgSubfield.find(params[:org_subfield_id])
@field = params[:org_subfield_id].nil? ? OrgSubfield.where("organization_id =? and field_type =?", params[:id].to_i, "Comptec").first : OrgSubfield.find(params[:org_subfield_id])
@type = params[:type]
if @type == "courses" || @type.nil?
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count

View File

@ -9,8 +9,7 @@
</div>
<div class="resources mt10">
<div class="function-row" id="org_teacher_search">
<%= form_tag( url_for(:controller => 'organizations', :action => 'teachers', :type => @type),
:remote => true , :method => 'get', :id => 'resource_search_form') do %>
<%= form_tag(url_for(:controller => 'organizations', :action => 'teachers', :type => @type), :remote => true , :method => 'get', :id => 'resource_search_form') do %>
<input type="text" name="search" placeholder="输入教师名进行搜索" class="teacher-list-search fl" />
<%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :class => "teacher-search-icon fl" %>
<!--<a href="javascript:void(0);" onclick='this.parent.submit();return false;' class="searchIcon"></a>-->