diff options
| author | Teddy Wing | 2017-07-07 17:08:00 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-07-12 11:06:03 +0200 |
| commit | 288c5980dc7cd9f143b88d5a8492c006c5f46bb7 (patch) | |
| tree | 22f55ec88c4d420c451f754afb25fb9151311c48 /app | |
| parent | 4797bfbfec8f97ef09f62d6b170b8f749be4a0bf (diff) | |
| download | chouette-core-288c5980dc7cd9f143b88d5a8492c006c5f46bb7.tar.bz2 | |
ReferentialCompanies#index: Use new table builder helper
TODO: Rename `line_referential` context parameter in `CompanyDecorator`
to `referential` since the name needs to make sense both for
`Referential` and for `LineReferential`.
Refs #3479
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/referential_companies_controller.rb | 8 | ||||
| -rw-r--r-- | app/views/referential_companies/index.html.slim | 32 |
2 files changed, 34 insertions, 6 deletions
diff --git a/app/controllers/referential_companies_controller.rb b/app/controllers/referential_companies_controller.rb index e8b104d14..09167009a 100644 --- a/app/controllers/referential_companies_controller.rb +++ b/app/controllers/referential_companies_controller.rb @@ -13,6 +13,14 @@ class ReferentialCompaniesController < ChouetteController if collection.out_of_bounds? redirect_to params.merge(:page => 1) end + + @companies = ModelDecorator.decorate( + @companies, + with: CompanyDecorator, + context: { + line_referential: referential + } + ) } build_breadcrumb :index end diff --git a/app/views/referential_companies/index.html.slim b/app/views/referential_companies/index.html.slim index 85d1d416d..23eea40ce 100644 --- a/app/views/referential_companies/index.html.slim +++ b/app/views/referential_companies/index.html.slim @@ -22,12 +22,32 @@ - if @companies.any? .row .col-lg-12 - = table_builder @companies, - { 'ID Codifligne' => Proc.new { |n| n.try(:objectid).try(:local_id) }, - :name => 'name', :phone => 'phone', :email => 'email', :url => 'url' }, - [:show, :edit, :delete], - [], - 'table has-search' + = table_builder_2 @companies, + [ \ + TableBuilderHelper::Column.new( \ + name: 'ID Codifligne', \ + attribute: Proc.new { |n| n.try(:objectid).try(:local_id) }, \ + sortable: false \ + ), \ + TableBuilderHelper::Column.new( \ + key: :name, \ + attribute: 'name' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :phone, \ + attribute: 'phone' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :email, \ + attribute: 'email' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :url, \ + attribute: 'url' \ + ) \ + ], + links: [:show, :edit], + cls: 'table has-search' = new_pagination @companies, 'pull-right' |
