Changed default order of articles on balancing page.
This commit is contained in:
parent
e8fa912e8c
commit
4c57c57827
1 changed files with 3 additions and 3 deletions
|
@ -17,14 +17,14 @@ class Finance::BalancingController < ApplicationController
|
||||||
@comments = @order.comments
|
@comments = @order.comments
|
||||||
|
|
||||||
if params['sort']
|
if params['sort']
|
||||||
sort = case params['sort']
|
sort = case params['sort']
|
||||||
when "name" then "articles.name"
|
when "name" then "articles.name"
|
||||||
when "order_number" then "articles.order_number"
|
when "order_number" then "articles.order_number"
|
||||||
when "name_reverse" then "articles.name DESC"
|
when "name_reverse" then "articles.name DESC"
|
||||||
when "order_number_reverse" then "articles.order_number DESC"
|
when "order_number_reverse" then "articles.order_number DESC"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
sort = "articles.name"
|
sort = "id"
|
||||||
end
|
end
|
||||||
|
|
||||||
@articles = @order.order_articles.ordered.find(
|
@articles = @order.order_articles.ordered.find(
|
||||||
|
@ -32,7 +32,7 @@ class Finance::BalancingController < ApplicationController
|
||||||
:include => :article,
|
:include => :article,
|
||||||
:order => sort
|
:order => sort
|
||||||
)
|
)
|
||||||
|
|
||||||
if params[:sort] == "order_number"
|
if params[:sort] == "order_number"
|
||||||
@articles = @articles.sort { |a,b| a.article.order_number.gsub(/[^[:digit:]]/, "").to_i <=> b.article.order_number.gsub(/[^[:digit:]]/, "").to_i }
|
@articles = @articles.sort { |a,b| a.article.order_number.gsub(/[^[:digit:]]/, "").to_i <=> b.article.order_number.gsub(/[^[:digit:]]/, "").to_i }
|
||||||
elsif params[:sort] == "order_number_reverse"
|
elsif params[:sort] == "order_number_reverse"
|
||||||
|
|
Loading…
Reference in a new issue