diff options
| author | Xinhui | 2017-03-16 15:34:07 +0100 | 
|---|---|---|
| committer | Xinhui | 2017-03-16 15:34:19 +0100 | 
| commit | 78ba8bca32a79edb3928fb5c30f2cf2247aede69 (patch) | |
| tree | 7190f5dd26e98ba4f45b37a7147e0d0780bee5e6 /app/controllers/referentials_controller.rb | |
| parent | 9456ec4f95e6e148b9b8471c0f00530e99154e06 (diff) | |
| download | chouette-core-78ba8bca32a79edb3928fb5c30f2cf2247aede69.tar.bz2 | |
Wip sort issue on table list
Refs #2858
Diffstat (limited to 'app/controllers/referentials_controller.rb')
| -rw-r--r-- | app/controllers/referentials_controller.rb | 6 | 
1 files changed, 4 insertions, 2 deletions
| diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index 5ff296659..9a9e9b151 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -81,7 +81,7 @@ class ReferentialsController < BreadcrumbController    end    def lines_collection -    @q = resource.lines.search(params[:q]) +    @q = resource.lines.includes(:company, :network).search(params[:q])      if sort_column && sort_direction        @reflines ||= @@ -115,8 +115,10 @@ class ReferentialsController < BreadcrumbController    private    def sort_column -    resource.lines.include?(params[:sort]) ? params[:sort] : 'name' +    sortable_columns = Chouette::Line.column_names + ['networks.name', 'companies.name'] +    params[:sort] if sortable_columns.include?(params[:sort])    end +    def sort_direction      %w[asc desc].include?(params[:direction]) ?  params[:direction] : 'asc'    end | 
