From 4797bfbfec8f97ef09f62d6b170b8f749be4a0bf Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 7 Jul 2017 16:52:47 +0200 Subject: Companies#index: Use new table builder helper Refs #3479 --- app/controllers/companies_controller.rb | 8 ++++++++ app/views/companies/index.html.slim | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index 9d33c6cb8..1596975b8 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -15,6 +15,14 @@ class CompaniesController < BreadcrumbController if collection.out_of_bounds? redirect_to params.merge(:page => 1) end + + @companies = ModelDecorator.decorate( + @companies, + with: CompanyDecorator, + context: { + line_referential: line_referential + } + ) } build_breadcrumb :index end diff --git a/app/views/companies/index.html.slim b/app/views/companies/index.html.slim index 8605a213b..ceea385b3 100644 --- a/app/views/companies/index.html.slim +++ b/app/views/companies/index.html.slim @@ -22,11 +22,20 @@ - if @companies.any? .row .col-lg-12 - = table_builder @companies, - { 'Oid' => Proc.new { |n| n.try(:objectid).try(:local_id) }, :name => 'name' }, - [:show, :edit, :delete], - [], - 'table has-search' + = table_builder_2 @companies, + [ \ + TableBuilderHelper::Column.new( \ + name: 'Oid', \ + attribute: Proc.new { |n| n.try(:objectid).try(:local_id) }, \ + sortable: false \ + ), \ + TableBuilderHelper::Column.new( \ + key: :name, \ + attribute: 'name' \ + ) \ + ], + links: [:show, :edit], + cls: 'table has-search' = new_pagination @companies, 'pull-right' -- cgit v1.2.3