修改js bug。

This commit is contained in:
william 2013-08-19 20:54:58 +08:00
parent 0d6045406a
commit 7caa5673e7
1 changed files with 94 additions and 6 deletions

View File

@ -93,10 +93,54 @@ class TagsController < ApplicationController
@show_flag = params[:show_flag] @show_flag = params[:show_flag]
$selected_tags << @tag $selected_tags << @tag
$related_tags.delete(@tag) $related_tags.delete(@tag)
@obj_pages = nil
@numbers = Setting.tags_show_search_results
# @issues_results = get_issues_by_tag($selected_tags)
# @projects_results = get_projects_by_tag($selected_tags)
# @users_results = get_users_by_tag($selected_tags)
case @show_flag
when '1' then
@users_results = get_users_by_tag($selected_tags)
@obj = User.find_by_id(@obj_id)
@issues_results = get_issues_by_tag($selected_tags) @offset, @limit = api_offset_and_limit({:limit => @numbers})
@projects_results = get_projects_by_tag($selected_tags) @project_count = @users_results.count
@users_results = get_users_by_tag($selected_tags) @obj_pages = Paginator.new @project_count, @limit, params['page']
@offset ||= @obj_pages.offset
@users_results = @users_results.offset(@offset).limit(@limit).all
when '2' then
@projects_results = get_projects_by_tag($selected_tags)
@obj = Project.find_by_id(@obj_id)
@offset, @limit = api_offset_and_limit({:limit => @numbers})
@project_count = @projects_results.count
@obj_pages = Paginator.new @project_count, @limit, params['page']
@offset ||= @obj_pages.offset
@projects_results = @projects_results.offset(@offset).limit(@limit).order('lft').all
when '3' then
@issues_results = get_issues_by_tag($selected_tags)
@obj = Issue.find_by_id(@obj_id)
@offset, @limit = api_offset_and_limit({:limit => @numbers})
@project_count = @issues_results.count
@obj_pages = Paginator.new @project_count, @limit, params['page']
@offset ||= @obj_pages.offset
@issues_results = @issues_results.offset(@offset).limit(@limit).all
when '4'
@bids_results = get_bids_by_tag($selected_tags)
@obj = Bid.find_by_id(@obj_id)
@offset, @limit = api_offset_and_limit({:limit => @numbers})
@project_count = @bids_results.count
@obj_pages = Paginator.new @project_count, @limit, params['page']
@offset ||= @obj_pages.offset
@bids_results = @bids_results.offset(@offset).limit(@limit).all
else
@obj = nil
end
end end
def delete_tag def delete_tag
@ -105,9 +149,53 @@ class TagsController < ApplicationController
$related_tags << @tag $related_tags << @tag
$selected_tags.delete(@tag) $selected_tags.delete(@tag)
@issues_results = get_issues_by_tag($selected_tags) @obj_pages = nil
@projects_results = get_projects_by_tag($selected_tags) @numbers = Setting.tags_show_search_results
@users_results = get_users_by_tag($selected_tags) # @issues_results = get_issues_by_tag($selected_tags)
# @projects_results = get_projects_by_tag($selected_tags)
# @users_results = get_users_by_tag($selected_tags)
case @show_flag
when '1' then
@users_results = get_users_by_tag($selected_tags)
@obj = User.find_by_id(@obj_id)
@offset, @limit = api_offset_and_limit({:limit => @numbers})
@project_count = @users_results.count
@obj_pages = Paginator.new @project_count, @limit, params['page']
@offset ||= @obj_pages.offset
@users_results = @users_results.offset(@offset).limit(@limit).all
when '2' then
@projects_results = get_projects_by_tag($selected_tags)
@obj = Project.find_by_id(@obj_id)
@offset, @limit = api_offset_and_limit({:limit => @numbers})
@project_count = @projects_results.count
@obj_pages = Paginator.new @project_count, @limit, params['page']
@offset ||= @obj_pages.offset
@projects_results = @projects_results.offset(@offset).limit(@limit).order('lft').all
when '3' then
@issues_results = get_issues_by_tag($selected_tags)
@obj = Issue.find_by_id(@obj_id)
@offset, @limit = api_offset_and_limit({:limit => @numbers})
@project_count = @issues_results.count
@obj_pages = Paginator.new @project_count, @limit, params['page']
@offset ||= @obj_pages.offset
@issues_results = @issues_results.offset(@offset).limit(@limit).all
when '4'
@bids_results = get_bids_by_tag($selected_tags)
@obj = Bid.find_by_id(@obj_id)
@offset, @limit = api_offset_and_limit({:limit => @numbers})
@project_count = @bids_results.count
@obj_pages = Paginator.new @project_count, @limit, params['page']
@offset ||= @obj_pages.offset
@bids_results = @bids_results.offset(@offset).limit(@limit).all
else
@obj = nil
end
end end
def count(name) def count(name)