默认排序方式更改
This commit is contained in:
parent
83acda2781
commit
7490806bf3
|
@ -54,12 +54,12 @@ class BidsController < ApplicationController
|
|||
end
|
||||
else
|
||||
unless @offset == 0
|
||||
@bids = @bids.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
@bids = @bids.offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 0
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
@bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 1
|
||||
end
|
||||
#end
|
||||
# @limit = api_offset_and_limit({:limit => 5})
|
||||
|
|
|
@ -153,17 +153,17 @@ class ProjectsController < ApplicationController
|
|||
@s_type = 2
|
||||
end
|
||||
else
|
||||
@offset ||= @project_pages.reverse_offset
|
||||
unless @offset == 0
|
||||
@projects = @projects.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @project_count % @limit
|
||||
if limit == 0
|
||||
@offset ||= @project_pages.reverse_offset
|
||||
unless @offset == 0
|
||||
@projects = @projects.includes(:project_status).reorder('project_statuses.changesets_count').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @project_count % @limit
|
||||
if limit == 0
|
||||
limit = @limit
|
||||
end
|
||||
@projects = @projects.offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_type = 0
|
||||
@projects = @projects.includes(:project_status).reorder('project_statuses.changesets_count').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_type = 1
|
||||
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
||||
# @projects = @projects[@offset, @limit]
|
||||
|
||||
|
|
|
@ -213,16 +213,16 @@ class UsersController < ApplicationController
|
|||
|
||||
else
|
||||
@offset ||= @user_pages.reverse_offset
|
||||
unless @offset == 0
|
||||
@users = scope.offset(@offset).limit(@limit).all.reverse
|
||||
unless @offset == 0
|
||||
@users = scope.includes(:user_status).reorder('user_statuses.changesets_count').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @user_count % @limit
|
||||
if limit == 0
|
||||
limit = @limit
|
||||
end
|
||||
@users = scope.offset(@offset).limit(limit).all.reverse
|
||||
@users = scope.includes(:user_status).reorder('user_statuses.changesets_count').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_type = 0
|
||||
@s_type = 1
|
||||
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
||||
# @projects = @projects[@offset, @limit]
|
||||
end
|
||||
|
|
|
@ -41,11 +41,12 @@ module BidsHelper
|
|||
content = ''.html_safe
|
||||
case state
|
||||
when 0
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0'), :class=>"selected"), :class=>"selected")
|
||||
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1')))
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0'), :class=>"selected"), :class=>"selected")
|
||||
|
||||
when 1
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0')))
|
||||
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:bid_sort_type => '1'), :class=>"selected"), :class=>"selected")
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:bid_sort_type => '0')))
|
||||
end
|
||||
content = content_tag('ul', content)
|
||||
content_tag('div', content, :class => "tabs")
|
||||
|
|
|
@ -41,17 +41,19 @@ module ProjectsHelper
|
|||
content = ''.html_safe
|
||||
case state
|
||||
when 0
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0'), :class=>"selected"), :class=>"selected")
|
||||
|
||||
content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1')))
|
||||
content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2')))
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0'), :class=>"selected"), :class=>"selected")
|
||||
when 1
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0')))
|
||||
|
||||
content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1'), :class=>"selected"), :class=>"selected")
|
||||
content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2')))
|
||||
when 2
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0')))
|
||||
when 2
|
||||
content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1')))
|
||||
content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2'), :class=>"selected"), :class=>"selected")
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0')))
|
||||
end
|
||||
content = content_tag('ul', content)
|
||||
content_tag('div', content, :class => "tabs")
|
||||
|
|
|
@ -96,17 +96,17 @@ def sort_user(state)
|
|||
content = ''.html_safe
|
||||
case state
|
||||
when 0
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0'), :class=>"selected"), :class=>"selected")
|
||||
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1')))
|
||||
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2')))
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0'), :class=>"selected"), :class=>"selected")
|
||||
when 1
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0')))
|
||||
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1'), :class=>"selected"), :class=>"selected")
|
||||
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2')))
|
||||
when 2
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0')))
|
||||
when 2
|
||||
content << content_tag('li', link_to(l(:label_sort_by_active), users_path(:user_sort_type => '1')))
|
||||
content << content_tag('li', link_to(l(:label_sort_by_influence), users_path(:user_sort_type => '2'), :class=>"selected"), :class=>"selected")
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), users_path(:user_sort_type => '0')))
|
||||
end
|
||||
content = content_tag('ul', content)
|
||||
content_tag('div', content, :class => "tabs")
|
||||
|
|
Loading…
Reference in New Issue