项目issue翻页后查询条件丢失修改

This commit is contained in:
lizanle 2015-05-07 10:03:10 +08:00
parent c9d66c7f5f
commit 2b1b1c34a6
1 changed files with 15 additions and 15 deletions

View File

@ -243,15 +243,15 @@ module QueriesHelper
# Retrieve query from session or build a new query
def retrieve_query
if !params[:query_id].blank?
cond = "project_id IS NULL"
cond << " OR project_id = #{@project.id}" if @project
@query = IssueQuery.find(params[:query_id], :conditions => cond)
raise ::Unauthorized unless @query.visible?
@query.project = @project
session[:query] = {:id => @query.id, :project_id => @query.project_id}
sort_clear
elsif api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)
# if !params[:query_id].blank?
# cond = "project_id IS NULL"
# cond << " OR project_id = #{@project.id}" if @project
# @query = IssueQuery.find(params[:query_id], :conditions => cond)
# raise ::Unauthorized unless @query.visible?
# @query.project = @project
# session[:query] = {:id => @query.id, :project_id => @query.project_id}
# sort_clear
# elsif api_request? || params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)
# Give it a name, required to be valid
@query = IssueQuery.new(:name => "_")
@query.project = @project
@ -268,12 +268,12 @@ module QueriesHelper
'assigned_to_id' => [params[:assigned_to_id]]} unless params[:status_id].nil?
@query.build_from_params(params)
#session[:query] = {:project_id => @query.project_id, :filters => @query.filters, :group_by => @query.group_by, :column_names => @query.column_names}
else
# retrieve from session
@query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id]
@query ||= IssueQuery.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names])
@query.project = @project
end
# else
# # retrieve from session
# @query = IssueQuery.find_by_id(session[:query][:id]) if session[:query][:id]
# @query ||= IssueQuery.new(:name => "_", :filters => session[:query][:filters], :group_by => session[:query][:group_by], :column_names => session[:query][:column_names])
# @query.project = @project
# end
end
def retrieve_query_from_session