diff options
| author | Robert | 2017-07-20 16:58:21 +0200 |
|---|---|---|
| committer | Robert | 2017-07-20 16:58:21 +0200 |
| commit | f11826644ecab4aa4217e3e06115b4af396ebd50 (patch) | |
| tree | 2bd87e50d3f6e5074f107dcd131ad1afcbd62193 /app/controllers/time_tables_controller.rb | |
| parent | a1368a9730e20b2e3a85885740e6fb7ffec435ad (diff) | |
| parent | 3fb343af351bfa4691ed3c7eb0930d9bb8d0d7ac (diff) | |
| download | chouette-core-f11826644ecab4aa4217e3e06115b4af396ebd50.tar.bz2 | |
merge conflicts resolved
Diffstat (limited to 'app/controllers/time_tables_controller.rb')
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index 20d500ea9..edeb5a32f 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -37,7 +37,7 @@ class TimeTablesController < ChouetteController tt_params = time_table_params if tt_params[:calendar_id] %i(monday tuesday wednesday thursday friday saturday sunday).map { |d| tt_params[d] = true } - calendar = current_organisation.calendars.find_by_id(tt_params[:calendar_id]) + calendar = Calendar.find(tt_params[:calendar_id]) tt_params[:calendar_id] = nil if tt_params.has_key?(:dates_attributes) || tt_params.has_key?(:periods_attributes) end @@ -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, |
