aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-07-07 16:52:47 +0200
committerTeddy Wing2017-07-12 11:06:03 +0200
commit4797bfbfec8f97ef09f62d6b170b8f749be4a0bf (patch)
treeb138d64a68faba3b9fe50648cd3b38309c7cffb6
parent9ab672a31cd3a1aeea59e6ae3dab96e4057ee997 (diff)
downloadchouette-core-4797bfbfec8f97ef09f62d6b170b8f749be4a0bf.tar.bz2
Companies#index: Use new table builder helper
Refs #3479
-rw-r--r--app/controllers/companies_controller.rb8
-rw-r--r--app/views/companies/index.html.slim19
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'