学校列表分页

This commit is contained in:
lizanle 2015-10-16 14:48:59 +08:00
parent 7a17186ca3
commit 707244886c
3 changed files with 12 additions and 4 deletions

View File

@ -346,11 +346,16 @@ class AdminController < ApplicationController
#学校列表
def schools
@school_name = params[:school_name]
if @school_name
if @school_name && @school_name != ''
@schools = School.where("name like '%#{@school_name}%'")
else
@schools = School.all
elsif @school_name.nil?
@schools = []
else @school_name && @school_name == ' '
@schools = School.where('1=1')
end
@school_count = @schools.count
@school_pages = Paginator.new @school_count, per_page_option, params['page'] || 1
@schools = paginateHelper @schools,100
respond_to do |format|
format.html
end

View File

@ -46,5 +46,8 @@
</tbody>
</table>
</div>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
<%= pagination_links_full @school_pages, @school_count ,:per_page_links => true, :remote => false, :flag => true %>
</ul>
<% html_title(l(:label_project_plural)) -%>

View File

@ -12,7 +12,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','project', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= heads_for_theme %>