aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/companies_controller.rb23
-rw-r--r--app/controllers/networks_controller.rb23
-rw-r--r--app/controllers/referential_companies_controller.rb23
-rw-r--r--app/controllers/referential_networks_controller.rb23
-rw-r--r--app/controllers/time_tables_controller.rb22
5 files changed, 79 insertions, 35 deletions
diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb
index 07a732fc9..cf27c39cf 100644
--- a/app/controllers/companies_controller.rb
+++ b/app/controllers/companies_controller.rb
@@ -16,14 +16,13 @@ class CompaniesController < BreadcrumbController
redirect_to params.merge(:page => 1)
end
- @companies = ModelDecorator.decorate(
- @companies,
- with: CompanyDecorator,
- context: {
- referential: line_referential
- }
- )
+ @companies = decorate_companies(@companies)
}
+
+ format.json {
+ @companies = decorate_companies(@companies)
+ }
+
build_breadcrumb :index
end
end
@@ -77,4 +76,14 @@ class CompaniesController < BreadcrumbController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def decorate_companies(companies)
+ ModelDecorator.decorate(
+ companies,
+ with: CompanyDecorator,
+ context: {
+ referential: line_referential
+ }
+ )
+ end
+
end
diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb
index d1f83340e..5dae1ba3f 100644
--- a/app/controllers/networks_controller.rb
+++ b/app/controllers/networks_controller.rb
@@ -37,14 +37,13 @@ class NetworksController < BreadcrumbController
redirect_to params.merge(:page => 1)
end
- @networks = ModelDecorator.decorate(
- @networks,
- with: NetworkDecorator,
- context: {
- line_referential: line_referential
- }
- )
+ @networks = decorate_networks(@networks)
}
+
+ format.js {
+ @networks = decorate_networks(@networks)
+ }
+
build_breadcrumb :index
end
end
@@ -87,4 +86,14 @@ class NetworksController < BreadcrumbController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def decorate_networks(networks)
+ ModelDecorator.decorate(
+ networks,
+ with: NetworkDecorator,
+ context: {
+ line_referential: line_referential
+ }
+ )
+ end
+
end
diff --git a/app/controllers/referential_companies_controller.rb b/app/controllers/referential_companies_controller.rb
index 53dde93bb..482f74ea0 100644
--- a/app/controllers/referential_companies_controller.rb
+++ b/app/controllers/referential_companies_controller.rb
@@ -14,14 +14,13 @@ class ReferentialCompaniesController < ChouetteController
redirect_to params.merge(:page => 1)
end
- @companies = ModelDecorator.decorate(
- @companies,
- with: CompanyDecorator,
- context: {
- referential: referential
- }
- )
+ @companies = decorate_companies(@companies)
}
+
+ format.js {
+ @companies = decorate_companies(@companies)
+ }
+
build_breadcrumb :index
end
end
@@ -70,4 +69,14 @@ class ReferentialCompaniesController < ChouetteController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def decorate_companies(companies)
+ ModelDecorator.decorate(
+ companies,
+ with: CompanyDecorator,
+ context: {
+ referential: referential
+ }
+ )
+ end
+
end
diff --git a/app/controllers/referential_networks_controller.rb b/app/controllers/referential_networks_controller.rb
index e0ce71ce4..ee2db8008 100644
--- a/app/controllers/referential_networks_controller.rb
+++ b/app/controllers/referential_networks_controller.rb
@@ -30,14 +30,13 @@ class ReferentialNetworksController < ChouetteController
redirect_to params.merge(:page => 1)
end
- @networks = ModelDecorator.decorate(
- @networks,
- with: ReferentialNetworkDecorator,
- context: {
- referential: referential
- }
- )
+ @networks = decorate_networks(@networks)
}
+
+ format.js {
+ @networks = decorate_networks(@networks)
+ }
+
build_breadcrumb :index
end
end
@@ -81,4 +80,14 @@ class ReferentialNetworksController < ChouetteController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def decorate_networks(networks)
+ ModelDecorator.decorate(
+ networks,
+ with: ReferentialNetworkDecorator,
+ context: {
+ referential: referential
+ }
+ )
+ end
+
end
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb
index b7fb2bf9b..edeb5a32f 100644
--- a/app/controllers/time_tables_controller.rb
+++ b/app/controllers/time_tables_controller.rb
@@ -86,16 +86,14 @@ class TimeTablesController < ChouetteController
redirect_to params.merge(:page => 1)
end
- @time_tables = ModelDecorator.decorate(
- @time_tables,
- with: TimeTableDecorator,
- context: {
- referential: @referential
- }
- )
+ @time_tables = decorate_time_tables(@time_tables)
build_breadcrumb :index
}
+
+ format.js {
+ @time_tables = decorate_time_tables(@time_tables)
+ }
end
end
@@ -195,6 +193,16 @@ class TimeTablesController < ChouetteController
Chouette::TimeTable.find(from_id) if from_id
end
+ def decorate_time_tables(time_tables)
+ ModelDecorator.decorate(
+ time_tables,
+ with: TimeTableDecorator,
+ context: {
+ referential: @referential
+ }
+ )
+ end
+
def time_table_params
params.require(:time_table).permit(
:objectid,