diff options
| author | soykje | 2017-06-20 12:13:48 +0200 |
|---|---|---|
| committer | GitHub | 2017-06-20 12:13:48 +0200 |
| commit | 11404ec5f9ae443f1a2de73dc491e07b3151f4c8 (patch) | |
| tree | fa45ad5284384e913d4b764db5723ec3a1cc9c29 /app/controllers | |
| parent | 041c6d8b732825dc8f84f3795e1fd63f0a30f483 (diff) | |
| parent | 150e71e3110292c0c27fe35a63e8a2d0e26c5259 (diff) | |
| download | chouette-core-11404ec5f9ae443f1a2de73dc491e07b3151f4c8.tar.bz2 | |
Merge pull request #22 from af83/3479-refactor-table_builder-helper
3479 refactor table builder helper
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/calendars_controller.rb | 6 | ||||
| -rw-r--r-- | app/controllers/lines_controller.rb | 5 | ||||
| -rw-r--r-- | app/controllers/referentials_controller.rb | 28 | ||||
| -rw-r--r-- | app/controllers/routes_controller.rb | 6 | ||||
| -rw-r--r-- | app/controllers/routing_constraint_zones_controller.rb | 4 | ||||
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 4 | ||||
| -rw-r--r-- | app/controllers/workbenches_controller.rb | 4 |
7 files changed, 44 insertions, 13 deletions
diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index 86d567882..5662316b8 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -5,6 +5,12 @@ class CalendarsController < BreadcrumbController respond_to :html respond_to :js, only: :index + def show + show! do + @calendar = @calendar.decorate + end + end + private def calendar_params permitted_params = [:id, :name, :short_name, periods_attributes: [:id, :begin, :end, :_destroy], date_values_attributes: [:id, :value, :_destroy]] diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb index 7eedaeb05..1e2056aad 100644 --- a/app/controllers/lines_controller.rb +++ b/app/controllers/lines_controller.rb @@ -25,6 +25,11 @@ class LinesController < BreadcrumbController def show @group_of_lines = resource.group_of_lines show! do + @line = @line.decorate(context: { + line_referential: @line_referential, + current_organisation: current_organisation + }) + build_breadcrumb :show end end diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index aa5b359da..1239d512f 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -24,19 +24,21 @@ class ReferentialsController < BreadcrumbController end def show - resource.switch - show! do |format| - format.json { - render :json => { :lines_count => resource.lines.count, - :networks_count => resource.networks.count, - :vehicle_journeys_count => resource.vehicle_journeys.count + resource.vehicle_journey_frequencies.count, - :time_tables_count => resource.time_tables.count, - :referential_id => resource.id} - } - format.html { build_breadcrumb :show} - end - - @reflines = lines_collection.paginate(page: params[:page], per_page: 10) + resource.switch + show! do |format| + @referential = @referential.decorate + + format.json { + render :json => { :lines_count => resource.lines.count, + :networks_count => resource.networks.count, + :vehicle_journeys_count => resource.vehicle_journeys.count + resource.vehicle_journey_frequencies.count, + :time_tables_count => resource.time_tables.count, + :referential_id => resource.id} + } + format.html { build_breadcrumb :show} + end + + @reflines = lines_collection.paginate(page: params[:page], per_page: 10) end def edit diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb index 73febc4b9..786bd57cc 100644 --- a/app/controllers/routes_controller.rb +++ b/app/controllers/routes_controller.rb @@ -42,6 +42,12 @@ class RoutesController < ChouetteController end show! do + @route = @route.decorate(context: { + referential: @referential, + line: @line, + route_sp: @route_sp + }) + build_breadcrumb :show end end diff --git a/app/controllers/routing_constraint_zones_controller.rb b/app/controllers/routing_constraint_zones_controller.rb index 7707427b0..9d2fd712c 100644 --- a/app/controllers/routing_constraint_zones_controller.rb +++ b/app/controllers/routing_constraint_zones_controller.rb @@ -16,6 +16,10 @@ class RoutingConstraintZonesController < ChouetteController def show @routing_constraint_zone = collection.find(params[:id]) + @routing_constraint_zone = @routing_constraint_zone.decorate(context: { + referential: @referential, + line: @line + }) end protected diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index 5c4552afb..3704f2885 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -14,6 +14,10 @@ class TimeTablesController < ChouetteController @year = params[:year] ? params[:year].to_i : Date.today.cwyear @time_table_combination = TimeTableCombination.new show! do + @time_table = @time_table.decorate(context: { + referential: @referential + }) + build_breadcrumb :show end end diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb index ccd55965b..1447c27de 100644 --- a/app/controllers/workbenches_controller.rb +++ b/app/controllers/workbenches_controller.rb @@ -14,6 +14,10 @@ class WorkbenchesController < BreadcrumbController q_for_result = scope.ransack(params[:q].merge(archived_at_not_null: nil, archived_at_null: nil)) @wbench_refs = sort_result(q_for_result.result).paginate(page: params[:page], per_page: 30) + @wbench_refs = ModelDecorator.decorate( + @wbench_refs, + with: ReferentialDecorator + ) @q = scope.ransack(params[:q]) show! do |
