修复管理员界面,项目列表的搜索功能
This commit is contained in:
parent
43a3ad1ce8
commit
4504308403
|
@ -31,6 +31,7 @@ class AdminController < ApplicationController
|
||||||
@no_configuration_data = Redmine::DefaultData::Loader::no_data?
|
@no_configuration_data = Redmine::DefaultData::Loader::no_data?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 管理员界面 项目列表
|
||||||
def projects
|
def projects
|
||||||
=begin
|
=begin
|
||||||
@status = params[:status] || 1
|
@status = params[:status] || 1
|
||||||
|
@ -39,7 +40,11 @@ class AdminController < ApplicationController
|
||||||
scope = scope.like(params[:name]) if params[:name].present?
|
scope = scope.like(params[:name]) if params[:name].present?
|
||||||
@projects = scope.where(project_type: Project::ProjectType_project).reorder("created_on desc").all
|
@projects = scope.where(project_type: Project::ProjectType_project).reorder("created_on desc").all
|
||||||
=end
|
=end
|
||||||
@projects = Project.like(@name).order('created_on desc')
|
# 搜索功能
|
||||||
|
@name = params[:name] || ""
|
||||||
|
condition = "#{@name.strip}".gsub(" ","")
|
||||||
|
@projects = Project.like(condition).order('created_on desc')
|
||||||
|
# 分页
|
||||||
@projects = paginateHelper @projects,30
|
@projects = paginateHelper @projects,30
|
||||||
@page = (params['page'] || 1).to_i - 1
|
@page = (params['page'] || 1).to_i - 1
|
||||||
render :action => "projects", :layout => false if request.xhr?
|
render :action => "projects", :layout => false if request.xhr?
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<label for='name'>
|
<label for='name'>
|
||||||
<%= l(:label_project) %>:
|
<%= l(:label_project) %>:
|
||||||
</label>
|
</label>
|
||||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '输入项目名称进行搜索' %>
|
||||||
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||||
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
|
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
Loading…
Reference in New Issue